/* ==========================================================================
   SGN LearnSphere - Modern Educational Knowledge Platform
   Global Stylesheet with CSS Custom Properties, Dark Mode & Micro-Interactions
   ========================================================================== */

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: rgba(59, 130, 246, 0.12);
    --secondary-color: #8b5cf6;
    --secondary-hover: #7c3aed;
    --accent-color: #10b981;
    --border-radius-base: 12px;
    --font-family-base: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-family-code: 'Fira Code', 'Cascadia Code', 'Source Code Pro', monospace;
    --navbar-height: 70px;

    /* Default Ultra-Sleek Midnight Obsidian Dark Palette */
    --bg-body: #05070f;
    --bg-surface: #0a0f1d;
    --bg-surface-elevated: #111827;
    --bg-subtle: #0d1424;
    --text-main: #f8fafc;
    --text-body: #cbd5e1;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.04);
    --card-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.6);
    --card-shadow-hover: 0 16px 36px -6px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(59, 130, 246, 0.35);
    --glass-bg: rgba(5, 7, 15, 0.92);
    --glass-border: rgba(255, 255, 255, 0.09);
    --search-bg: rgba(13, 20, 36, 0.95);
    --search-border: rgba(255, 255, 255, 0.14);
    --kbd-bg: rgba(255, 255, 255, 0.1);
    --kbd-text: #94a3b8;
}

[data-theme="light"] {
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #ffffff;
    --bg-subtle: #f1f5f9;
    --text-main: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --card-shadow-hover: 0 12px 24px -4px rgba(0, 0, 0, 0.08), 0 4px 8px -2px rgba(0, 0, 0, 0.04);
    --glass-bg: rgba(255, 255, 255, 0.92);
    --glass-border: rgba(226, 232, 240, 0.9);
    --search-bg: #f1f5f9;
    --search-border: #cbd5e1;
    --kbd-bg: #e2e8f0;
    --kbd-text: #64748b;
}

[data-theme="dark"] {
    --bg-body: #05070f;
    --bg-surface: #0a0f1d;
    --bg-surface-elevated: #111827;
    --bg-subtle: #0d1424;
    --text-main: #f8fafc;
    --text-body: #cbd5e1;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.04);
    --card-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.6);
    --card-shadow-hover: 0 16px 36px -6px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(59, 130, 246, 0.35);
    --glass-bg: rgba(5, 7, 15, 0.92);
    --glass-border: rgba(255, 255, 255, 0.09);
    --search-bg: rgba(13, 20, 36, 0.95);
    --search-border: rgba(255, 255, 255, 0.14);
    --kbd-bg: rgba(255, 255, 255, 0.1);
    --kbd-text: #94a3b8;
}

/* Base Reset & Core Elements */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-base);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.65;
    margin: 0;
    padding: 0;
    transition: background-color 0.25s ease, color 0.25s ease;
    overflow-x: hidden;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* Typography Enhancements */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-main);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.25;
}

.text-main {
    color: var(--text-main) !important;
}

.text-gradient {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-gradient-accent {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ==========================================================================
   HEADER & STICKY NAVBAR - BEAUTIFUL ALIGNMENT & GLASSMORPHISM
   ========================================================================== */
.site-navbar {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    min-height: var(--navbar-height);
    transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    z-index: 1040;
    padding: 0.6rem 0;
    will-change: transform;
    transform: translateZ(0); /* Promotes navbar to GPU compositing layer, preventing background flickering */
}

.site-navbar.scrolled {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    background: var(--glass-bg);
}

.navbar-inner-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

/* Brand Logo */
.navbar-brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main) !important;
    text-decoration: none;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.navbar-brand-logo .brand-icon-box {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.navbar-brand-logo:hover .brand-icon-box {
    transform: scale(1.05) rotate(3deg);
}

.navbar-brand-logo .brand-dot {
    color: var(--primary-color);
}

/* ==========================================================================
   GLOBAL SEARCH BAR - CENTER PROMINENT & HIGH-TECH ACCENTS
   ========================================================================== */
.header-search-wrapper {
    width: 240px;
    min-width: 190px;
    max-width: 280px;
    position: relative;
    flex-shrink: 0;
    transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 1200px) {
    .header-search-wrapper:focus-within {
        width: 320px;
        max-width: 340px;
    }
}

.header-search-form {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.header-search-form .search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
    transition: color 0.2s ease;
    z-index: 2;
}

.global-search-input {
    width: 100%;
    height: 38px;
    padding: 0.4rem 3.8rem 0.4rem 2.4rem;
    border-radius: 50px;
    border: 1px solid var(--search-border);
    background: var(--search-bg);
    color: var(--text-main);
    font-size: 0.84rem;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.global-search-input::placeholder {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.global-search-input:focus {
    background: var(--bg-surface);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25), 0 8px 24px rgba(0, 0, 0, 0.3);
}

.global-search-input:focus ~ .search-icon {
    color: var(--primary-color);
}

.search-kbd-badge {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--kbd-bg);
    color: var(--kbd-text);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-family: var(--font-family-code);
    font-weight: 600;
    pointer-events: none;
    user-select: none;
    line-height: 1.2;
}

/* Floating Autocomplete Dropdown - Roomy & Anchored */
.search-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 520px;
    max-width: min(520px, calc(100vw - 32px));
    min-width: 360px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.65);
    max-height: 440px;
    overflow-y: auto;
    z-index: 1085;
    display: none;
    padding: 0.5rem 0;
    animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.search-autocomplete-dropdown::-webkit-scrollbar {
    width: 6px;
}
.search-autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.search-result-item {
    padding: 9px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
    text-decoration: none !important;
    transition: background 0.15s ease;
}

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

.search-result-item:hover, .search-result-item.active {
    background: var(--primary-light);
}

.search-result-item .result-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--bg-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.search-result-item .result-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-item .result-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.search-dropdown-footer {
    padding: 8px 14px;
    background: var(--bg-subtle);
    border-top: 1px solid var(--border-color);
    font-size: 0.78rem;
    text-align: center;
}

.search-dropdown-footer a {
    color: var(--primary-color);
    font-weight: 600;
}

/* Glowing Search Entity Badges */
.badge-primary-glow { background: rgba(59, 130, 246, 0.18); color: #60a5fa; }
.badge-success-glow { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.badge-warning-glow { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
.badge-info-glow { background: rgba(6, 182, 212, 0.18); color: #22d3ee; }
.badge-danger-glow { background: rgba(239, 68, 68, 0.18); color: #f87171; }
.badge-secondary-glow { background: rgba(139, 92, 246, 0.18); color: #c084fc; }

/* Navigation Links in Header - Single-Line Guaranteed, Geometric Vertical Baseline */
.navbar-nav-wrapper {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    overflow: visible !important;
}

.navbar-nav {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow: visible !important;
}

.navbar-nav .nav-item {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin: 0;
    position: relative;
}

.navbar-nav .nav-item.dropdown {
    position: relative;
}

.navbar-nav .nav-link {
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    color: var(--text-muted) !important;
    font-weight: 500;
    font-size: 0.86rem;
    padding: 0 0.8rem !important;
    border-radius: 8px;
    transition: color 0.15s ease, background-color 0.15s ease;
    white-space: nowrap !important;
    box-sizing: border-box;
    cursor: pointer;
}

.navbar-nav .nav-link:focus,
.navbar-nav .nav-link:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

.navbar-nav .nav-link:hover, .navbar-nav .nav-link.active {
    color: var(--text-main) !important;
    background: var(--primary-light);
}

.navbar-nav .nav-link i {
    font-size: 0.82rem;
    line-height: 1;
}

.dropdown-menu {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-base);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.25);
    padding: 0.5rem;
    z-index: 1080;
    min-width: 240px;
}

.dropdown-menu.show,
.navbar-nav .nav-item.dropdown:hover > .dropdown-menu {
    display: block;
    opacity: 1;
    visibility: visible;
    animation: dropdownFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Hover Support on Desktop for seamless browsing */
@media (min-width: 992px) {
    .navbar-nav .dropdown-menu {
        position: absolute;
        top: calc(100% + 4px);
        left: 0;
        margin-top: 0;
    }
    /* Invisible hover bridge prevents losing hover while moving cursor down */
    .navbar-nav .dropdown-menu::before {
        content: '';
        position: absolute;
        top: -10px;
        left: 0;
        right: 0;
        height: 10px;
        background: transparent;
    }
}

.dropdown-item {
    color: var(--text-main);
    border-radius: 6px;
    padding: 0.55rem 0.85rem;
    font-size: 0.88rem;
    transition: background-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

/* Theme Toggle Button */
.theme-toggle-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-subtle);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
    box-sizing: border-box;
}

.theme-toggle-btn:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    transform: rotate(20deg);
}

/* User Account & Action Buttons in Header - Exact 38px Uniform Height */
.btn-sign-in {
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0 1.15rem;
    font-size: 0.86rem;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-sizing: border-box;
    text-decoration: none !important;
}

.btn-sign-in:hover {
    background: var(--bg-subtle);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-get-started {
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #ffffff !important;
    border: none;
    border-radius: 8px;
    padding: 0 1.25rem;
    font-size: 0.86rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
    transition: all 0.2s ease;
    white-space: nowrap;
    box-sizing: border-box;
    text-decoration: none !important;
}

.btn-get-started:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
    color: #ffffff !important;
}

.btn-user-profile {
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    gap: 8px;
    padding: 0 0.95rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    color: var(--text-main);
    font-size: 0.86rem;
    font-weight: 600;
    box-sizing: border-box;
}

.btn-user-profile:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.user-avatar-pill {
    font-size: 1.15rem;
    color: var(--primary-color);
}

/* Mobile Toggler */
.navbar-toggler {
    color: var(--text-main);
    font-size: 1.25rem;
}

.navbar-toggler:focus {
    box-shadow: none;
}

/* Responsive Header */
@media (max-width: 991.98px) {
    .site-navbar {
        padding: 0.5rem 0;
    }
    .header-search-wrapper {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 12px 0 !important;
    }
    .search-autocomplete-dropdown {
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }
    .navbar-collapse {
        background: var(--bg-surface);
        border: 1px solid var(--border-color);
        border-radius: 16px;
        padding: 1.25rem;
        margin-top: 12px;
        box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
    }
    .navbar-nav {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 4px;
        margin-bottom: 0.5rem;
    }
    .navbar-nav .nav-link {
        padding: 0.6rem 0.85rem !important;
        font-size: 0.95rem;
        width: 100%;
        height: auto;
    }
    .header-actions-group {
        border-top: 1px solid var(--border-color);
        padding-top: 1rem;
        margin-left: 0 !important;
        flex-wrap: wrap;
        width: 100%;
        justify-content: flex-start;
    }
}

/* ==========================================================================
   HOMEPAGE & SECTIONS - MODERN SLEEK TECH STYLING
   ========================================================================== */
.hero-section {
    position: relative;
    padding: 95px 0 75px;
    background: radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 45%),
                radial-gradient(circle at 20% 80%, rgba(139, 92, 246, 0.12) 0%, transparent 45%);
    overflow: hidden;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #60a5fa;
    margin-bottom: 1.25rem;
}

.hero-title {
    font-size: 3.4rem;
    font-weight: 800;
    line-height: 1.14;
    margin-bottom: 1.25rem;
    letter-spacing: -0.03em;
}

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

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 620px;
    line-height: 1.6;
    margin-bottom: 2rem;
}

/* Section Backgrounds */
.bg-subtle-section {
    background: var(--bg-surface);
}

.bg-surface {
    background: var(--bg-surface) !important;
}

/* Primary & Action Buttons */
.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #ffffff !important;
    border: none;
    border-radius: var(--border-radius-base);
    padding: 0.7rem 1.6rem;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.5);
    color: #ffffff !important;
}

.btn-outline-custom {
    background: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-base);
    padding: 0.7rem 1.5rem;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-outline-custom:hover {
    background: var(--bg-subtle);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

/* Feature & Learning Domain Cards */
.feature-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-base);
    padding: 1.75rem;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.feature-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--card-shadow-hover);
    border-color: rgba(59, 130, 246, 0.5);
}

.feature-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
    transition: transform 0.3s ease;
}

.feature-card:hover .feature-card-icon {
    transform: scale(1.1) rotate(5deg);
}

/* Stats Counter Section */
.stats-counter-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-base);
    padding: 1.75rem;
    text-align: center;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stats-counter-box:hover {
    transform: translateY(-4px);
    border-color: rgba(59, 130, 246, 0.4);
}

.stats-counter-box .counter-number {
    font-size: 2.35rem;
    font-weight: 800;
    color: #60a5fa;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.stats-counter-box .counter-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    margin: 0;
}

/* Interactive Code Runner Teaser */
.code-runner-preview {
    background: #070a10;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
}

.code-runner-header {
    background: #0f1524;
    padding: 11px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mac-dots {
    display: flex;
    gap: 6px;
}

.mac-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
}
.mac-dot.red { background: #ff5f56; }
.mac-dot.yellow { background: #ffbd2e; }
.mac-dot.green { background: #27c93f; }

/* Tutorial Cards */
.tutorial-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-base);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tutorial-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow-hover);
    border-color: rgba(59, 130, 246, 0.5);
}

.tutorial-card-img-wrapper {
    height: 170px;
    overflow: hidden;
    position: relative;
}

.tutorial-card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.tutorial-card:hover .tutorial-card-img-wrapper img {
    transform: scale(1.06);
}

.tutorial-card-body {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.badge-difficulty {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-difficulty.Beginner { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-difficulty.Intermediate { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-difficulty.Advanced { background: rgba(249, 115, 22, 0.15); color: #fb923c; }

/* General Cards & Interactive Utilities */
.card {
    background-color: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-main);
}

.form-control, .form-select {
    background-color: var(--bg-subtle);
    border-color: var(--border-color);
    color: var(--text-main);
}

.form-control:focus, .form-select:focus {
    background-color: var(--bg-surface);
    border-color: var(--primary-color);
    color: var(--text-main);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.transition-hover {
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.transition-hover:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--primary-color);
}

/* Footer */
.site-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 70px 0 25px;
    margin-top: 80px;
}

.footer-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--text-main);
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.65rem;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.92rem;
    transition: color 0.2s ease, padding-left 0.2s ease;
    display: inline-block;
}

.footer-links a:hover {
    color: var(--primary-color);
    padding-left: 4px;
}

.social-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-subtle);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.social-icon-btn:hover {
    background: var(--primary-color);
    color: #ffffff;
    transform: translateY(-2px);
}

/* Footer Admin Login Button - Small Round Button in Bottom Right Corner */
.footer-admin-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none !important;
    line-height: 1;
    margin-left: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.footer-admin-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff !important;
    transform: translateY(-2px) scale(1.08);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.footer-admin-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Floating Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    background: var(--primary-color);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary-hover);
    transform: translateY(-3px);
    color: #ffffff;
}

/* ==========================================================================
   COMPREHENSIVE DARK MODE TEXT CONTRAST & ACCESSIBILITY READABILITY
   ========================================================================== */
[data-theme="dark"] {
    color-scheme: dark;
}

[data-theme="dark"] body {
    color: #cbd5e1;
}

[data-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}

[data-theme="dark"] .text-secondary {
    color: #cbd5e1 !important;
}

[data-theme="dark"] h1, 
[data-theme="dark"] h2, 
[data-theme="dark"] h3, 
[data-theme="dark"] h4, 
[data-theme="dark"] h5, 
[data-theme="dark"] h6 {
    color: #f8fafc !important;
}

[data-theme="dark"] strong, 
[data-theme="dark"] b {
    color: #ffffff !important;
}

[data-theme="dark"] .card,
[data-theme="dark"] .bg-surface {
    background-color: var(--bg-surface) !important;
    color: #cbd5e1 !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .bg-subtle,
[data-theme="dark"] .bg-subtle-section {
    background-color: var(--bg-subtle) !important;
}

/* Form Controls in Dark Mode */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: var(--bg-subtle) !important;
    color: #f8fafc !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: var(--bg-surface-elevated) !important;
    color: #ffffff !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
}

[data-theme="dark"] .form-control::placeholder {
    color: #64748b !important;
}

[data-theme="dark"] .form-label {
    color: #e2e8f0 !important;
}

/* Badges and Subtles in Dark Mode */
[data-theme="dark"] .badge.bg-light,
[data-theme="dark"] .bg-light {
    background-color: #1a2234 !important;
    color: #e2e8f0 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .bg-secondary-subtle {
    background-color: rgba(148, 163, 184, 0.15) !important;
    color: #cbd5e1 !important;
}

[data-theme="dark"] .bg-primary-subtle {
    background-color: rgba(59, 130, 246, 0.18) !important;
    color: #93c5fd !important;
}

[data-theme="dark"] .bg-warning-subtle {
    background-color: rgba(245, 158, 11, 0.18) !important;
    color: #fde047 !important;
}

[data-theme="dark"] .bg-info-subtle {
    background-color: rgba(6, 182, 212, 0.18) !important;
    color: #67e8f9 !important;
}

[data-theme="dark"] .bg-success-subtle {
    background-color: rgba(16, 185, 129, 0.18) !important;
    color: #6ee7b7 !important;
}

[data-theme="dark"] .bg-danger-subtle {
    background-color: rgba(239, 68, 68, 0.18) !important;
    color: #fca5a5 !important;
}

/* Dropdowns in Dark Mode */
[data-theme="dark"] .dropdown-menu {
    background-color: #0d1424 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7) !important;
}

[data-theme="dark"] .dropdown-item {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: rgba(59, 130, 246, 0.15) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Breadcrumbs in Dark Mode */
[data-theme="dark"] .breadcrumb-item a {
    color: #94a3b8 !important;
}

[data-theme="dark"] .breadcrumb-item a:hover {
    color: #60a5fa !important;
}

[data-theme="dark"] .breadcrumb-item.active {
    color: #f8fafc !important;
}

[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before {
    color: #64748b !important;
}

/* Tables in Dark Mode */
[data-theme="dark"] .table {
    color: #cbd5e1 !important;
    --bs-table-color: #cbd5e1;
    --bs-table-bg: transparent;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .table th {
    color: #f8fafc !important;
    background-color: #0d1424 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .table td {
    color: #cbd5e1 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* MathJax & KaTeX in Dark Mode */
[data-theme="dark"] .katex {
    color: #f1f5f9 !important;
}

/* Outline Buttons in Dark Mode */
[data-theme="dark"] .btn-outline-secondary {
    color: #cbd5e1 !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    background: transparent !important;
}

[data-theme="dark"] .btn-outline-secondary:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

[data-theme="dark"] .border-light {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* ==========================================================================
   DARK MODE COMPREHENSIVE TEXT VISIBILITY & CONTRAST GUARDS
   ========================================================================== */
[data-theme="dark"] .bg-light,
[data-theme="dark"] div.bg-light,
[data-theme="dark"] section.bg-light,
[data-theme="dark"] .card.bg-light {
    background-color: var(--bg-surface-elevated) !important;
    color: var(--text-body) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .bg-white,
[data-theme="dark"] div.bg-white,
[data-theme="dark"] section.bg-white,
[data-theme="dark"] .card.bg-white {
    background-color: var(--bg-surface) !important;
    color: var(--text-body) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .badge.bg-light,
[data-theme="dark"] .badge.bg-white {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: var(--text-body) !important;
    border: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .text-dark {
    color: var(--text-main) !important;
}

[data-theme="dark"] .katex-formula.bg-light,
[data-theme="dark"] .katex-formula {
    background-color: var(--bg-surface-elevated) !important;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: var(--bg-subtle) !important;
    border-color: var(--border-color) !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: var(--bg-surface) !important;
    border-color: var(--primary-color) !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] .form-control::placeholder {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .input-group-text {
    background-color: var(--bg-surface-elevated) !important;
    border-color: var(--border-color) !important;
    color: var(--text-muted) !important;
}

[data-theme="dark"] .card {
    background-color: var(--bg-surface);
    color: var(--text-body);
    border-color: var(--border-color);
}

