/* frontend/style.css - Bilingual Theme with Material Support and Bilingual Voice Toggle */
:root {
    --primary: #2d7d46;
    --primary-dark: #1e5a32;
    --secondary: #c62828;
    --secondary-light: #e53935;
    --accent: #ff6f00;
    --accent-light: #ff8f00;
    --light: #f8f9fa;
    --dark: #343a40;
    --success: #28a745;
    --warning: #ffc107;
    --info: #17a2b8;
    --danger: #dc3545;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 5px 15px rgba(0,0,0,0.1);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.3);
    --shadow-hover: 0 8px 25px rgba(0,0,0,0.15);
    
    --transition: all 0.3s ease;
    --border-radius: 8px;
    --border-radius-lg: 15px;
    --border-radius-xl: 20px;
}

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

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2d7d46 0%, #c62828 100%);
    min-height: 100vh;
    padding: 10px;
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100vw;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    background: white;
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

select,
input,
button,
textarea {
    max-width: 100%;
}

/* ============================================
 * HEADER
 * ============================================ */

.header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 1.5rem 1rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

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

.header h1 {
    font-size: 2rem;
    margin-bottom: 0.25rem;
    position: relative;
    z-index: 1;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.header h1 i {
    margin-right: 10px;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.header-badge {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.badge {
    background: rgba(255,255,255,0.2);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.1);
    transition: var(--transition);
}

.badge:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.badge i {
    margin-right: 5px;
}

.openrouter-badge a {
    color: white;
    text-decoration: underline;
}

.openrouter-badge a:hover {
    opacity: 0.8;
}

/* ============================================
 * MAIN CONTENT
 * ============================================ */

.main-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    width: 100%;
}

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

.hidden {
    display: none !important;
}

/* ============================================
 * AUTHENTICATION STYLES
 * ============================================ */

.auth-form {
    max-width: 400px;
    margin: 0 auto;
}

.auth-form h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--gray-800);
    font-size: 1.3rem;
}

.auth-form h2 i {
    color: var(--primary);
    margin-right: 0.5rem;
}

.auth-switch {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--gray-600);
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* ============================================
 * FORM STYLES
 * ============================================ */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    color: var(--gray-700);
    font-size: 0.95rem;
}

.form-input, .form-select {
    width: 100%;
    padding: 0.65rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    background: white;
}

.form-input:focus, .form-select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(45, 125, 70, 0.1);
}

.form-hint {
    display: block;
    color: var(--gray-600);
    font-size: 0.8rem;
    margin-top: 0.25rem;
    font-style: italic;
}

/* ============================================
 * BUTTON STYLES
 * ============================================ */

.btn {
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
    font-weight: 500;
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(45, 125, 70, 0.4);
}

.btn-voice {
    background: var(--secondary);
    color: white;
    font-size: 1rem;
    flex: 1;
    width: auto;
    min-width: 120px;
}

.btn-voice:hover:not(:disabled) {
    background: var(--secondary-light);
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(198, 40, 40, 0.4);
}

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

.btn-send {
    background: var(--accent);
    color: white;
    min-width: 80px;
    width: auto;
}

.btn-send:hover {
    background: var(--accent-light);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 111, 0, 0.4);
}

.btn-danger {
    background: var(--danger);
    color: white;
    flex: 1;
    min-width: 120px;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

.btn-secondary {
    background: var(--gray-600);
    color: white;
    flex: 1;
    min-width: 120px;
}

.btn-secondary:hover {
    background: var(--gray-700);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

.btn-danger-outline {
    background: transparent;
    color: var(--danger);
    border: 2px solid var(--danger);
    flex: 1;
    min-width: 120px;
}

.btn-danger-outline:hover {
    background: var(--danger);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    width: auto;
    min-width: auto;
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-info:hover {
    background: #138496;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(23, 162, 184, 0.3);
}

/* ============================================
 * LEARNING PROGRAM STYLES
 * ============================================ */

.learning-program {
    background: var(--gray-100);
    border-radius: var(--border-radius-lg);
    padding: 1rem;
    margin: 1rem 0;
    border: 2px solid var(--primary);
}

.learning-program h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.lesson-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1rem;
    border: 1px solid var(--gray-200);
}

.lesson-header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    align-items: center;
}

.lesson-level-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gray-100);
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
}

.level-emoji {
    font-size: 1rem;
}

.level-name {
    font-weight: 500;
}

.level-number {
    color: var(--gray-600);
    font-size: 0.7rem;
}

.lesson-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
}

.type-blue { background: #4a6fa5; }
.type-green { background: #28a745; }
.type-orange { background: #fd7e14; }
.type-purple { background: #6f42c1; }
.type-red { background: #dc3545; }
.type-dark { background: #343a40; }

.lesson-completed-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--success);
    font-size: 0.8rem;
    font-weight: 500;
}

.lesson-title {
    font-size: 1.15rem;
    margin: 0.5rem 0 0.25rem 0;
    color: var(--gray-800);
}

.lesson-unit {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.lesson-progress-bar {
    margin: 0.75rem 0;
}

.progress-track {
    background: var(--gray-200);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.progress-fill {
    background: var(--primary);
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--gray-600);
}

.lesson-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--gray-600);
    margin: 0.5rem 0;
}

.lesson-stats i {
    margin-right: 0.25rem;
}

.lesson-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0.75rem 0;
}

.lesson-guide-toggle {
    margin: 0.5rem 0;
}

.lesson-guide-content {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: var(--gray-100);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--primary);
}

.lesson-guide {
    font-size: 0.9rem;
    line-height: 1.8;
}

.lesson-guide h4 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.guide-text {
    white-space: pre-wrap;
    font-size: 0.9rem;
}

.lesson-loading {
    text-align: center;
    padding: 2rem;
    color: var(--gray-600);
}

.lesson-completed {
    text-align: center;
    padding: 2rem;
}

.lesson-completed h3 {
    color: var(--success);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.lesson-completed p {
    color: var(--gray-600);
    margin: 0.25rem 0;
}

/* ============================================
 * STUDENT INFO
 * ============================================ */

.student-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--gray-200);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.student-info h2 {
    color: var(--gray-800);
    font-size: 1.25rem;
}

.level-badge {
    background: var(--warning);
    color: var(--gray-800);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-weight: bold;
    display: inline-block;
    box-shadow: var(--shadow-sm);
    font-size: 0.85rem;
}

.user-badge {
    display: inline-block;
    background: var(--gray-200);
    color: var(--gray-700);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.user-badge i {
    margin-right: 0.25rem;
}

.profession-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.profession-badge i {
    margin-right: 0.25rem;
}

.model-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gray-100);
    padding: 0.4rem 0.75rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-300);
    flex-wrap: wrap;
    font-size: 0.9rem;
}

.model-select {
    padding: 0.2rem 0.4rem;
    border: 1px solid var(--gray-400);
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    background: white;
    transition: var(--transition);
    min-width: 150px;
}

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

.model-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(45, 125, 70, 0.2);
}

/* ============================================
 * VOICE CONTROLS - WITH BILINGUAL TOGGLE
 * ============================================ */

.voice-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    background: var(--gray-100);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

.voice-buttons {
    display: flex;
    gap: 0.5rem;
    flex: 2;
    min-width: 200px;
}

.voice-settings {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    width: 40px;
    height: 22px;
    background: var(--gray-400);
    border-radius: 24px;
    position: relative;
    transition: var(--transition);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.toggle-slider:before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .toggle-slider {
    background: var(--primary);
}

input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

.toggle-label {
    font-size: 0.85rem;
    color: var(--gray-700);
}

/* Bilingual Voice Toggle */
#bilingual-voice-toggle-container {
display: flex !important;
align-items: center;
gap: 0.5rem;
cursor: pointer;
user-select: none;
padding: 0 0.5rem;
border-left: 1px solid var(--gray-300);
}

#bilingual-voice-toggle-container .toggle-label {
font-size: 0.75rem;
color: var(--gray-700);
white-space: nowrap;
}

/* Voice Selector */
.voice-selector {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.5rem;
    border-left: 1px solid var(--gray-300);
}

.voice-selector label {
    font-size: 0.85rem;
    color: var(--gray-700);
    white-space: nowrap;
}

.voice-select {
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--gray-400);
    border-radius: 4px;
    font-size: 0.85rem;
    background: white;
    cursor: pointer;
    min-width: 100px;
}

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

.voice-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(45, 125, 70, 0.2);
}

.voice-visualizer {
    display: flex;
    gap: 3px;
    height: 25px;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
    min-width: 60px;
}

.voice-visualizer .bar {
    width: 4px;
    background: var(--primary);
    border-radius: 2px;
    animation: pulse 1s infinite alternate;
    opacity: 0.5;
}

.voice-visualizer .bar:nth-child(1) { animation-delay: 0s; }
.voice-visualizer .bar:nth-child(2) { animation-delay: 0.2s; }
.voice-visualizer .bar:nth-child(3) { animation-delay: 0.4s; }
.voice-visualizer .bar:nth-child(4) { animation-delay: 0.6s; }
.voice-visualizer .bar:nth-child(5) { animation-delay: 0.8s; }

.voice-visualizer.active .bar {
    animation-duration: 0.3s;
    opacity: 1;
}

@keyframes pulse {
    from { 
        height: 5px; 
        opacity: 0.3;
    }
    to { 
        height: 20px; 
        opacity: 1;
    }
}

/* ============================================
 * CHAT INTERFACE
 * ============================================ */

.chat-container {
    background: var(--gray-100);
    border-radius: var(--border-radius-lg);
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--gray-200);
    width: 100%;
}

.chat-messages {
    height: 300px;
    overflow-y: auto;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--gray-200);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--gray-500);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--gray-600);
}

.message {
    display: flex;
    margin-bottom: 0.75rem;
    animation: fadeIn 0.3s ease-out;
}

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

.el-primo-message {
    flex-direction: row;
}

.user-message {
    flex-direction: row-reverse;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    margin: 0 8px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    font-size: 0.8rem;
}

.el-primo-message .avatar {
    background: var(--primary);
}

.user-message .avatar {
    background: var(--secondary);
}

.bubble {
    max-width: 75%;
    padding: 0.5rem 0.75rem;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
}

.bubble p {
    margin: 0.2rem 0;
    font-size: 0.95rem;
}

.el-primo-message .bubble {
    background: white;
    border: 1px solid var(--gray-300);
    border-top-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.user-message .bubble {
    background: var(--primary);
    color: white;
    border-top-right-radius: 4px;
}

.typing-bubble {
    background: white !important;
    padding: 0.75rem !important;
}

.typing-dots {
    display: flex;
    gap: 4px;
    justify-content: center;
    align-items: center;
    height: 20px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--gray-500);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.6;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.chat-input {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.chat-input .form-input {
    flex: 1;
    min-width: 0;
}

/* ============================================
 * TOPICS
 * ============================================ */

.topics {
    margin-top: 1rem;
}

.topics h3 {
    color: var(--gray-700);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.topic-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.topic-btn {
    padding: 0.4rem 0.8rem;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--gray-700);
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.topic-btn i {
    color: var(--primary);
    font-size: 0.8rem;
}

.topic-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(45, 125, 70, 0.3);
    border-color: var(--primary);
}

.topic-btn:hover i {
    color: white;
}

/* ============================================
 * MATERIALS SECTION
 * ============================================ */

.pdf-materials {
    background: var(--gray-100);
    border-radius: var(--border-radius-lg);
    padding: 1rem;
    margin: 1rem 0;
    border: 2px solid var(--info);
}

.pdf-materials h3 {
    color: var(--info);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.pdf-upload-area {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 1rem;
    background: white;
    border-radius: var(--border-radius);
    border: 2px dashed var(--gray-300);
}

.pdf-file-input {
    flex: 1;
    min-width: 200px;
    padding: 0.4rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
}

.upload-hint {
    font-size: 0.8rem;
    color: var(--gray-600);
    font-style: italic;
}

.teacher-section {
    margin-bottom: 1rem;
}

/* ============================================
 * MATERIALS LIST
 * ============================================ */

.materials-list {
    margin-top: 0.5rem;
}

.material-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    margin-bottom: 0.5rem;
    transition: var(--transition);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.material-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.material-item.selected {
    border-color: var(--success);
    background: #f0fff4;
    border-width: 2px;
}

.material-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1;
    min-width: 150px;
}

.material-info i {
    color: var(--primary);
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.material-name {
    font-weight: 500;
    color: var(--gray-800);
    font-size: 0.9rem;
    word-break: break-word;
}

.material-size {
    color: var(--gray-600);
    font-size: 0.75rem;
    background: var(--gray-200);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.material-meta {
    color: var(--gray-500);
    font-size: 0.7rem;
}

.material-type {
    background: var(--gray-200);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.65rem;
    color: var(--gray-600);
    text-transform: uppercase;
}

.material-selected-badge {
    color: var(--success);
    font-size: 0.75rem;
    font-weight: 500;
}

.material-selected-badge i {
    color: var(--success);
    margin-right: 0.2rem;
}

.material-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}

/* ============================================
 * ACTIVE MATERIAL
 * ============================================ */

.active-material {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    border: 2px solid var(--success);
    margin-top: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.active-material-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.active-material-info i {
    color: var(--success);
    font-size: 1.1rem;
}

.active-material-info span {
    color: var(--gray-700);
    font-size: 0.9rem;
}

.active-material-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ============================================
 * NO MATERIALS
 * ============================================ */

.no-materials {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: var(--border-radius);
    border: 2px dashed var(--gray-300);
}

.no-materials p {
    color: var(--gray-600);
    font-size: 1rem;
    margin: 0.25rem 0;
}

.no-materials .hint {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-style: italic;
}

.no-materials i {
    font-size: 2rem;
    color: var(--gray-400);
    margin-bottom: 0.5rem;
}

/* ============================================
 * PROGRESS SECTION
 * ============================================ */

#progress-section {
background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1rem 0;
}

.stat {
    text-align: center;
    padding: 1rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--gray-200);
}

.stat:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
    line-height: 1.2;
}

.stat-label {
    color: var(--gray-600);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-container {
    position: relative;
    height: 200px;
    width: 100%;
    margin: 1rem 0;
    background: white;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

.progress-insights {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: white;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--warning);
    color: var(--gray-700);
    box-shadow: var(--shadow-sm);
    font-size: 0.95rem;
}

.progress-insights i {
    color: var(--warning);
    margin-right: 0.5rem;
}

/* ============================================
 * ACCOUNT ACTIONS
 * ============================================ */

.account-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

/* ============================================
 * FOOTER
 * ============================================ */

.footer {
    background: var(--gray-800);
    color: white;
    padding: 1rem;
    text-align: center;
    border-top: 1px solid var(--gray-700);
}

.footer p {
    opacity: 0.9;
    font-size: 0.85rem;
}

.footer p a {
    color: white;
    text-decoration: underline;
}

.footer-links {
    margin-top: 0.75rem;
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--gray-400);
    text-decoration: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
}

.footer-links a:hover {
    color: white;
    transform: translateY(-2px);
}

/* ============================================
 * NOTIFICATIONS
 * ============================================ */

.notification {
    position: fixed;
    top: 15px;
    right: 15px;
    left: 15px;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
    max-width: 400px;
    border: 1px solid var(--gray-200);
    margin: 0 auto;
}

.notification.show {
    transform: translateX(0);
}

.notification i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.notification span {
    flex: 1;
    font-size: 0.9rem;
    color: var(--gray-800);
}

.notification-success {
    border-left: 4px solid var(--success);
}

.notification-success i {
    color: var(--success);
}

.notification-error {
    border-left: 4px solid var(--danger);
}

.notification-error i {
    color: var(--danger);
}

.notification-warning {
    border-left: 4px solid var(--warning);
}

.notification-warning i {
    color: var(--warning);
}

.notification-info {
    border-left: 4px solid var(--primary);
}

.notification-info i {
    color: var(--primary);
}

/* ============================================
 * MOBILE RESPONSIVE
 * ============================================ */

@media (max-width: 480px) {
    body { padding: 5px; }
    
    .header { padding: 1rem 0.75rem; }
    .header h1 { font-size: 1.5rem; }
    .subtitle { font-size: 0.85rem; }
    .badge { font-size: 0.7rem; padding: 0.25rem 0.5rem; }
    
    .main-content { padding: 0.75rem; gap: 1rem; }
    .card { padding: 1rem; }
    
    .auth-form { max-width: 100%; padding: 0 0.5rem; }
    
    .student-info { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .student-info h2 { font-size: 1.1rem; }
    .model-indicator { width: 100%; justify-content: flex-start; font-size: 0.8rem; padding: 0.35rem 0.5rem; }
    .model-select { min-width: 120px; font-size: 0.8rem; }
    
    .voice-controls { flex-direction: column; padding: 0.5rem; gap: 0.5rem; }
    .voice-buttons { flex-direction: column; width: 100%; min-width: 0; }
    .btn-voice { width: 100%; min-width: 0; font-size: 0.9rem; padding: 0.5rem; }
    
    .voice-settings {
        flex-direction: column;
        align-items: center;
        width: 100%;
        gap: 0.5rem;
        border-top: 1px solid var(--gray-300);
        padding-top: 0.5rem;
    }
    
    #bilingual-voice-toggle-container {
    border-left: none;
    border-top: 1px solid var(--gray-300);
    padding-top: 0.5rem;
    margin-top: 0.25rem;
    width: 100%;
    justify-content: center;
    }
    
    .voice-selector {
        width: 100%;
        justify-content: center;
        padding: 0.5rem 0 0 0;
        display: flex !important;
        border-left: none;
    }
    
    .voice-selector label {
        font-size: 0.9rem;
    }
    
    .voice-select {
        min-width: 120px;
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }
    
    .voice-visualizer { min-width: 40px; }
    
    .chat-messages { height: 250px; padding: 0.5rem; }
    .bubble { max-width: 85%; }
    .bubble p { font-size: 0.9rem; }
    .avatar { width: 28px; height: 28px; font-size: 0.7rem; margin: 0 5px; }
    
    .chat-input { flex-direction: column; gap: 0.5rem; }
    .btn-send { width: 100%; min-width: 0; }
    
    .topic-btn { font-size: 0.75rem; padding: 0.3rem 0.6rem; white-space: normal; flex: 1 1 calc(50% - 0.5rem); min-width: 80px; justify-content: center; }
    .topic-buttons { gap: 0.4rem; }
    
    .progress-stats { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
    .stat { padding: 0.5rem; }
    .stat-value { font-size: 1.5rem; }
    .stat-label { font-size: 0.65rem; }
    .chart-container { height: 150px; padding: 0.5rem; }
    
    .account-actions { flex-direction: column; }
    .btn-danger, .btn-secondary, .btn-danger-outline { width: 100%; min-width: 0; }
    
    .footer-links { flex-direction: column; gap: 0.5rem; }
    
    .notification { left: 10px; right: 10px; max-width: none; min-width: auto; font-size: 0.85rem; padding: 0.6rem 0.8rem; }
    .form-input, .form-select { font-size: 0.9rem; padding: 0.5rem; }
    .form-group { margin-bottom: 0.75rem; }
    .level-badge { font-size: 0.75rem; padding: 0.25rem 0.5rem; }
    
    .lesson-header { flex-direction: column; align-items: flex-start; }
    .lesson-actions { flex-direction: column; }
    .lesson-actions .btn { width: 100%; }
    
    .material-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .material-info {
        min-width: 0;
    }
    
    .material-actions {
        justify-content: flex-start;
        margin-top: 0.3rem;
    }
    
    .material-actions .btn-sm {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
    
    .active-material {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .active-material-actions {
        justify-content: center;
    }
    
    .pdf-upload-area {
        flex-direction: column;
        align-items: stretch;
    }
    
    .pdf-file-input {
        min-width: 0;
        width: 100%;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    body { padding: 10px; }
    .header h1 { font-size: 1.8rem; }
    .main-content { padding: 1rem; gap: 1.25rem; }
    .card { padding: 1.25rem; }
    .auth-form { max-width: 100%; padding: 0 1rem; }
    .voice-controls { flex-direction: row; flex-wrap: wrap; }
    .voice-buttons { flex: 1; min-width: 200px; }
    .btn-voice { min-width: 100px; }
    .voice-settings { flex-wrap: wrap; justify-content: center; }
    .voice-selector { display: flex !important; }
    .chat-messages { height: 280px; }
    .topic-btn { font-size: 0.8rem; padding: 0.35rem 0.7rem; }
    .progress-stats { gap: 0.75rem; }
    .stat-value { font-size: 1.75rem; }
    .account-actions { flex-direction: row; flex-wrap: wrap; }
    .btn-danger, .btn-secondary, .btn-danger-outline { flex: 1; min-width: 140px; }
    
    .material-item {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .material-actions {
        justify-content: flex-end;
    }
}

@media (min-width: 769px) {
    .btn { width: auto; }
    .btn-primary { width: 100%; }
    .chat-messages { height: 350px; }
    .topic-btn { white-space: nowrap; }
    .account-actions { flex-direction: row; justify-content: center; }
    .btn-danger, .btn-secondary, .btn-danger-outline { flex: 0 1 auto; min-width: 180px; }
    .lesson-actions .btn { width: auto; }
    .voice-selector { display: flex !important; }
    
    .material-item {
        flex-direction: row;
    }
}

/* ============================================
 * UTILITY CLASSES
 * ============================================ */

.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.w-100 { width: 100%; }
