/*
 * nav-sidebar-patch.css — Sam-Theme5 v2
 * Enhancements for courses dropdown + sidebar accordion + dark mode
 */

/* ═══════════════════════════════════════════════════
   1. HEADER — Courses dropdown (desktop)
═══════════════════════════════════════════════════ */

.has-courses-dropdown {
    position: relative;
}

.has-courses-dropdown .courses-dropdown {
    display: none !important;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 230px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
    z-index: 2000;
    padding: 8px;
    margin: 0;
    list-style: none;
    animation: dropdownFade .18s cubic-bezier(.16,1,.3,1);
}

.has-courses-dropdown.dropdown-open .courses-dropdown {
    display: block !important;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-8px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.has-courses-dropdown.dropdown-open .nav-arrow {
    transform: rotate(180deg);
}

.courses-dropdown li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: #334155;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: background .15s ease, color .15s ease;
}

.courses-dropdown li a::before {
    content: '▸';
    font-size: .75em;
    color: #16a34a;
    opacity: 0;
    transition: opacity .15s;
}

.courses-dropdown li a:hover {
    background: #f0fdf4;
    color: #15803d;
}

.courses-dropdown li a:hover::before { opacity: 1; }

.courses-dropdown li.current-cat a {
    background: #f0fdf4;
    color: #15803d;
    font-weight: 700;
}

/* ═══════════════════════════════════════════════════
   2. SIDEBAR — Module Accordion
═══════════════════════════════════════════════════ */

.sidebar-nav {
    padding: 8px 0 48px;
}

.sidebar-module {
    border-bottom: 1px solid #e2e8f0;
}

.module-toggle-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: none;
    cursor: pointer;
    padding: 11px 16px;
    color: #334155;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    text-align: left;
    transition: color .2s, background .2s;
    line-height: 1.4;
}

.module-toggle-btn:hover {
    color: #15803d;
    background: #f8fafc;
}

.toggle-arrow {
    display: inline-block;
    transition: transform .22s ease;
    font-size: .8em;
    color: #94a3b8;
    flex-shrink: 0;
    margin-left: 8px;
}

.module-topic-list {
    list-style: none;
    padding: 4px 0 8px;
    margin: 0;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.module-topic-list .sidebar-topic-item a {
    display: block;
    padding: 8px 16px 8px 28px;
    color: #64748b;
    font-size: 0.855rem;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all .15s ease;
    line-height: 1.45;
}

.module-topic-list .sidebar-topic-item a:hover {
    color: #15803d;
    background: #f0fdf4;
    border-left-color: #16a34a;
}

.module-topic-list .sidebar-topic-item.current-topic a {
    color: #15803d;
    font-weight: 700;
    background: #dcfce7;
    border-left-color: #16a34a;
}

/* ═══════════════════════════════════════════════════
   3. MOBILE overrides
═══════════════════════════════════════════════════ */

@media (max-width: 768px) {
    #primary-menu {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding-top: 60px;
    }

    #primary-menu > li { width: 100%; }

    #primary-menu > li > a {
        border-radius: 0;
        padding: 15px 22px;
        font-size: 1rem;
        width: 100%;
    }

    .courses-dropdown {
        position: static !important;
        box-shadow: none;
        border: none;
        border-radius: 0;
        background: #0f5f30;
        animation: none;
        padding: 0;
    }

    .courses-dropdown li a {
        color: rgba(255,255,255,.8);
        padding: 11px 22px 11px 36px;
        border-radius: 0;
    }

    .courses-dropdown li a:hover {
        background: rgba(255,255,255,.08);
        color: white;
    }

    .courses-dropdown li a::before { display: none; }

    .has-courses-dropdown .courses-dropdown   { display: none !important; }
    .has-courses-dropdown.dropdown-open .courses-dropdown { display: block !important; }
}

/* ═══════════════════════════════════════════════════
   4. DARK MODE
═══════════════════════════════════════════════════ */

[data-theme="dark"] .courses-dropdown {
    background: #111827;
    border-color: #1e2d45;
    box-shadow: 0 20px 40px rgba(0,0,0,.6);
}

[data-theme="dark"] .courses-dropdown li a { color: #cbd5e1; }
[data-theme="dark"] .courses-dropdown li a:hover { background: #0d2218; color: #4ade80; }
[data-theme="dark"] .courses-dropdown li.current-cat a { background: #0d2218; color: #4ade80; }

[data-theme="dark"] .sidebar-module { border-bottom-color: #1e2d45; }
[data-theme="dark"] .module-toggle-btn { color: #cbd5e1; }
[data-theme="dark"] .module-toggle-btn:hover { background: #1a2234; color: #4ade80; }
[data-theme="dark"] .module-topic-list { background: #1a2234; border-top-color: #1e2d45; }
[data-theme="dark"] .module-topic-list .sidebar-topic-item a { color: #64748b; }
[data-theme="dark"] .module-topic-list .sidebar-topic-item a:hover { color: #4ade80; background: #0d2218; border-left-color: #4ade80; }
[data-theme="dark"] .module-topic-list .sidebar-topic-item.current-topic a { color: #4ade80; background: #0a1a10; border-left-color: #4ade80; }

@media (max-width: 768px) {
    [data-theme="dark"] .courses-dropdown { background: #0a1f14; }
}