/* ==========================================================================
   LINGUA SOUL - Base Styles
   Shared foundation for all lesson types
   ========================================================================== */

/* CSS Variables - Global Design System */
:root {
    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Poppins', sans-serif;

    /* Base Colors - Lingua Soul Brand */
    --color-bg-primary: #0a0e1a;
    --color-bg-secondary: #1a2332;
    --color-bg-tertiary: #2c3e50;
    --color-text-primary: #ffffff;
    --color-text-secondary: #e8eaed;
    --color-text-muted: #a0a8b3;

    /* Feedback Colors */
    --color-success: #27ae60;
    --color-success-light: rgba(39, 174, 96, 0.15);
    --color-error: #e74c3c;
    --color-error-light: rgba(231, 76, 60, 0.15);
    --color-info: #3498db;
    --color-info-light: rgba(52, 152, 219, 0.15);

    /* Spacing System */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-2xl: 4rem;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.25);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    /* Z-index */
    --z-sidebar: 100;
    --z-menu-toggle: 101;
    --z-progress: 1000;
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    font-size: 1.125rem;
    background: linear-gradient(135deg,
        var(--color-bg-primary) 0%,
        var(--color-bg-secondary) 50%,
        var(--color-bg-tertiary) 100%
    );
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--color-text-primary);
    line-height: 1.7;
    overflow-x: hidden;
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--space-sm);
}

p {
    margin-bottom: var(--space-sm);
}

strong {
    font-weight: 600;
}

/* ==========================================================================
   Layout - Container
   ========================================================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-xl);
    /* Center content between sidebar and ads areas */
    padding-right: calc(var(--space-xl) + 150px); /* Half of ads width to center */
}

/* Ads Column */
.ads-column {
    position: fixed;
    right: 0;
    top: 0;
    width: 300px;
    height: 100vh;
    padding: var(--space-lg);
    background: rgba(26, 35, 50, 0.5);
    border-left: 2px solid rgba(255, 107, 53, 0.3);
    overflow-y: auto;
    z-index: 50;
}

.ad-slot {
    background: rgba(0, 0, 0, 0.3);
    border: 2px dashed rgba(255, 107, 53, 0.3);
    border-radius: 12px;
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.875rem;
    text-align: center;
}

.ad-slot.sticky {
    position: sticky;
    top: var(--space-lg);
}

@media (max-width: 1400px) {
    .container {
        padding-right: var(--space-xl);
    }
    .ads-column {
        display: none;
    }
}

@media (max-width: 768px) {
    .container {
        padding: var(--space-md);
        margin-left: var(--space-md);
    }
}

/* ==========================================================================
   Progress Bar
   ========================================================================== */

.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: var(--theme-gradient, linear-gradient(90deg, #ff6b35, #e55a2b));
    transition: width var(--transition-base);
    z-index: var(--z-progress);
}

/* ==========================================================================
   Mobile Menu Toggle
   ========================================================================== */

.menu-toggle {
    display: none;
    position: fixed;
    top: var(--space-md);
    left: var(--space-md);
    z-index: var(--z-menu-toggle);
    background: var(--theme-color, #ff6b35);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-base);
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all var(--transition-base);
}

.menu-toggle:hover {
    transform: scale(1.05);
}

.menu-toggle:active {
    transform: scale(0.95);
}

@media (max-width: 1024px) {
    .menu-toggle {
        display: flex;
    }
}

/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 270px;
    height: 100vh;
    background: rgba(26, 35, 50, 0.98);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--theme-border, rgba(255, 107, 53, 0.2));
    display: flex;
    flex-direction: column;
    z-index: var(--z-sidebar);
    transition: transform var(--transition-base);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Sidebar Header */
.sidebar-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--theme-border, rgba(255, 107, 53, 0.2));
}

.lesson-badge {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--theme-badge-bg, rgba(255, 107, 53, 0.1));
    border-radius: var(--radius-md);
    border: 1px solid var(--theme-border, rgba(255, 107, 53, 0.2));
}

.badge-icon {
    font-size: 2rem;
    line-height: 1;
}

.badge-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.badge-type {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--theme-color, #ff6b35);
    opacity: 0.8;
}

.badge-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: var(--space-md);
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: var(--space-xs);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    color: var(--color-text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: var(--theme-color, #ff6b35);
    transform: scaleY(0);
    transition: transform var(--transition-base);
}

.nav-link:hover {
    background: var(--theme-hover-bg, rgba(255, 107, 53, 0.1));
    color: var(--theme-color, #ff6b35);
    transform: translateX(4px);
}

.nav-link.active {
    background: var(--theme-active-bg, rgba(255, 107, 53, 0.15));
    color: var(--theme-color, #ff6b35);
}

.nav-link.active::before {
    transform: scaleY(1);
}

.nav-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.nav-text {
    flex: 1;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--theme-border, rgba(255, 107, 53, 0.2));
}

.progress-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.progress-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.mini-progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.mini-progress-fill {
    height: 100%;
    background: var(--theme-gradient, linear-gradient(90deg, #ff6b35, #e55a2b));
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
    width: 0%;
}

.progress-percentage {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--theme-color, #ff6b35);
    text-align: center;
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }
}

/* ==========================================================================
   Lesson Header
   ========================================================================== */

.lesson-header {
    position: relative;
    text-align: center;
    padding: var(--space-2xl) var(--space-xl);
    margin-bottom: var(--space-2xl);
    background: rgba(26, 35, 50, 0.8);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    border: 2px solid var(--theme-border, rgba(255, 107, 53, 0.3));
    overflow: hidden;
    animation: fadeInUp 0.8s ease-out;
}

.header-decoration {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.floating-emoji {
    position: absolute;
    font-size: 3rem;
    opacity: 0.1;
    animation: float 6s ease-in-out infinite;
}

.floating-emoji:nth-child(1) {
    top: 10%;
    left: 10%;
}

.floating-emoji:nth-child(2) {
    top: 20%;
    right: 15%;
    animation-delay: 2s;
}

.floating-emoji:nth-child(3) {
    bottom: 15%;
    left: 15%;
    animation-delay: 4s;
}

.header-content {
    position: relative;
    z-index: 1;
}

.lesson-title {
    font-size: 3rem;
    font-weight: 800;
    color: var(--theme-color, #ff6b35);
    text-shadow: 2px 2px 12px rgba(0, 0, 0, 0.3);
    margin-bottom: var(--space-md);
}

.lesson-subtitle {
    font-size: 1.25rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-lg);
}

.lesson-meta {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    flex-wrap: wrap;
    margin-top: var(--space-lg);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    font-weight: 500;
}

.meta-icon {
    font-size: 1.25rem;
}

.quote-block {
    margin-top: var(--space-xl);
    padding: var(--space-lg);
    background: var(--theme-gradient, linear-gradient(135deg, #ff6b35, #e55a2b));
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.quote-text {
    font-size: 1.1rem;
    font-style: italic;
    margin-bottom: var(--space-sm);
    line-height: 1.6;
}

.quote-author {
    font-size: 0.95rem;
    opacity: 0.9;
    font-weight: 600;
}

/* ==========================================================================
   Lesson Sections
   ========================================================================== */

.lesson-section {
    background: rgba(26, 35, 50, 0.9);
    backdrop-filter: blur(10px);
    border: 2px solid var(--theme-border, rgba(255, 107, 53, 0.2));
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow-lg);
    scroll-margin-top: var(--space-lg);
    animation: slideInUp 0.6s ease-out;
    animation-fill-mode: both;
    transition: all var(--transition-base);
}

.lesson-section:hover {
    border-color: var(--theme-border-hover, rgba(255, 107, 53, 0.5));
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.lesson-section:nth-child(2) { animation-delay: 0.1s; }
.lesson-section:nth-child(3) { animation-delay: 0.2s; }
.lesson-section:nth-child(4) { animation-delay: 0.3s; }
.lesson-section:nth-child(5) { animation-delay: 0.4s; }
.lesson-section:nth-child(6) { animation-delay: 0.5s; }

.section-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 2px solid var(--theme-color, #ff6b35);
}

.section-icon {
    font-size: 2.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.section-title-group {
    flex: 1;
}

.section-title {
    font-size: 2rem;
    color: var(--theme-color, #ff6b35);
    margin-bottom: var(--space-xs);
}

.section-subtitle {
    font-size: 1rem;
    color: var(--color-text-muted);
    font-weight: 400;
    margin: 0;
}

/* ==========================================================================
   Exercise Cards
   ========================================================================== */

.exercise-card {
    background: rgba(44, 62, 80, 0.3);
    border: 2px solid var(--theme-border, rgba(255, 107, 53, 0.3));
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    transition: all var(--transition-base);
}

.exercise-card:hover {
    background: rgba(44, 62, 80, 0.5);
    border-color: var(--theme-border-hover, rgba(255, 107, 53, 0.6));
}

.exercise-instructions {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--theme-instructions-bg, rgba(255, 107, 53, 0.1));
    border-left: 4px solid var(--theme-color, #ff6b35);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-xl);
}

.instruction-icon {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.instruction-text {
    flex: 1;
}

.instruction-text p {
    margin: 0;
    line-height: 1.6;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: var(--theme-gradient, linear-gradient(135deg, #ff6b35, #e55a2b));
    color: white;
}

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

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

.btn-secondary {
    background: linear-gradient(135deg, var(--color-info), #2980b9);
    color: white;
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.exercise-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    flex-wrap: wrap;
}

/* ==========================================================================
   Score Display & Feedback
   ========================================================================== */

.score-display {
    display: none;
    padding: var(--space-lg);
    background: linear-gradient(135deg, var(--color-success), #229954);
    border-radius: var(--radius-md);
    margin-top: var(--space-xl);
    text-align: center;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.4s ease-out;
}

.score-display h3 {
    font-size: 1.5rem;
    margin-bottom: var(--space-md);
}

.score-display p {
    font-size: 1.1rem;
    margin: var(--space-xs) 0;
}

.explanation-box {
    display: none;
    padding: var(--space-lg);
    background: rgba(44, 62, 80, 0.8);
    border: 2px solid var(--theme-border, rgba(255, 107, 53, 0.4));
    border-radius: var(--radius-md);
    margin-top: var(--space-lg);
    animation: slideIn 0.4s ease-out;
}

.explanation-box h4 {
    color: var(--theme-color, #ff6b35);
    margin-bottom: var(--space-md);
}

.explanation-box ul {
    list-style: none;
    padding: 0;
}

.explanation-box li {
    padding: var(--space-sm) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.explanation-box li:last-child {
    border-bottom: none;
}

/* Input States */
.correct {
    border-color: var(--color-success) !important;
    background: var(--color-success-light) !important;
    box-shadow: 0 0 15px rgba(39, 174, 96, 0.3) !important;
}

.incorrect {
    border-color: var(--color-error) !important;
    background: var(--color-error-light) !important;
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.3) !important;
}

/* ==========================================================================
   Animations
   ========================================================================== */

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

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

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

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

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.bounce {
    animation: bounce 0.6s ease-in-out;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .lesson-title {
        font-size: 2rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .lesson-meta {
        flex-direction: column;
        align-items: center;
    }

    .exercise-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 240px;
    }

    .lesson-header {
        padding: var(--space-lg) var(--space-md);
    }

    .lesson-section {
        padding: var(--space-lg) var(--space-md);
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.text-center {
    text-align: center;
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--theme-color, #ff6b35);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--theme-color-dark, #e55a2b);
}
