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

:root {
    /* Modern Color Palette - Warm & Inviting */
    --primary-gradient: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    --primary-color: #FF6B6B;
    --primary-dark: #E85555;
    --secondary-color: #4ECDC4;
    --secondary-dark: #3DBDB5;
    --accent-color: #FFE66D;
    --accent-warm: #FF8E53;
    
    /* Background Colors */
    --bg-primary: #FAFBFC;
    --bg-secondary: #F0F4F8;
    --bg-card: #FFFFFF;
    --bg-warm: linear-gradient(135deg, #FFF5F5 0%, #FFF8F0 100%);
    
    /* Text Colors */
    --text-primary: #2D3748;
    --text-secondary: #4A5568;
    --text-muted: #718096;
    --text-light: #A0AEC0;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 40px rgba(255, 107, 107, 0.3);
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Noto Sans SC', 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header - Modern Gradient with Glass Effect */
.header {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 50%, #FF6B6B 100%);
    color: white;
    padding: 60px 24px 80px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to bottom, transparent, var(--bg-primary));
}

.header h1 {
    font-size: 3.2rem;
    font-weight: 800;
    margin-bottom: 12px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    letter-spacing: -1px;
    position: relative;
    z-index: 1;
}

.header .subtitle {
    font-size: 1.25rem;
    opacity: 0.95;
    font-weight: 400;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Main Content */
.main {
    padding: 40px 24px 60px;
    position: relative;
}

/* Intro Section */
.intro {
    text-align: center;
    margin-bottom: 50px;
    padding: 30px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.intro h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 16px;
    font-weight: 700;
}

.intro p {
    color: var(--text-secondary);
    font-size: 1.15rem;
    margin-bottom: 8px;
    line-height: 1.8;
}

/* Translator Banner - Premium Design */
.translator-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 32px 40px;
    border-radius: var(--radius-lg);
    text-decoration: none;
    margin-bottom: 50px;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.translator-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.translator-banner:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 16px 50px rgba(102, 126, 234, 0.5);
}

.translator-banner:hover::before {
    opacity: 1;
}

.translator-banner .banner-left {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
}

.translator-banner .banner-icon {
    width: 72px;
    height: 72px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.translator-banner .banner-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.translator-banner .banner-title {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.translator-banner .banner-desc {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 400;
}

.translator-banner .banner-btn {
    background: rgba(255, 255, 255, 0.95);
    color: #667eea;
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.translator-banner .banner-btn:hover {
    background: white;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.translator-banner .banner-btn span {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.translator-banner:hover .banner-btn span {
    transform: translateX(4px);
}

/* Module Grid - Modern Cards */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 60px;
}

.module-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.module-card:hover::before {
    opacity: 1;
}

.module-icon {
    font-size: 3.2rem;
    margin-bottom: 16px;
    transition: transform 0.3s ease;
}

.module-card:hover .module-icon {
    transform: scale(1.1);
}

.module-card h3 {
    font-size: 1.35rem;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-weight: 600;
}

.module-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
}

/* Quick Phrases - Glassmorphism Style */
.quick-phrases {
    background: linear-gradient(135deg, #FFF8F0 0%, #FFF5F5 100%);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 107, 107, 0.1);
}

.quick-phrases h2 {
    text-align: center;
    margin-bottom: 32px;
    color: var(--primary-color);
    font-size: 1.8rem;
    font-weight: 700;
}

.phrase-list {
    display: grid;
    gap: 16px;
}

.phrase-item {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    align-items: center;
    padding: 20px 24px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.phrase-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(255, 107, 107, 0.2);
}

.phrase-item .chinese {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
}

.phrase-item .pinyin {
    font-size: 1rem;
    color: var(--secondary-color);
    font-style: italic;
}

.phrase-item .english {
    font-size: 1rem;
    color: var(--text-muted);
}

.speak-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.speak-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(255, 107, 107, 0.4);
}

/* Footer - Modern Dark */
.footer {
    background: linear-gradient(135deg, #2D3748 0%, #1A202C 100%);
    color: white;
    text-align: center;
    padding: 40px 24px;
    margin-top: auto;
}

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

/* Module Page Styles */
.module-header {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    color: white;
    padding: 40px 24px 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.module-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 70%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.module-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to bottom, transparent, var(--bg-primary));
}

.module-header h1 {
    font-size: 2.4rem;
    margin-bottom: 8px;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.module-header .back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    color: white;
    text-decoration: none;
    opacity: 0.9;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.module-header .back-link:hover {
    opacity: 1;
    transform: translateX(-4px);
}

.module-content {
    padding: 40px 24px;
}

/* Section Styles */
.section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.section h2 {
    font-size: 1.6rem;
    color: var(--primary-color);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--bg-secondary);
    font-weight: 700;
}

/* Vocabulary Table */
.vocab-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.vocab-table th {
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-dark));
    color: white;
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
}

.vocab-table td {
    padding: 16px;
    border-bottom: 1px solid var(--bg-secondary);
    vertical-align: middle;
}

.vocab-table tr:last-child td {
    border-bottom: none;
}

.vocab-table tr:hover {
    background: var(--bg-secondary);
}

.vocab-table .chinese-cell {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.vocab-table .speak-small {
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vocab-table .speak-small:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

.vocab-table .pinyin-cell {
    color: var(--secondary-color);
    font-style: italic;
    font-size: 1rem;
}

.vocab-table .english-cell {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Sentence Patterns */
.pattern-group {
    margin-bottom: 32px;
}

.pattern-group h3 {
    font-size: 1.2rem;
    color: var(--secondary-color);
    margin-bottom: 16px;
    padding-left: 12px;
    border-left: 4px solid var(--accent-color);
    font-weight: 600;
}

.sentence-item {
    background: var(--bg-secondary);
    padding: 20px 24px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
    transition: all 0.3s ease;
}

.sentence-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.sentence-item .chinese {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sentence-item .pinyin {
    color: var(--secondary-color);
    font-style: italic;
    margin-top: 6px;
    font-size: 1rem;
}

.sentence-item .english {
    color: var(--text-muted);
    margin-top: 4px;
    font-size: 0.95rem;
}

/* Dialogues */
.dialogue {
    background: linear-gradient(135deg, #F7FAFC 0%, #EDF2F7 100%);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.dialogue h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 700;
}

.dialogue-line {
    padding: 16px 20px;
    margin-bottom: 12px;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.dialogue-line.speaker-a {
    background: linear-gradient(135deg, #E6FFFA 0%, #B2F5EA 100%);
    border-left: 4px solid var(--secondary-color);
}

.dialogue-line.speaker-b {
    background: linear-gradient(135deg, #FFFAF0 0%, #FEEBC8 100%);
    border-left: 4px solid var(--accent-warm);
}

.dialogue-line .speaker {
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.dialogue-line .chinese {
    font-size: 1.15rem;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.dialogue-line .pinyin {
    color: var(--secondary-color);
    font-style: italic;
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.dialogue-line .english {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.dialogue-line .speak-small {
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dialogue-line .speak-small:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

/* Culture Tips */
.culture-tips {
    background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.culture-tips h2 {
    color: #D97706;
    border-bottom-color: #FCD34D;
}

.tip-item {
    padding: 20px 0;
    border-bottom: 1px dashed #FCD34D;
}

.tip-item:last-child {
    border-bottom: none;
}

.tip-item h4 {
    color: #B45309;
    margin-bottom: 10px;
    font-size: 1.1rem;
    font-weight: 600;
}

.tip-item p {
    color: #78350F;
    line-height: 1.8;
    font-size: 1rem;
}

/* Translator Page */
.translator-container {
    max-width: 800px;
    margin: 0 auto;
}

.translator-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.translator-input-group {
    margin-bottom: 24px;
}

.translator-input-group label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1rem;
}

.translator-input-group textarea {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    transition: all 0.3s ease;
}

.translator-input-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.1);
}

.translator-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.35);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.translator-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.45);
}

.translator-result {
    margin-top: 32px;
    padding: 28px;
    background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
    border-radius: var(--radius-md);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.translator-result h3 {
    color: #15803D;
    margin-bottom: 16px;
    font-size: 1.1rem;
    font-weight: 600;
}

.translator-result .result-chinese {
    font-size: 1.6rem;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 8px;
}

.translator-result .result-pinyin {
    font-size: 1.1rem;
    color: var(--secondary-color);
    font-style: italic;
    margin-bottom: 16px;
}

.translator-result .speak-btn {
    margin-top: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 40px 20px 60px;
    }
    
    .header h1 {
        font-size: 2.2rem;
    }
    
    .header .subtitle {
        font-size: 1rem;
    }
    
    .translator-banner {
        flex-direction: column;
        text-align: center;
        padding: 24px 28px;
        gap: 20px;
    }
    
    .translator-banner .banner-left {
        flex-direction: column;
        gap: 16px;
    }
    
    .translator-banner .banner-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .translator-banner .banner-title {
        font-size: 1.3rem;
    }
    
    .translator-banner .banner-btn {
        width: 100%;
        justify-content: center;
    }
    
    .modules-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .module-card {
        padding: 24px 16px;
    }
    
    .module-icon {
        font-size: 2.5rem;
    }
    
    .module-card h3 {
        font-size: 1.1rem;
    }
    
    .quick-phrases {
        padding: 28px 20px;
    }
    
    .phrase-item {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 16px 20px;
    }
    
    .phrase-item .speak-btn {
        justify-self: start;
        margin-top: 8px;
    }
    
    .vocab-table th,
    .vocab-table td {
        padding: 12px;
        font-size: 0.9rem;
    }
    
    .vocab-table .chinese-cell {
        font-size: 1.1rem;
    }
    
    .sentence-item {
        grid-template-columns: 1fr;
        padding: 16px 20px;
    }
    
    .section {
        padding: 24px 20px;
    }
    
    .translator-box {
        padding: 28px 20px;
    }
}

@media (max-width: 480px) {
    .modules-grid {
        grid-template-columns: 1fr;
    }
    
    .vocab-table {
        font-size: 0.85rem;
    }
    
    .vocab-table .chinese-cell {
        font-size: 1rem;
    }
}

/* Play Animation */
.playing {
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* Fade In Animation */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

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