/* ============================================
   VIETNAMESE LEARNING CHATBOT - STYLES
   ============================================ */

:root {
    /* Colors */
    --primary: #667eea;
    --primary-dark: #764ba2;
    --secondary: #ec4899;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --light: #f3f4f6;
    --dark: #1f2937;
    --text: #374151;
    --border: #e5e7eb;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);

    /* Radius */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    /* Transitions */
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-image: url('../images/backgroud_ngang.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-color: var(--primary);
    color: var(--text);
    width: 100%;
    height: 100vh;
    overflow: hidden;
    margin: 0;
    padding: 0;
    position: relative;
}

/* Add a subtle overlay to ensure text readability */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(102, 126, 234, 0.15);
    pointer-events: none;
    z-index: 1;
}

/* ============ PAGES ============ */
.page {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    z-index: 2;
}

.page.active {
    display: flex;
    flex-direction: column;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    z-index: 10;
}

/* ============ AUTH PAGE ============ */
#authPage {
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 450px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 40px 30px;
    position: relative;
    overflow: hidden;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.logo-section {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
}

.logo {
    font-size: 60px;
    margin-bottom: 15px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.logo-section h1 {
    font-size: 24px;
    color: var(--dark);
    margin-bottom: 5px;
}

.logo-section p {
    color: var(--text);
    font-size: 14px;
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
}

.tab-button {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    background: white;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.tab-button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.tab-button.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-color: transparent;
}

/* Forms */
.auth-form {
    display: none;
    position: relative;
    z-index: 1;
    animation: slideUp 0.4s ease;
}

.auth-form.active {
    display: block;
}

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

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark);
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: var(--transition);
    background: white;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input:hover {
    border-color: var(--primary);
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    padding: 10px 16px;
    background: var(--light);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--border);
}

/* Alert */
.alert {
    padding: 14px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    animation: slideDown 0.3s ease;
    position: relative;
    z-index: 1;
}

.alert.hidden {
    display: none;
}

.alert.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-left: 4px solid var(--success);
}

.alert.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-left: 4px solid var(--danger);
}

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

/* Loading Indicator */
.loading-indicator {
    text-align: center;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.loading-indicator.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-indicator p {
    font-size: 14px;
    color: var(--text);
    margin-top: 8px;
}

/* Floating Decorations */
.float-bubble {
    position: absolute;
    font-size: 40px;
    animation: float 6s ease-in-out infinite;
    opacity: 0.1;
}

.bubble-1 {
    top: 20px;
    right: 20px;
    animation-delay: 0s;
}

.bubble-2 {
    bottom: 40px;
    left: 20px;
    animation-delay: 2s;
}

.bubble-3 {
    top: 50%;
    right: 10px;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

/* ============ CHAT PAGE ============ */
#chatPage {
    display: flex;
    flex-direction: column;
        background-image: url('../images/backgroud_ngang.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-color: var(--primary);
}

.chat-header {
    /* background: white; */
    /* opacity : 0.8; */
    /* border-bottom: 2px solid var(--border); */
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* box-shadow: var(--shadow); */
    flex-shrink: 0;
}

.header-content h1 {
    font-size: 20px;
    color: var(--dark);
    margin-bottom: 4px;
}

.header-content .subtitle {
    font-size: 12px;
    color: var(--text);
}

.header-buttons {
    display: flex;
    gap: 10px;
}

.header-btn {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border);
    background: white;
    opacity : 0.8;
    color: var(--primary);
    font-size: 16px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-btn:hover {
    background: var(--light);
    border-color: var(--primary);
}

.header-btn:active {
    transform: scale(0.95);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.welcome-message {
    margin: auto;
    text-align: center;
    color: var(--text);
}

.welcome-message .emoji {
    font-size: 60px;
    margin-bottom: 16px;
    animation: wobble 2s ease-in-out infinite;
}

@keyframes wobble {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

.welcome-message h2 {
    font-size: 24px;
    color: var(--dark);
    margin-bottom: 8px;
}

.welcome-message p {
    font-size: 14px;
    margin-bottom: 8px;
}

/* Messages */
.message {
    display: flex;
    gap: 12px;
    animation: slideUp 0.3s ease;
}

.message.user {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.message.user .message-bubble {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    
}

.message.assistant .message-bubble {
    background: var(--light);
    border: 1px solid var(--border);
    color: var(--text);
}

/* Message formatting for assistant messages */
.message.assistant .message-bubble p {
    margin: 8px 0;
}

.message.assistant .message-bubble strong {
    font-weight: 700;
    color: var(--primary);
}

.message.assistant .message-bubble em {
    font-style: italic;
    opacity: 0.9;
}

.message.assistant .message-bubble ul {
    margin: 8px 0;
    padding-left: 20px;
    list-style-type: disc;
}

.message.assistant .message-bubble li {
    margin: 4px 0;
}

.message.assistant .message-bubble br {
    content: '';
}

/* Markdown Tables */
.message.assistant .message-bubble .markdown-table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
    font-size: 13px;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message.assistant .message-bubble .markdown-table thead {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.message.assistant .message-bubble .markdown-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.message.assistant .message-bubble .markdown-table th:last-child {
    border-right: none;
}

.message.assistant .message-bubble .markdown-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

.message.assistant .message-bubble .markdown-table td:last-child {
    border-right: none;
}

.message.assistant .message-bubble .markdown-table tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.05);
}

.message.assistant .message-bubble .markdown-table tbody tr:last-child td {
    border-bottom: none;
}

/* Links in messages */
.message.assistant .message-bubble a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 2px solid var(--primary);
    transition: all 0.2s ease;
    word-break: break-word;
}

.message.assistant .message-bubble a:hover {
    color: var(--primary-dark);
    border-bottom-color: var(--primary-dark);
    background-color: rgba(102, 126, 234, 0.1);
    padding: 2px 4px;
    border-radius: var(--radius-sm);
}

.message.assistant .message-bubble a:active {
    opacity: 0.8;
}

.message-audio {
    margin-top: 8px;
}

.message-audio audio {
    max-width: 100%;
    height: 30px;
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    margin: 0 20px;
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

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

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Input Area */
.chat-input-area {
    opacity : 0.8;
    /* background: white; */
    /* border-top: 2px solid var(--border); */
    padding: 16px 20px;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-textarea-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.message-textarea {
    flex: 1;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    transition: var(--transition);
}

.message-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-buttons {
    display: flex;
    gap: 10px;
}

.btn-send {
    width: 40px;
    height: 40px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-size: 16px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-send:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-end-chat {
    width: 40px;
    height: 40px;
    border: none;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: white;
    font-size: 16px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Purpose Selector */
.chat-purpose-selector {
    /* background: white; */
    opacity : 0.8;
    /* border-bottom: 2px solid var(--border); */
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.chat-purpose-selector label {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.purpose-select {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.purpose-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.purpose-select:hover {
    border-color: var(--primary);
}

/* Input Toolbar */
.input-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border);
    background: white;
    color: var(--primary);
    font-size: 16px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

.btn-icon:active {
    background: rgba(102, 126, 234, 0.1);
}

/* Image Preview */
.image-preview {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(102, 126, 234, 0.08);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--primary);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-preview img {
    width: 24px;
    height: 24px;
    border-radius: 2px;
    object-fit: cover;
}

.btn-end-chat:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.3);
}

.btn-end-chat:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============ MODALS ============ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.modal-content {
    position: relative;
    background: white;
    border-radius: var(--radius-lg);
    margin: auto;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
}

.modal-content.modal-small {
    max-width: 350px;
}

.modal-content.modal-large {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid var(--border);
}

.modal-header h2 {
    font-size: 18px;
    color: var(--dark);
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--light);
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--border);
}

.modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 2px solid var(--border);
}

.modal-footer .btn-secondary,
.modal-footer .btn-primary {
    flex: 1;
}

/* Settings */
.settings-group {
    margin-bottom: 20px;
}

.settings-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark);
}

.settings-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    background: white;
    transition: var(--transition);
}

.settings-group select:hover {
    border-color: var(--primary);
}

.settings-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.settings-info {
    padding: 12px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-radius: var(--radius);
    font-size: 13px;
    display: flex;
    gap: 8px;
}

.settings-info i {
    flex-shrink: 0;
}

/* History */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

/* Summary */
.summary-section {
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}

.summary-section h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-section p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    margin: 0;
}

.summary-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.summary-section li {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
}

.summary-section li:before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: 700;
}

.history-item-title {
    font-weight: 600;
    color: var(--dark);
    font-size: 14px;
    margin-bottom: 4px;
}

.history-item-date {
    font-size: 12px;
    color: var(--text);
}

.empty-state {
    text-align: center;
    padding: 30px 20px;
    color: var(--text);
    font-size: 14px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .auth-container {
        max-width: 100%;
        padding: 30px 20px;
    }

    .message-bubble {
        max-width: 85%;
    }

    .chat-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .header-buttons {
        align-self: flex-end;
    }

    .modal-content {
        width: 95%;
        margin: 0 auto;
        height: 90vh;
    }

    /* Fix input area layout on mobile */
    .input-group {
        flex-direction: column;
        gap: 8px;
    }

    .input-textarea-row {
        display: flex;
        gap: 8px;
        align-items: flex-end;
        width: 100%;
    }

    .message-textarea {
        flex: 1;
        min-width: 0;
        padding: 10px 12px;
        font-size: 14px;
        max-height: 100px;
    }

    .input-buttons {
        display: flex;
        gap: 8px;
        flex-shrink: 0;
        justify-content: flex-end;
    }

    .btn-send,
    .btn-end-chat {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .input-toolbar {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 4px 0;
        overflow-x: auto;
    }

    .btn-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
        flex-shrink: 0;
    }

    .image-preview {
        font-size: 11px;
        padding: 2px 6px;
        max-width: 120px;
    }

    /* Fix purpose selector on mobile */
    .chat-purpose-selector {
        padding: 10px 16px;
        gap: 8px;
        flex-wrap: wrap;
    }

    .chat-purpose-selector label {
        font-size: 12px;
        white-space: nowrap;
    }

    .purpose-select {
        flex: 1;
        min-width: 200px;
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* ============ SCROLLBAR ============ */
.chat-messages::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ============ UTILITIES ============ */
.hidden {
    display: none !important;
}

/* ============ ADMIN PAGE ============ */
#adminPage {
    display: flex;
    flex-direction: column;
    background: #f3f4f6;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: white;
    border-bottom: 2px solid var(--border);
    flex-shrink: 0;
}

.admin-header .header-content h1 {
    font-size: 24px;
    color: var(--dark);
    margin-bottom: 4px;
}

.admin-header .subtitle {
    color: var(--text);
    font-size: 14px;
}

.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--light);
}

/* Stats */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-info h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
}

/* Admin Tabs */
.admin-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    background: white;
    padding: 12px 20px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.admin-tab-button {
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
    position: relative;
    bottom: -12px;
}

.admin-tab-button:hover {
    color: var(--primary);
}

.admin-tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.admin-tab-content {
    display: none;
    background: white;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 20px;
    animation: slideUp 0.3s ease;
}

.admin-tab-content.active {
    display: block;
}

/* Students List */
.students-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.student-item {
    background: var(--light);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.student-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateX(4px);
}

.student-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 4px;
}

.student-info p {
    font-size: 12px;
    color: var(--text);
}

.student-stats {
    display: flex;
    gap: 20px;
    text-align: center;
}

.student-stat {
    font-size: 12px;
}

.student-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

/* Statistics */
.statistics-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.chart-container {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.chart-container h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 16px;
}

.chart {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 12px;
}

.chart-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.bar {
    width: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius);
    transition: var(--transition);
    min-height: 10px;
}

.chart-bar:hover .bar {
    transform: scaleY(1.1);
}

.chart-label {
    font-size: 11px;
    color: var(--text);
    text-align: center;
    width: 50px;
}

.chart-value {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
}

.student-detail-info {
    background: var(--light);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.student-detail-info p {
    margin: 8px 0;
    font-size: 14px;
}

.student-detail-info strong {
    color: var(--dark);
}

.conversations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.conversation-item {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.conversation-item:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

.conversation-item p {
    margin: 4px 0;
    font-size: 13px;
}

.loading {
    text-align: center;
    color: var(--text);
    padding: 40px 20px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============ SIMPLIFIED ADMIN DASHBOARD ============ */

.stats-summary {
    margin-bottom: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-box {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-box h3 {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.students-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.students-section h2 {
    font-size: 18px;
    color: var(--dark);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.students-table {
    width: 100%;
    border-collapse: collapse;
}

.students-table thead {
    background: var(--light);
}

.students-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--dark);
    font-size: 13px;
    border-bottom: 2px solid var(--border);
}

.students-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text);
}

.student-row {
    cursor: pointer;
    transition: var(--transition);
}

.student-row:hover {
    background: var(--light);
}

.student-row:hover td {
    color: var(--primary);
    font-weight: 500;
}

.no-data {
    text-align: center;
    color: var(--text);
    padding: 40px 20px;
    font-size: 14px;
}

.loading {
    text-align: center;
    color: var(--text);
    padding: 20px;
    font-size: 14px;
}

input button textarea {
    opacity: 0.8 !important;
}
@media (max-width: 768px) {
    /* Thêm đoạn này để đổi ảnh nền sang dọc cho điện thoại */
    body, #chatPage {
        background-image: url('../images/backgroud_doc.jpg') !important;
    }
}