﻿/* ============================================================
   MENUBAR.CSS  —  Social Service
   Breakpoints:
     ≥ 900px   → desktop  (full horizontal nav)
     600–899px → tablet   (sidebar = 50vw)
     < 600px   → mobile   (sidebar = 100vw)
   ============================================================ */

/* ── Reset / tokens ────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --nav-height: 60px;
    --accent: #5c50c7;
    --accent-dark: #4338a8;
    --accent-light: #ede9fe;
    --text: #1e293b;
    --text-muted: #64748b;
    --surface: #ffffff;
    --border: rgba(0,0,0,0.08);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.10);
    --radius: 10px;
    --ease: 0.22s cubic-bezier(0.4,0,0.2,1);
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    padding-top: var(--nav-height);
}

ol, ul, dl {
    margin-bottom: 0 !important;
}

/* ============================================================
   MAIN NAV WRAPPER
   ============================================================ */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    z-index: 900;
    padding: 0 16px;
}

/* ============================================================
   LOGO
   ============================================================ */
.logo-link {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.5px;
    white-space: nowrap;
    transition: transform var(--ease);
}

    .logo-link span {
        background: linear-gradient(90deg, var(--accent), #ff7f50);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        font-style: italic;
    }

    .logo-link:hover {
        transform: scale(1.03);
    }

/* Mobile brand bar — hidden on desktop */
.nav-brand {
    display: none;
    align-items: center;
}

/* ============================================================
   DESKTOP NAV
   ============================================================ */
.desktop-nav {
    display: flex;
    list-style: none;
    align-items: center;
    flex: 1;
    gap: 2px;
}

    .desktop-nav > li {
        position: relative;
    }

        .desktop-nav > li.logo {
            margin-right: auto;
        }

        /* Top-level links */
        .desktop-nav > li > a {
            display: flex;
            align-items: center;
            gap: 6px;
            height: var(--nav-height);
            padding: 0 16px;
            font-size: 0.92rem;
            font-weight: 500;
            color: var(--text);
            text-decoration: none;
            white-space: nowrap;
            transition: color var(--ease), background var(--ease);
            position: relative;
        }

            /* Underline indicator */
            .desktop-nav > li > a::after {
                content: '';
                position: absolute;
                bottom: 0;
                left: 16px;
                right: 16px;
                height: 2px;
                background: var(--accent);
                transform: scaleX(0);
                transform-origin: center;
                transition: transform var(--ease);
                border-radius: 2px;
            }

        .desktop-nav > li:hover > a,
        .desktop-nav > li:focus-within > a {
            color: var(--accent);
            background: var(--accent-light);
        }

            .desktop-nav > li:hover > a::after,
            .desktop-nav > li:focus-within > a::after {
                transform: scaleX(1);
            }

        /* Logo item — no underline / no hover bg */
        .desktop-nav > li.logo > a::after {
            display: none;
        }

        .desktop-nav > li.logo > a:hover {
            background: transparent;
            color: var(--text);
        }

/* Chevron on dropdowns */
.chevron {
    font-size: 1.1rem;
    line-height: 1;
    display: inline-block;
    transition: transform var(--ease);
}

.desktop-nav > li:hover .chevron,
.desktop-nav > li:focus-within .chevron {
    transform: rotate(180deg);
}

/* ============================================================
   DROPDOWN PANEL  (first-level mega menu)
   ============================================================ */
.dropdown-panel {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 260px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-md);
    display: flex;
    gap: 0;
    padding: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity var(--ease), transform var(--ease), visibility var(--ease);
    z-index: 1000;
}

.has-dropdown:hover .dropdown-panel,
.has-dropdown:focus-within .dropdown-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-col {
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

    .dropdown-col + .dropdown-col {
        border-left: 1px solid var(--border);
        margin-left: 8px;
        padding-left: 8px;
    }

/* Shared heading style used in all panel types */
.dropdown-heading {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 4px 10px 6px;
    margin-bottom: 2px;
}

/* Links inside any panel (dropdown / nested) */
.dropdown-panel a,
.nested-panel a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    font-size: 0.88rem;
    color: var(--text);
    text-decoration: none;
    border-radius: 6px;
    transition: background var(--ease), color var(--ease);
}

    .dropdown-panel a:hover,
    .nested-panel a:hover {
        background: var(--accent-light);
        color: var(--accent);
    }

    .dropdown-panel a i,
    .nested-panel a i {
        font-size: 0.9rem;
        width: 16px;
        text-align: center;
        color: var(--accent);
        flex-shrink: 0;
    }

/* ============================================================
   NESTED PANEL  (flyout inside a dropdown)
   ============================================================ */
.has-nested {
    position: relative;
}

.nested-trigger {
    justify-content: space-between !important;
}

.nested-arrow {
    margin-left: auto;
    font-size: 0.75rem !important;
    transition: transform var(--ease);
}

.has-nested:hover .nested-arrow,
.has-nested:focus-within .nested-arrow {
    transform: rotate(90deg);
}

.nested-panel {
    position: absolute;
    left: calc(100% + 4px);
    top: 0;
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid #ff7f50;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(6px);
    transition: opacity var(--ease), transform var(--ease), visibility var(--ease);
    z-index: 1001;
}

.has-nested:hover .nested-panel,
.has-nested:focus-within .nested-panel {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.nested-panel .dropdown-heading {
    color: #ff7f50;
}

/* Fly-left variant — used for Settings panel */
.nested-panel.fly-left {
    left: auto;
    right: calc(100% + 4px);
    transform: translateX(-6px);
}

.has-nested:hover .nested-panel.fly-left,
.has-nested:focus-within .nested-panel.fly-left {
    transform: translateX(0);
}

/* ============================================================
   HAMBURGER BUTTON
   ============================================================ */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 40px;
    height: 40px;
    padding: 9px 8px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    margin-left: auto;
    transition: background var(--ease), border-color var(--ease);
}

    .hamburger span {
        display: block;
        height: 2px;
        background: #1e293b;
        border-radius: 2px;
        transition: transform var(--ease), opacity var(--ease), background var(--ease);
    }

    .hamburger:hover {
        background: var(--accent-light);
        border-color: var(--accent);
    }

        .hamburger:hover span {
            background: var(--accent);
        }

    .hamburger[aria-expanded="true"] span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .hamburger[aria-expanded="true"] span:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
    }

    .hamburger[aria-expanded="true"] span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

/* ============================================================
   OVERLAY BACKDROP
   ============================================================ */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,15,35,0.45);
    backdrop-filter: blur(2px);
    z-index: 990;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--ease), visibility var(--ease);
}

    .sidebar-backdrop.show {
        opacity: 1;
        visibility: visible;
    }

/* ============================================================
   MOBILE SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    background: #ffffff;
    border-left: 1px solid rgba(0,0,0,0.08);
    box-shadow: -8px 0 40px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

    .sidebar.open {
        transform: translateX(0);
    }

/* Header */
.sidebar-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: var(--nav-height);
    background: #ffffff;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    flex-shrink: 0;
}

.sidebar-logo {
    font-size: 1.3rem;
}

.sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 8px;
    cursor: pointer;
    color: #1e293b;
    transition: background var(--ease), color var(--ease);
}

    .sidebar-close:hover {
        background: #fee2e2;
        color: #dc2626;
        border-color: #fca5a5;
    }

/* Nav list */
.sidebar-nav {
    list-style: none;
    flex: 1;
    padding: 12px 0;
    background: #ffffff;
}

    /* Top-level sidebar links */
    .sidebar-nav > li > a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 20px;
        font-size: 0.95rem;
        font-weight: 500;
        color: #1e293b !important;
        text-decoration: none;
        background: none;
        transition: background var(--ease), color var(--ease);
    }

        .sidebar-nav > li > a:hover {
            background: var(--accent-light);
            color: var(--accent) !important;
        }

/* Top-level mobile triggers */
.mobile-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #1e293b !important;
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    justify-content: space-between;
    transition: background var(--ease), color var(--ease);
}

    .mobile-trigger:hover {
        background: var(--accent-light);
        color: var(--accent) !important;
    }

/* Chevron icon inside mobile trigger */
.sub-icon {
    font-size: 0.75rem;
    transition: transform var(--ease);
    margin-left: auto;
    flex-shrink: 0;
    color: #64748b !important;
}

.mobile-has-sub.open > .mobile-trigger .sub-icon {
    transform: rotate(180deg);
}

/* ============================================================
   COLLAPSIBLE SUBMENU — hardcoded colors to prevent bleed
   from dark-theme pages (e.g. Dashboard)
   ============================================================ */
.mobile-sub {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    background: #f0eeff;
    transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1);
}

.mobile-has-sub.open > .mobile-sub {
    max-height: 1200px;
}

/* All links AND triggers inside a sub — hardcoded dark text */
.mobile-sub li a,
.mobile-sub li .mobile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px 10px 36px;
    font-size: 0.88rem;
    font-weight: 400;
    color: #1e293b !important;
    text-decoration: none;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background var(--ease), color var(--ease);
}

    .mobile-sub li a:hover,
    .mobile-sub li .mobile-trigger:hover {
        background: var(--accent-light);
        color: var(--accent) !important;
    }

    /* Icons inside sub items */
    .mobile-sub li a i,
    .mobile-sub li .mobile-trigger i {
        font-size: 0.85rem;
        width: 16px;
        color: var(--accent) !important;
        flex-shrink: 0;
    }

    /* Override sub-icon chevron color specifically */
    .mobile-sub li .mobile-trigger .sub-icon {
        color: #64748b !important;
    }

/* Sub-headings */
.mobile-sub-heading {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #64748b !important;
    padding: 10px 20px 4px 36px;
}

/* Nested sub (deeper level) — slightly darker bg */
.mobile-sub-nested {
    background: #e4e0f8;
}

    .mobile-sub-nested li a,
    .mobile-sub-nested li .mobile-trigger {
        padding-left: 52px;
        color: #1e293b !important;
    }

/* Nested trigger indentation */
.mobile-has-sub .mobile-has-sub > .mobile-trigger {
    padding-left: 36px;
    font-size: 0.88rem;
    font-weight: 400;
    color: #1e293b !important;
}

/* ============================================================
   SIDEBAR FOOTER
   ============================================================ */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(0,0,0,0.08);
    flex-shrink: 0;
    background: #ffffff;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.sidebar-avatar {
    font-size: 2rem;
    color: var(--accent);
    line-height: 1;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
}

.sidebar-username {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b !important;
}

.sidebar-user-label {
    font-size: 0.75rem;
    color: #64748b !important;
}

.sidebar-user-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-action-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    font-size: 0.88rem;
    color: #1e293b !important;
    text-decoration: none;
    border-radius: 8px;
    transition: background var(--ease), color var(--ease);
}

    .sidebar-action-link:hover {
        background: var(--accent-light);
        color: var(--accent) !important;
    }

.sidebar-logoff {
    color: #dc2626 !important;
}

    .sidebar-logoff:hover {
        background: #fee2e2;
        color: #b91c1c !important;
    }

.sidebar-register-link {
    color: var(--accent) !important;
    font-weight: 600;
}

/* ============================================================
   LOGIN PARTIAL — desktop nav
   ============================================================ */
.dropdown-panel--right {
    left: auto;
    right: 0;
}

.welcome-name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}

.logoff-form {
    margin: 0;
}

.logoff-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    font-size: 0.88rem;
    color: #dc2626;
    text-decoration: none;
    border-radius: 6px;
    transition: background var(--ease);
}

    .logoff-link:hover {
        background: #fee2e2;
    }

    .logoff-link i {
        color: #dc2626;
    }

.btn-login {
    display: flex;
    align-items: center;
    height: var(--nav-height);
    padding: 0 16px;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    transition: color var(--ease), background var(--ease);
}

    .btn-login:hover {
        background: var(--accent-light);
        color: var(--accent-dark);
    }

.btn-register {
    display: flex;
    align-items: center;
    margin: auto 12px auto 4px;
    padding: 8px 18px;
    font-size: 0.88rem;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    height: 36px;
    transition: background var(--ease), transform var(--ease);
}

    .btn-register:hover {
        background: var(--accent-dark);
        transform: translateY(-1px);
    }

.dropdown-panel .register-link {
    color: var(--accent);
    font-weight: 600;
}

    .dropdown-panel .register-link:hover {
        background: var(--accent);
        color: #fff;
    }

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* DESKTOP ≥ 900px */
@media (min-width: 900px) {
    .desktop-nav {
        display: flex;
    }

    .hamburger {
        display: none;
    }

    .nav-brand {
        display: none;
    }

    .sidebar {
        display: none;
    }

    .sidebar-backdrop {
        display: none;
    }
}

/* TABLET 600–899px */
@media (min-width: 600px) and (max-width: 899px) {
    .desktop-nav {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .nav-brand {
        display: flex;
        flex: 1;
    }

    .sidebar {
        width: 50vw;
        min-width: 280px;
    }
}

/* MOBILE < 600px */
@media (max-width: 599px) {
    .desktop-nav {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .nav-brand {
        display: flex;
        flex: 1;
    }

    .sidebar {
        width: 100vw;
    }

    body {
        padding-top: var(--nav-height);
    }
}
