/* ===========================================
   FIZICA LUI FEYNMAN — nav.css
   Sistem de navigație premium glassmorphic
   =========================================== */

/* ——— SITE NAVBAR ——— */
.site-nav {
    background: rgba(11, 19, 43, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

/* ——— SCROLL-DRIVEN READING PROGRESS BAR ——— 
   Activează indicatorul de citire cuantic doar pe modulele de curs */
body[data-module] .site-nav::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(to right, var(--cyan-quantum), var(--primary-medium), var(--primary-indigo));
    width: 100%;
    transform-origin: 0 50%;
    animation: grow-progress auto linear;
    animation-timeline: scroll();
    z-index: 1010;
}

@keyframes grow-progress {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.site-nav__inner {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.site-nav__brand {
    color: #fff;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 800;
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    transition: color 0.3s ease;
}
.site-nav__brand:hover {
    color: var(--cyan-quantum);
    text-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}

.site-nav__spacer { flex: 1; }

/* Meniu Links */
.site-nav__home,
.site-nav__playground,
.site-nav__despre-feynman,
.site-nav__despre-autor,
.site-nav__module-list {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}
.site-nav__home:hover,
.site-nav__playground:hover,
.site-nav__despre-feynman:hover,
.site-nav__despre-autor:hover,
.site-nav__module-list:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

/* Module Dropdown Wrap */
.site-nav__dropdown-wrap { position: relative; }

.site-nav__modules-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 0.4rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 600;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}
.site-nav__modules-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: var(--cyan-quantum);
}
.site-nav__modules-btn .nav-arrow {
    font-size: 0.7rem;
    transition: transform 0.25s ease;
    display: inline-block;
}
.site-nav__modules-btn.open .nav-arrow {
    transform: rotate(180deg);
    color: var(--cyan-quantum);
}

/* Dropdown Menu Container */
.site-nav__dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.08);
    min-width: 330px;
    max-height: 75vh;
    overflow-y: auto;
    padding: 0.6rem 0;
    z-index: 2000;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.site-nav__dropdown::-webkit-scrollbar { width: 4px; }
.site-nav__dropdown::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 2px; }

.site-nav__dropdown.open { display: block; }
.site-nav__dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 1.25rem;
    width: 11px;
    height: 11px;
    background: rgba(15, 23, 42, 0.95);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    transform: rotate(45deg);
}

.site-nav__dropdown a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.65rem 1.25rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s ease;
}
.site-nav__dropdown a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    padding-left: 1.45rem;
}
.site-nav__dropdown a.nav-active {
    background: rgba(6, 182, 212, 0.12);
    color: var(--cyan-quantum);
    font-weight: 700;
    border-left: 4px solid var(--cyan-quantum);
    padding-left: calc(1.25rem - 4px);
}
.site-nav__dropdown .drop-num {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    min-width: 18px;
    font-weight: 700;
}
.site-nav__dropdown .drop-icon { font-size: 1.1rem; }
.site-nav__dropdown .drop-title { flex: 1; line-height: 1.4; }
.site-nav__dropdown hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin: 0.4rem 0;
}

.drop-bloc-label {
    padding: 0.6rem 1.25rem 0.3rem;
    font-size: 0.7rem;
    font-weight: 800;
    font-family: var(--font-heading);
    color: var(--cyan-quantum);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.85;
    pointer-events: none;
    user-select: none;
}

/* Mobile Toggles */
.drop-mobile-link { display: none !important; }

.site-nav__hamburger {
    display: none;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}
.site-nav__hamburger:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: var(--cyan-quantum);
}

/* ——— MODULE TOPBAR (progres + breadcrumb) ——— */
.mod-topbar {
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
}
.mod-topbar__inner {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    flex: 1;
    min-width: 0;
}
.breadcrumb a {
    color: var(--primary-indigo);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb__sep { color: #94A3B8; }
.breadcrumb__current {
    color: var(--text-dark);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Progress dots bar */
.mod-progress {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.mod-progress__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #E2E8F0;
    border: 1px solid #CBD5E1;
    cursor: default;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
}
.mod-progress__dot.done {
    background: var(--primary-light);
    border-color: var(--primary-medium);
}
.mod-progress__dot.current {
    background: var(--gold-atomic);
    border-color: #D97706;
    transform: scale(1.4);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}
.mod-progress__label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-light);
    margin-left: 8px;
    white-space: nowrap;
}

/* ——— PREV / NEXT NAVIGATION ——— */
.module-nav {
    max-width: 1300px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem;
}
.module-nav--top {
    border-bottom: 1px solid #E2E8F0;
    background: #F8FAFC;
}
.module-nav--bottom {
    border-top: 1px solid #E2E8F0;
    background: #F8FAFC;
}

.module-nav__btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-dark);
    font-size: 0.88rem;
    font-weight: 700;
    font-family: var(--font-heading);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 280px;
    line-height: 1.35;
    box-shadow: var(--shadow-sm);
}
.module-nav__btn:hover {
    border-color: var(--primary-indigo);
    background: rgba(79, 70, 229, 0.05);
    color: var(--primary-indigo);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.08);
    transform: translateY(-2px);
}
.module-nav__btn .nav-arrow { font-size: 1.1rem; flex-shrink: 0; }
.module-nav__btn .btn-label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.module-nav__btn .btn-meta {
    font-size: 0.72rem;
    color: var(--text-light);
    font-weight: 500;
}
.module-nav__btn.next { margin-left: auto; }
.module-nav__placeholder { flex: 1; }

/* ——— LAYOUT: TOC + CONTENT ——— */
.with-toc-layout {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    align-items: flex-start;
    position: relative;
}

/* ——— TOC SIDEBAR ——— */
.toc-sidebar {
    width: 250px;
    flex-shrink: 0;
    position: sticky;
    top: 60px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    padding: 2.2rem 1rem 2.5rem 1.5rem;
    border-right: 1px solid #E2E8F0;
    font-size: 0.85rem;
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 transparent;
    align-self: flex-start;
}
.toc-sidebar::-webkit-scrollbar { width: 4px; }
.toc-sidebar::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 2px; }

.toc-sidebar__title {
    font-size: 0.72rem;
    font-weight: 800;
    font-family: var(--font-heading);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 1.1rem;
    padding-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.toc-sidebar__title::after {
    content: '';
    flex: 1;
    height: 2px;
    background: linear-gradient(to right, var(--gold-atomic), transparent);
    border-radius: 1px;
}

.toc-sidebar__list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.toc-sidebar__list li { margin: 0; }
.toc-sidebar__list a {
    display: block;
    padding: 0.4rem 0.75rem;
    color: var(--text-light);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.25s ease;
    line-height: 1.4;
    border-radius: 0 6px 6px 0;
    font-weight: 500;
}
.toc-sidebar__list a:hover {
    color: var(--primary-indigo);
    background: #F1F5F9;
}
.toc-sidebar__list a.toc-active {
    color: var(--primary-indigo);
    font-weight: 700;
    border-left-color: var(--gold-atomic);
    background: #FFFBEB;
    box-shadow: inset 2px 0 0 0 var(--gold-atomic);
}
.toc-sidebar__list .toc-h2 a {
    padding-left: 1.5rem;
    font-size: 0.8rem;
    opacity: 0.85;
}
.toc-sidebar__list .toc-h2 a.toc-active {
    background: #EFF6FF;
    color: var(--primary-medium);
    border-left-color: var(--primary-medium);
    box-shadow: inset 2px 0 0 0 var(--primary-medium);
}

.toc-close-btn { display: none; }

/* Mobile TOC toggle button */
.toc-toggle-btn {
    display: none;
    background: var(--space-dark);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: var(--font-heading);
    cursor: pointer;
    gap: 0.5rem;
    align-items: center;
    white-space: nowrap;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}
.toc-toggle-btn:hover {
    background: var(--primary-indigo);
    transform: translateY(-1px);
}

/* ——— MAIN CONTENT AREA ——— */
.module-main {
    flex: 1;
    min-width: 0;
    max-width: 960px;
    padding: 0 2.5rem 64px;
}

/* ——— BACK TO TOP ——— */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 46px;
    height: 46px;
    background: var(--gold-atomic);
    color: var(--space-dark);
    border: none;
    border-radius: 50%;
    font-size: 1.25rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(245, 158, 11, 0.3);
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 900;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.back-to-top:hover {
    background: #D97706;
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 12px 24px rgba(245, 158, 11, 0.4);
}

/* ——— RESPONSIVE MEDIA QUERIES ——— */
@media (max-width: 1100px) {
    .toc-sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        max-height: 100vh;
        z-index: 1500;
        background: #fff;
        box-shadow: 10px 0 40px rgba(15, 23, 42, 0.15);
        width: 290px;
        padding-top: 4.5rem;
        border-right: 1px solid #E2E8F0;
        transition: all 0.3s ease;
    }
    .toc-sidebar.mobile-open { display: block; }

    .toc-close-btn {
        position: absolute;
        top: 1.25rem;
        right: 1.25rem;
        background: rgba(15, 23, 42, 0.05);
        border: none;
        font-size: 1.25rem;
        font-weight: 700;
        cursor: pointer;
        color: var(--text-light);
        width: 32px;
        height: 32px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.2s;
    }
    .toc-close-btn:hover { background: rgba(15, 23, 42, 0.1); color: var(--text-dark); }
    .toc-sidebar.mobile-open .toc-close-btn { display: flex; }

    .with-toc-layout {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    .toc-toggle-btn {
        display: inline-flex;
        position: sticky;
        top: 70px; /* Se lipește la 10px sub navbar-ul sticky de 60px */
        order: -1;
        width: auto;
        margin: 1.25rem 1rem 0.25rem; /* Aliniat la fix cu marginea de 1rem a module-main */
        align-self: flex-start;
        z-index: 990; /* Se asigură că plutește deasupra conținutului text */
        background: rgba(11, 19, 43, 0.95);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border: 1px solid rgba(255, 255, 255, 0.15);
        color: #fff;
        border-radius: 30px; /* Formă elegantă de capsulă */
        box-shadow: 0 8px 24px rgba(11, 19, 43, 0.2);
        padding: 0.5rem 1.25rem;
        transition: all 0.25s ease;
    }
    .toc-toggle-btn:hover {
        background: var(--primary-indigo);
        transform: translateY(-2px);
        box-shadow: 0 12px 30px rgba(79, 70, 229, 0.3);
    }

    .module-main {
        flex: none; /* Deplasează conținutul pe propria sa linie pe mobil, evitând storcarea laterală */
        width: 100%;
        max-width: 100%;
        padding: 0 1.5rem 64px;
    }
}

@media (max-width: 768px) {
    .site-nav__home,
    .site-nav__module-list,
    .site-nav__despre-feynman,
    .site-nav__despre-autor,
    .site-nav__playground {
        display: none;
    }
    .site-nav__hamburger { display: flex; }

    .site-nav__modules-btn { display: none; }
    .site-nav__dropdown-wrap {
        position: static;
        width: 0;
        height: 0;
        overflow: visible;
    }

    /* Mobile full-screen navigation overlay */
    .site-nav__dropdown.open {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        min-width: 100vw;
        border-radius: 0 0 16px 16px;
        max-height: calc(100vh - 60px);
        box-shadow: 0 20px 40px rgba(0,0,0,0.3);
        border: none;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
    .site-nav__dropdown.open::before { display: none; }

    .mod-topbar__inner { flex-wrap: wrap; gap: 0.5rem; padding: 0.5rem 1rem; }
    .breadcrumb__current { max-width: 180px; }
    
    /* Mobil: Ascundem cele 22 de puncte rotunde și afișăm doar eticheta minimalistă 2 / 22 */
    .mod-progress__dot { display: none !important; }
    .mod-progress__label {
        display: inline-block !important;
        margin-left: 0;
        font-size: 0.8rem;
        font-weight: 700;
        color: var(--primary-indigo);
        background: rgba(79, 70, 229, 0.08);
        padding: 0.2rem 0.6rem;
        border-radius: 20px;
    }

    .module-nav { padding: 0.75rem 1rem; }
    .module-nav__btn .btn-meta { display: none; }
    .module-nav__btn { padding: 0.55rem 1rem; font-size: 0.85rem; max-width: 220px; }

    .module-main { padding: 0 1rem 64px; }

    .back-to-top { bottom: 1.25rem; right: 1.25rem; width: 40px; height: 40px; font-size: 1rem; }

    .drop-mobile-link { display: flex !important; }
}

@media (max-width: 480px) {
    .module-nav__btn { max-width: 48%; }
    .site-nav__inner { padding: 0 1rem; }
    .site-nav__brand { font-size: 1.1rem; }
}

/* ——— MOBILE OVERLAY ——— */
.toc-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1400;
}
.toc-overlay.visible { display: block; }
