/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    color: #2c3e50;
    padding: 20px 0;
}

header h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    font-weight: 700;
    color: #2c3e50;
}

header p {
    font-size: 1.1rem;
    color: #6c757d;
    font-weight: 400;
}

/* Main content */
main {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    max-width: 600px;
    margin: 0 auto;
}

/* Form styles */
.message-form {
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 1rem;
}

textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ced4da;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease;
    background: white;
    min-height: 120px;
}

textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.char-count {
    text-align: right;
    margin-top: 5px;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Button styles */
.submit-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-transform: none;
    letter-spacing: normal;
}

.submit-btn:hover:not(:disabled) {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Status messages */
.status-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin: 20px 0;
    font-weight: 500;
    text-align: center;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-message.hidden {
    display: none;
}

/* Info section */
.info-section {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 25px;
    border-radius: 10px;
    margin: 30px 0;
}

.info-section h3 {
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.info-section ul {
    list-style: none;
    padding-left: 0;
}

.info-section li {
    padding: 5px 0;
    position: relative;
    padding-left: 25px;
}

.info-section li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #2ecc71;
    font-weight: bold;
    font-size: 1.2rem;
}

/* Stats section */
.stats-section {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Admin styles */
.admin-container {
    max-width: 1200px;
}

.admin-header {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
    text-align: center;
}

.admin-header h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
}

.admin-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.refresh-btn {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.3);
}

.message-stats {
    font-weight: 600;
    color: #555;
}

.messages-container {
    display: grid;
    gap: 20px;
}

.message-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #667eea;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.message-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.message-date {
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
}

.message-id {
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #666;
}

.message-content {
    white-space: pre-wrap;
    line-height: 1.6;
    color: #333;
    font-size: 1rem;
    margin-bottom: 15px;
}

.delete-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-1px);
}

.no-messages {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-style: italic;
    font-size: 1.1rem;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    color: #6c757d;
    font-size: 0.9rem;
}

/* Loading animation */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

.message-card {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.admin-controls button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    main {
        padding: 25px;
    }
    
    .admin-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .message-header {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    main {
        padding: 20px;
    }
    
    .submit-btn {
        font-size: 1rem;
        padding: 12px 25px;
    }
}