/* ==========================================================================
   LINGUA SOUL - Lesson Common Styles
   Shared styles for all interactive lessons with sidebar navigation
   ========================================================================== */

/* Main Layout with Sidebar */
body {
    margin: 0;
    padding: 0;
    display: flex;
    min-height: 100vh;
}

/* Page Layout Container */
.page-layout {
    display: grid;
    grid-template-columns: 200px 1fr 300px;
    grid-template-areas: "sidebar content ads";
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    gap: 0;
}

/* Sidebar Navigation - Auto-hide with hover */
.lesson-sidebar,
.sidebar {
    grid-area: sidebar;
    position: fixed;
    left: -240px;
    top: 0;
    width: 260px;
    height: 100vh;
    background: rgba(26, 35, 50, 0.98);
    backdrop-filter: blur(10px);
    border-right: 2px solid var(--theme-border, rgba(255, 107, 53, 0.3));
    display: flex;
    flex-direction: column;
    z-index: var(--z-sidebar, 100);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
}

/* Hover trigger area */
.sidebar-trigger {
    position: fixed;
    left: 0;
    top: 0;
    width: 20px;
    height: 100vh;
    z-index: 99;
}

/* Show sidebar on hover */
.sidebar:hover,
.sidebar.active {
    left: 0;
}

/* Small indicator when sidebar is hidden */
.sidebar-indicator {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 80px;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.9), rgba(229, 90, 43, 0.9));
    border-radius: 0 12px 12px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    opacity: 0.7;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    z-index: 98;
    box-shadow: 2px 0 15px rgba(255, 107, 53, 0.4);
}

.sidebar-indicator:hover {
    opacity: 1;
    width: 48px;
    box-shadow: 4px 0 20px rgba(255, 107, 53, 0.6);
    transform: translateY(-50%) translateX(2px);
}

.sidebar:hover ~ .sidebar-indicator,
.sidebar.active ~ .sidebar-indicator {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) translateX(-20px);
}

/* Sidebar Logo */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-md, 1.5rem);
    padding: var(--space-lg, 2rem);
    border-bottom: 2px solid var(--theme-border, rgba(255, 107, 53, 0.3));
    background: rgba(0, 0, 0, 0.3);
    position: relative;
}

.logo-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-text-primary, #ffffff);
    font-family: var(--font-display, 'Poppins', sans-serif);
}


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

.lesson-sidebar-badge {
    display: flex;
    align-items: center;
    gap: var(--space-md, 1.5rem);
    padding: var(--space-md, 1.5rem);
    background: var(--theme-badge-bg, rgba(255, 107, 53, 0.15));
    border-radius: var(--radius-lg, 16px);
    border: 2px solid var(--theme-border, rgba(255, 107, 53, 0.4));
}

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

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

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

.sidebar-badge-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text-primary, #ffffff);
    line-height: 1.3;
}

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

.lesson-sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

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

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-md, 1.5rem);
    padding: var(--space-md, 1.5rem);
    color: var(--color-text-secondary, #e8eaed);
    text-decoration: none;
    border-radius: var(--radius-md, 12px);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all var(--transition-base, 250ms ease);
    position: relative;
    overflow: hidden;
}

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

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

.sidebar-nav-link.active {
    background: var(--theme-active-bg, rgba(255, 107, 53, 0.25));
    color: var(--theme-color, #ff6b35);
    font-weight: 600;
}

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

.sidebar-nav-icon {
    font-size: 1.35rem;
    line-height: 1;
    flex-shrink: 0;
}

.sidebar-nav-text {
    flex: 1;
}

/* Sidebar Footer - Progress Info */
.lesson-sidebar-footer {
    padding: var(--space-lg, 2rem);
    border-top: 2px solid var(--theme-border, rgba(255, 107, 53, 0.3));
    background: rgba(0, 0, 0, 0.2);
}

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

.sidebar-progress-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted, #a0a8b3);
    text-align: center;
}

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

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

.sidebar-progress-percentage {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--theme-color, #ff6b35);
    text-align: center;
    margin-top: var(--space-xs, 0.5rem);
}

/* Mobile Menu Toggle */
.lesson-menu-toggle {
    display: none;
    position: fixed;
    top: var(--space-md, 1.5rem);
    left: var(--space-md, 1.5rem);
    z-index: 101;
    background: var(--theme-color, #ff6b35);
    border: none;
    width: 54px;
    height: 54px;
    border-radius: var(--radius-md, 12px);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.2));
    transition: all var(--transition-base, 250ms ease);
}

.lesson-menu-toggle span {
    display: block;
    width: 26px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all var(--transition-base, 250ms ease);
}

.lesson-menu-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(255, 107, 53, 0.4);
}

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

.lesson-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.lesson-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.lesson-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
}

/* Top Navbar */
.top-navbar {
    position: fixed;
    top: 0;
    left: 280px;
    right: 0;
    height: 70px;
    background: rgba(26, 35, 50, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--theme-border, rgba(255, 107, 53, 0.3));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl, 3rem);
    z-index: 90;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.navbar-logo-section {
    display: flex;
    align-items: center;
    gap: var(--space-md, 1.5rem);
}

.navbar-logo-img {
    width: 45px;
    height: 45px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.navbar-logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary, #ffffff);
    font-family: var(--font-display, 'Poppins', sans-serif);
}

.navbar-lesson-info {
    display: flex;
    align-items: center;
    gap: var(--space-md, 1.5rem);
}

.navbar-lesson-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-muted, #a0a8b3);
}

.navbar-back-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm, 1rem);
    padding: var(--space-sm, 1rem) var(--space-lg, 2rem);
    background: var(--theme-gradient, linear-gradient(135deg, #ff6b35, #e55a2b));
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md, 12px);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all var(--transition-base, 250ms ease);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.navbar-back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.5);
}

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

.navbar-back-icon {
    font-size: 1.2rem;
}

/* Main Content Area */
.lesson-main-content {
    margin-left: 280px;
    margin-top: 70px; /* Space for navbar */
    flex: 1;
    padding: var(--space-xl, 3rem);
    width: calc(100% - 280px);
}

/* Lesson Header */
.lesson-content-header {
    text-align: center;
    padding: var(--space-2xl, 4rem) var(--space-xl, 3rem);
    margin-bottom: var(--space-2xl, 4rem);
    background: rgba(26, 35, 50, 0.9);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-xl, 20px);
    border: 2px solid var(--theme-border, rgba(255, 107, 53, 0.3));
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.2));
    position: relative;
    overflow: hidden;
}

.lesson-content-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--theme-gradient, linear-gradient(90deg, #ff6b35, #e55a2b));
}

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

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

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

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

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

/* Exercise Sections */
.lesson-exercise-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, 20px);
    padding: var(--space-xl, 3rem);
    margin-bottom: var(--space-xl, 3rem);
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.2));
    scroll-margin-top: var(--space-lg, 2rem);
    transition: all var(--transition-base, 250ms ease);
}

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

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

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

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

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

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

/* Two Column Layout for Exercises */
.exercise-two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl, 3rem);
    margin-top: var(--space-lg, 2rem);
}

.exercise-column {
    background: rgba(44, 62, 80, 0.3);
    border: 2px solid var(--theme-border, rgba(255, 107, 53, 0.3));
    border-radius: var(--radius-lg, 16px);
    padding: var(--space-lg, 2rem);
}

/* Single Exercise Card */
.exercise-single-column {
    background: rgba(44, 62, 80, 0.3);
    border: 2px solid var(--theme-border, rgba(255, 107, 53, 0.3));
    border-radius: var(--radius-lg, 16px);
    padding: var(--space-xl, 3rem);
    margin-top: var(--space-lg, 2rem);
}

/* Exercise Subtitle */
.exercise-subtitle {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--theme-color, #ff6b35);
    margin-bottom: var(--space-lg, 2rem);
    display: flex;
    align-items: center;
    gap: var(--space-sm, 1rem);
}

.exercise-subtitle-icon {
    font-size: 1.5rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .lesson-sidebar {
        transform: translateX(-100%);
    }

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

    .lesson-menu-toggle {
        display: flex;
    }

    .top-navbar {
        left: 0;
        padding: 0 var(--space-lg, 2rem);
    }

    .navbar-logo-text {
        display: none; /* Hide text on tablet/mobile */
    }

    .lesson-main-content {
        margin-left: 0;
        width: 100%;
        padding: var(--space-lg, 2rem);
    }

    .exercise-two-column {
        grid-template-columns: 1fr;
        gap: var(--space-lg, 2rem);
    }
}

@media (max-width: 768px) {
    .top-navbar {
        padding: 0 var(--space-md, 1.5rem);
        height: 60px;
    }

    .navbar-lesson-title {
        display: none; /* Hide lesson title on small screens */
    }

    .navbar-back-btn {
        padding: var(--space-xs, 0.5rem) var(--space-md, 1.5rem);
        font-size: 0.875rem;
    }

    .lesson-content-title {
        font-size: 2rem;
    }

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

    .lesson-main-content {
        margin-top: 60px; /* Adjusted for smaller navbar */
        padding: var(--space-md, 1.5rem);
    }

    .lesson-exercise-section {
        padding: var(--space-lg, 2rem);
    }

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

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

    .lesson-content-header {
        padding: var(--space-lg, 2rem) var(--space-md, 1.5rem);
    }

    .lesson-exercise-section {
        padding: var(--space-md, 1.5rem);
    }
}

/* Sidebar Scrollbar Styling */
.lesson-sidebar::-webkit-scrollbar {
    width: 8px;
}

.lesson-sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

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

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

/* Smooth Transitions */
* {
    transition: background-color var(--transition-base, 250ms ease),
                border-color var(--transition-base, 250ms ease);
}

/* Floating back button shared styling */
.material-back-button {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1200;
}

.material-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    background: linear-gradient(135deg, #00d4ff, #0ea5e9);
    color: #0f172a;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 10px 25px rgba(0, 212, 255, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.material-back-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(0, 212, 255, 0.35);
}

.material-back-icon {
    font-size: 1.2rem;
}
