/* ============================================
   ENGLISH MASTER - GIAO DIỆN HIỆN ĐẠI
   Màu chính: #0066CC | #FF6B35
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #0066CC;
    --primary-dark: #004d99;
    --primary-light: #e6f0ff;
    --secondary: #FF6B35;
    --secondary-dark: #e55a2b;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --dark: #1F2937;
    --gray: #6B7280;
    --light: #F9FAFB;
    --white: #FFFFFF;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9edf2 100%);
    min-height: 100vh;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--white);
    min-height: 100vh;
    box-shadow: var(--shadow-xl);
}

/* ========== NAVBAR ========== */
.navbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    box-shadow: var(--shadow-md);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--white);
}

.logo span {
    background: var(--secondary);
    padding: 0.2rem 0.6rem;
    border-radius: 40px;
    font-size: 0.8rem;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.nav-links a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 0.5rem 0.9rem;
    border-radius: 40px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.25s ease;
}

.nav-links a:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

.nav-links a.active {
    background: var(--secondary);
    color: white;
}

/* ========== MAIN CONTENT ========== */
.main-content {
    padding: 1.5rem;
    min-height: 70vh;
}

/* ========== HERO ========== */
.hero-section {
    background: linear-gradient(135deg, var(--primary) 0%, #0052a3 100%);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 2rem;
    color: white;
    text-align: center;
}

.hero-section h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

.hero-section p {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ========== BUTTONS ========== */
.btn-primary, .btn-secondary {
    padding: 0.75rem 1.8rem;
    border: none;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--secondary);
    color: white;
    box-shadow: 0 4px 14px rgba(255,107,53,0.4);
}

.btn-primary:hover {
    background: var(--secondary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.3);
}

/* ========== CARDS ========== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.03);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.card h2, .card h3 {
    margin-bottom: 1rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ========== STATS ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--white) 0%, #f8fafc 100%);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 1px solid rgba(0,102,204,0.1);
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 0.5rem;
}

/* ========== LESSON LIST ========== */
.lesson-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #eef2f6;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: var(--radius-md);
}

.lesson-item:hover {
    background: var(--primary-light);
    transform: translateX(5px);
}

.lesson-icon {
    font-size: 2rem;
    width: 50px;
    text-align: center;
}

.lesson-info {
    flex: 1;
}

.lesson-title {
    font-weight: 700;
    color: var(--dark);
}

.lesson-desc {
    font-size: 0.8rem;
    color: var(--gray);
}

.lesson-status {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 40px;
    background: #eef2f6;
    color: var(--gray);
}

/* ========== VOCABULARY ========== */
.vocab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.vocab-item {
    background: var(--light);
    padding: 1rem;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border: 1px solid #eef2f6;
}

.vocab-word {
    font-weight: 700;
    color: var(--primary);
}

.vocab-meaning {
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 0.25rem;
}

.speak-btn {
    background: var(--primary-light);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--primary);
}

.speak-btn:hover {
    background: var(--primary);
    color: white;
}

/* ========== QUIZ ========== */
.quiz-option {
    background: var(--light);
    padding: 1rem 1.2rem;
    margin: 0.75rem 0;
    border-radius: 60px;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 1px solid #eef2f6;
    font-weight: 500;
}

.quiz-option:hover {
    background: var(--primary-light);
    transform: translateX(8px);
}

.quiz-option.correct {
    background: var(--success);
    color: white;
}

.quiz-option.wrong {
    background: var(--danger);
    color: white;
}

/* ========== FOOTER ========== */
.footer {
    background: var(--dark);
    color: #9ca3af;
    text-align: center;
    padding: 1.5rem;
    font-size: 0.8rem;
}

/* ========== INPUTS ========== */
input, textarea, select {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--white);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

/* ========== TOOLTIP ========== */
.tooltip-global {
    position: fixed;
    background: var(--dark);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-size: 0.85rem;
    z-index: 10001;
    pointer-events: none;
    animation: fadeOutTooltip 1.5s forwards;
    box-shadow: var(--shadow-lg);
    max-width: 250px;
}

@keyframes fadeOutTooltip {
    0% { opacity: 0; transform: translateY(5px); }
    15% { opacity: 1; transform: translateY(0); }
    85% { opacity: 1; }
    100% { opacity: 0; transform: translateY(-10px); visibility: hidden; }
}

/* ========== GAME BOARDS ========== */
.game-board {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
    overflow-x: auto;
}

.caro-board {
    display: grid;
    gap: 1px;
    background: #de9e5e;
    padding: 8px;
    border-radius: var(--radius-md);
}

.caro-cell {
    background: #f5deb3;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2rem;
    aspect-ratio: 1 / 1;
    min-width: 32px;
}

.caro-cell:hover {
    background: #ffeb3b;
}

.co-ganh-board {
    display: grid;
    gap: 2px;
    background: #8B4513;
    padding: 10px;
    border-radius: var(--radius-md);
}

.co-ganh-cell {
    background: #f5deb3;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.3rem;
    aspect-ratio: 1 / 1;
    min-width: 45px;
}

.o-an-quan-board {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.o-cell {
    width: 65px;
    height: 65px;
    background: #f5deb3;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.o-cell:hover {
    transform: scale(1.05);
    background: #ffeb3b;
}

.xiangqi-board, .chess-board {
    max-width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

/* ========== TRỢ LÝ ẢO ========== */
.virtual-assistant {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    max-width: calc(100% - 40px);
    background: var(--white);
    border-radius: 24px;
    box-shadow: var(--shadow-xl);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.assistant-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 14px 18px;
    border-radius: 24px 24px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.assistant-status {
    font-size: 0.7rem;
    background: var(--success);
    padding: 2px 10px;
    border-radius: 30px;
    margin-left: 10px;
}

.assistant-messages {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--light);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.assistant-message, .user-message {
    display: flex;
    gap: 10px;
}

.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    background: #e5e7eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.user-message .message-avatar {
    background: var(--secondary);
}

.message-content {
    max-width: 70%;
    background: var(--white);
    padding: 10px 14px;
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
}

.user-message .message-content {
    background: var(--secondary);
    color: white;
}

.message-time {
    font-size: 0.65rem;
    color: var(--gray);
    margin-top: 5px;
    text-align: right;
}

.assistant-input-wrapper {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e5e7eb;
}

.assistant-input-wrapper input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 30px;
}

.assistant-send-btn, .assistant-mic-btn {
    background: var(--secondary);
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    color: white;
}

.assistant-mic-btn.recording {
    background: var(--danger);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ========== FLASHCARD ========== */
.flashcard-section {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: var(--radius-xl);
}

.flashcard {
    background: var(--white);
    padding: 35px 20px;
    text-align: center;
    border-radius: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.flashcard-word {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
}

.flashcard-meaning {
    font-size: 20px;
    color: var(--gray);
    margin-top: 15px;
    display: none;
}

.flashcard.show .flashcard-meaning {
    display: block;
}

/* ========== INSTALL GUIDE ========== */
.install-guide {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.install-guide-inner {
    background: var(--white);
    border-radius: 28px;
    max-width: 400px;
    width: 90%;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

.install-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.install-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
}

.install-content {
    padding: 1.5rem;
}

.install-step {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--light);
    border-radius: 20px;
    align-items: center;
}

.step-icon {
    font-size: 2rem;
    min-width: 50px;
    text-align: center;
}

.highlight {
    background: #fee2e2;
    color: var(--secondary);
    padding: 0.1rem 0.4rem;
    border-radius: 20px;
}

.install-note {
    background: #fef3c7;
    padding: 1rem;
    border-radius: 16px;
    font-size: 0.8rem;
    color: #92400e;
    margin-top: 1rem;
}

.install-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: linear-gradient(135deg, var(--dark), #1a1a2e);
    border-radius: 60px;
    padding: 0.75rem 1rem;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    animation: slideUpBanner 0.4s ease;
}

@keyframes slideUpBanner {
    from { opacity: 0; transform: translateY(50px); }
    to { opacity: 1; transform: translateY(0); }
}

.install-banner-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.install-banner-icon {
    font-size: 1.8rem;
}

.install-banner-text {
    flex: 1;
}

.install-banner-text strong {
    color: white;
    display: block;
    font-size: 0.9rem;
}

.install-banner-text span {
    color: #9ca3af;
    font-size: 0.7rem;
}

.install-banner-btn {
    background: var(--secondary);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 40px;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }
    
    .nav-links {
        justify-content: center;
    }
    
    .nav-links a {
        padding: 0.4rem 0.7rem;
        font-size: 0.8rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .hero-section {
        padding: 1.5rem;
    }
    
    .hero-section h1 {
        font-size: 1.6rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .stat-number {
        font-size: 1.8rem;
    }
    
    .vocab-grid {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 1rem;
    }
    
    .virtual-assistant {
        width: calc(100% - 20px);
        bottom: 10px;
        right: 10px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .caro-cell {
        min-width: 28px;
        font-size: 0.9rem;
    }
    
    .co-ganh-cell {
        min-width: 38px;
        font-size: 1rem;
    }
    
    .o-cell {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }
}