/* Modern CSS Reset and Base Styles */
:root {
    --primary-color: #1d4ed8;
    --primary-hover: #1e40af;
    --secondary-color: #60a7fa;
    --accent-color: #f59e0b;
    --background-color: #000000;
    --card-background: rgba(30, 41, 59, 0.7);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --border-color: rgba(148, 163, 184, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.2);
    --gradient-start: #60a7fa;
    --gradient-end: #23d1ee;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.05);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    --card-hover-transform: translateY(-5px);
    --card-hover-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    /* Fixed navbar height for courses page (64px nav + ~8px spacing) */
    --nav-height: 72px;
}

/* Light mode variables */
[data-theme="light"] {
    --background-color: #ffffff;
    --card-background: rgba(255, 255, 255, 0.8);
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: rgba(209, 213, 219, 0.5);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(209, 213, 219, 0.3);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --card-hover-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    background-color: var(--background-color);
    background-size: 40px 40px;
    background-position: center;
    overflow-x: hidden;
    width: 100%;
}

/* Prevent anchor jumps/content from hiding under fixed nav */
html, body {
    scroll-padding-top: var(--nav-height);
}

h1, h2, h3, h4, h5, h6, .main-heading, .main-text {
    font-family: 'Doto', sans-serif !important;
}

/* Enhanced Container and Layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* Offset content below the fixed navbar */
body.authenticated .container,
.container {
    padding-top: calc(var(--nav-height) + 16px);
}

/* Enhanced Header Styling */
.courses-header {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
    padding: 2rem 0 3rem 0;
}

.header-content {
    margin-bottom: 2rem;
    position: relative;
}

.main-heading {
    text-align: center;
    margin-bottom: 1.25rem;
    line-height: 1.05;
    letter-spacing: -1.5px;
}

.title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.title-row span {
    text-shadow: 0 0 20px rgba(148, 163, 184, 0.5);
    font-weight: 600;
}

.dot {
    text-shadow: 0 0 30px rgba(34, 197, 94, 0.8);
}

.main-heading span:nth-child(2) {
    color: var(--text-primary);
    text-shadow: 0 0 30px rgba(148, 163, 184, 0.3);
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-weight: 400;
    letter-spacing: 0.25px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
    text-shadow: 0 0 10px rgba(148, 163, 184, 0.3);
    position: relative;
}

.subtitle::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 2px;
    background: var(--secondary-color);
    border-radius: 1px;
}

/* Search Container */
.search-container {
    margin: -1rem auto 0 auto;
    max-width: 500px;
    width: 100%;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border) !important;
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
    transition: none;
    backdrop-filter: blur(10px);
    outline: none !important;
    box-shadow: none !important;
}

.search-box:focus-within {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--secondary-color) !important;
    outline: none !important;
    box-shadow: none !important;
}

.search-box * {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.search-box i {
    color: var(--text-secondary);
    margin-right: 0.5rem;
    font-size: 0.9rem;
    transition: none;
}

.search-box:focus-within i {
    color: var(--secondary-color);
}

.search-box input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    font-family: inherit;
    box-shadow: none;
}

.search-box input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}



/* Language Cards Grid */
.languages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

/* Language Card Styling */
.language-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    transition: none;
    position: relative;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.5rem;
}

.language-card:hover {
    background: rgba(96, 167, 250, 0.05);
    border-color: rgba(96, 167, 250, 0.2);
    box-shadow: var(--card-hover-shadow);
}

[data-theme="light"] .language-card:hover {
    background: rgba(96, 167, 250, 0.1);
    border-color: rgba(96, 167, 250, 0.3);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.language-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 10px;
    background: var(--glass-bg);
    padding: 6px;
}

.language-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex-grow: 1;
}

.difficulty-badges {
    display: none !important;
}

.badge {
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.beginner {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge.intermediate {
    background: rgba(234, 179, 8, 0.2);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.badge.advanced {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.card-content {
    flex-grow: 1;
    margin-bottom: 1rem;
}

.language-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.video-count {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--secondary-color);
    font-size: 0.8rem;
    font-weight: 500;
}

.video-count i {
    font-size: 1rem;
}

.card-actions {
    margin-top: auto;
}

.watch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--primary-color);
    color: #ffffff;
    text-decoration: none;
    border: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: none;
}

.watch-btn:hover {
    background: var(--primary-hover);
    box-shadow: 0 8px 25px rgba(29, 78, 216, 0.3);
}



/* Videos Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
}



.modal-content {
    position: relative;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    max-width: 1200px;
    width: 90%;
    max-height: 90vh;
    margin: 2rem auto;
    box-shadow: var(--glass-shadow);
    overflow: hidden;
}



.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    border-bottom: 1px solid var(--glass-border);
}

.modal-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: none;
}

.close-btn:hover {
    color: var(--text-primary);
    background: var(--glass-bg);
}

.modal-body {
    padding: 2rem;
    max-height: calc(90vh - 120px);
    overflow-y: auto;
}

/* Videos Grid */
.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.video-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    transition: none;
    cursor: pointer;
}

.video-card:hover {
    border-color: rgba(96, 167, 250, 0.3);
    box-shadow: var(--card-hover-shadow);
}

[data-theme="light"] .video-card:hover {
    border-color: rgba(96, 167, 250, 0.4);
}

.video-thumbnail {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: none;
}

.video-card:hover .video-thumbnail {
    transform: none;
}

.video-info {
    padding: 1.5rem;
}

.video-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.video-difficulty {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.video-difficulty.beginner {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.video-difficulty.intermediate {
    background: rgba(234, 179, 8, 0.2);
    color: #eab308;
}

.video-difficulty.advanced {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.video-language {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    :root { --nav-height: 64px; }
    .container {
        padding: 1rem;
    }

    .main-heading {
        letter-spacing: -2px;
    }

    .languages-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .language-card {
        padding: 1rem;
    }

    .card-header {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .language-icon {
        width: 50px;
        height: 50px;
    }

    .difficulty-badges {
        justify-content: center;
    }

    .modal-content {
        width: 95%;
        margin: 1rem auto;
    }

    .modal-header {
        padding: 1.5rem;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .videos-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    :root { --nav-height: 56px; }
    .main-heading {
        letter-spacing: -1px;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .language-card {
        padding: 0.6rem;
    }

    .modal-header h2 {
        font-size: 1.5rem;
    }

    /* Ensure two cards per row on very small screens */
    .languages-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

/* Loading Animation */
.loading {
    position: relative;
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
}

/* No Results Message */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
}

.no-results-content {
    max-width: 400px;
    margin: 0 auto;
}

.no-results-content i {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-results-content h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.no-results-content p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.5;
}





/* Theme Toggle Button Styles */
#theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: none;
}

#theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

[data-theme="light"] #theme-toggle {
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.2);
}

[data-theme="light"] #theme-toggle:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Theme toggle icon - no animations */
#theme-toggle-icon {
    transition: none;
}

/* Back Button Theme Adaptation */
nav a[href="index.html"] {
    background: rgba(31, 41, 55, 0.5) !important;
    border: 1px solid rgba(75, 85, 99, 0.3) !important;
}

nav a[href="index.html"]:hover {
    background: rgba(55, 65, 81, 0.5) !important;
}

nav a[href="index.html"] svg {
    color: #d1d5db !important;
}

nav a[href="index.html"]:hover svg {
    color: #ffffff !important;
}

/* Light theme overrides for back button */
[data-theme="light"] nav a[href="index.html"] {
    background: rgba(0, 0, 0, 0.1) !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
}

[data-theme="light"] nav a[href="index.html"]:hover {
    background: rgba(0, 0, 0, 0.2) !important;
}

[data-theme="light"] nav a[href="index.html"] svg {
    color: #374151 !important;
}

[data-theme="light"] nav a[href="index.html"]:hover svg {
    color: #111827 !important;
}

/* Logo Theme Adaptation */
#logo-toggle img {
    filter: brightness(1);
    transition: filter 0.3s ease;
}

[data-theme="light"] #logo-toggle img {
    filter: brightness(0.1);
}

[data-theme="light"] #logo-toggle img:hover {
    filter: brightness(0.2);
} 

/* Quiz button responsive tweaks */
#quiz-btn {
    /* Ensure good touch target and consistent height */
    height: 40px;
    padding: 0 10px;
    line-height: 1;
}

#quiz-btn svg {
    /* Smooth alignment with text, inherit current color */
    display: inline-block;
    vertical-align: middle;
    color: currentColor;
}

/* Level badge responsive positioning */
#quiz-level-badge {
    transition: all 0.3s ease;
}

/* On small screens, keep only icon compact and adjust position */
@media (max-width: 640px) {
    #quiz-btn {
        padding: 0 8px;
        height: 36px;
        border-radius: 9999px;
        /* Hide the text and badge on very small screens to prevent overlap */
        position: relative;
    }
    
    #quiz-btn svg {
        width: 18px !important;
        height: 18px !important;
    }
    
    /* Hide text on mobile to save space */
    #quiz-btn .hidden.sm\\:inline {
        display: none !important;
    }
    
    /* Position level badge below the navigation on mobile when present */
    #quiz-level-badge {
        position: fixed !important;
        top: 76px !important; /* Just below the 64px nav height + some spacing */
        right: 6px !important;
        z-index: 45 !important;
        display: block !important;
        font-size: 0.6rem !important;
        padding: 0.25rem 0.5rem !important;
        border-radius: 12px !important;
        backdrop-filter: blur(8px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    /* Ensure the badge doesn't interfere with navigation layout */
    nav .absolute.right-4 {
        position: static;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
    }
}

/* For very small screens, position badge even lower */
@media (max-width: 480px) {
    #quiz-level-badge {
        top: 70px !important;
        right: 4px !important;
        font-size: 0.55rem !important;
        padding: 0.2rem 0.4rem !important;
    }
}

/* Light theme adjustments for mobile badge */
@media (max-width: 640px) {
    [data-theme="light"] #quiz-level-badge {
        border: 1px solid rgba(0, 0, 0, 0.2);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
}