/* nav-dropdown.css — Profile & Admin dropdown menus for SecurityForMe */

/* ── Dropdown container ─────────────────────────────────── */
.nav-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* ── Toggle button ──────────────────────────────────────── */
.nav-dd-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    color: inherit;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    padding: 6px 12px;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.nav-dd-toggle:hover,
.nav-dropdown.open .nav-dd-toggle {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.3);
}
.nav-dd-toggle-admin {
    border-color: rgba(212,175,55,0.4);
    color: #D4AF37;
}
.nav-dd-toggle-admin:hover,
.nav-dropdown.open .nav-dd-toggle-admin {
    background: rgba(212,175,55,0.1);
    border-color: #D4AF37;
}

/* ── Avatar circle ──────────────────────────────────────── */
.nav-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #D4AF37;
    color: #0f1117;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Caret ──────────────────────────────────────────────── */
.nav-dd-caret {
    font-size: 0.65rem;
    opacity: 0.7;
    transition: transform 0.2s;
}
.nav-dropdown.open .nav-dd-caret {
    transform: rotate(180deg);
}

/* ── Dropdown menu panel ────────────────────────────────── */
.nav-dd-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    min-width: 220px;
    background: #1a2236;
    border: 1px solid #2d3748;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    z-index: 9999;
    overflow: hidden;
    animation: dd-appear 0.15s ease;
}
/* LTR: align to left edge of trigger */
[dir="ltr"] .nav-dd-menu  { left: 0; }
/* RTL: align to right edge of trigger */
[dir="rtl"] .nav-dd-menu  { right: 0; }

/* Admin menu is wider */
.nav-dd-menu-admin { min-width: 240px; }

/* Show when open */
.nav-dropdown.open .nav-dd-menu { display: block; }

@keyframes dd-appear {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── User info header ───────────────────────────────────── */
.nav-dd-header {
    padding: 14px 16px 10px;
}
.nav-dd-user-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: #f1f5f9;
}
.nav-dd-user-email {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* ── Group label ────────────────────────────────────────── */
.nav-dd-group-label {
    padding: 8px 16px 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
}

/* ── Divider ────────────────────────────────────────────── */
.nav-dd-divider {
    height: 1px;
    background: #2d3748;
    margin: 4px 0;
}

/* ── Menu items ─────────────────────────────────────────── */
.nav-dd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    font-size: 0.875rem;
    color: #cbd5e1;
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
    cursor: pointer;
}
.nav-dd-item:hover {
    background: #243044;
    color: #f1f5f9;
    text-decoration: none;
}
.nav-dd-item .nav-dd-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}
.nav-dd-danger {
    color: #fca5a5;
}
.nav-dd-danger:hover {
    background: #2d1515;
    color: #ef4444;
}

/* ── Plan badge ─────────────────────────────────────────── */
.nav-dd-plan-badge {
    display: inline-block;
    margin-top: 5px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.plan-free     { background: #1e293b; color: #64748b; }
.plan-basic    { background: #1c2d4a; color: #60a5fa; }
.plan-business { background: #1c1a0d; color: #D4AF37; }

/* ── External link arrow ────────────────────────────────── */
.nav-dd-active {
    background: #1a2a40;
    color: #D4AF37 !important;
    font-weight: 700;
}
.nav-dd-item .nav-dd-ext {
    margin-inline-start: auto;
    font-size: 0.75rem;
    opacity: 0.45;
}
.nav-dd-item:hover .nav-dd-ext { opacity: 0.8; }


/* Nav collapses at 760px in style.css — match it exactly, otherwise
   761–768px lands in a dead zone where the dropdowns think they're mobile
   but the nav is still a horizontal desktop bar. */
@media (max-width: 760px) {
    .nav-dropdown {
        display: block;
        width: 100%;
    }
    .nav-dd-toggle {
        width: 100%;
        justify-content: space-between;
        border-radius: 6px;
        padding: 10px 14px;
        margin-bottom: 4px;
    }
    .nav-dd-menu {
        position: static;
        display: none;
        box-shadow: none;
        border: none;
        border-radius: 8px;
        background: rgba(255,255,255,0.04);
        margin-bottom: 8px;
        animation: none;
    }
    .nav-dropdown.open .nav-dd-menu {
        display: block;
    }
    .nav-dd-item {
        padding: 10px 14px;
        border-radius: 6px;
    }
    [dir="ltr"] .nav-dd-menu,
    [dir="rtl"] .nav-dd-menu {
        left: auto;
        right: auto;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   Language switcher in the header bar (mobile)
   -------------------------------------------------------------------
   #nav-lang-dd is a sibling of .main-nav, so when the nav collapses
   behind the ☰ toggle the language control stays visible. These rules
   stop it inheriting the full-width "stacked menu item" treatment that
   the dropdowns inside .main-nav get on mobile.
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 760px) {
    .header-inner > #nav-lang-dd {
        display: inline-flex;
        width: auto;
        margin-inline-start: .5rem;   /* sits just after the ☰ toggle */
        flex: 0 0 auto;
    }
    .header-inner > #nav-lang-dd .nav-dd-toggle {
        width: auto;
        justify-content: center;
        padding: 7px 10px;
        margin-bottom: 0;
        font-size: .85rem;
    }
    /* Drop the menu over the page rather than expanding the header bar */
    .header-inner > #nav-lang-dd .nav-dd-menu {
        position: absolute;
        inset-block-start: calc(100% + 6px);
        inset-inline-end: 0;
        inset-inline-start: auto;
        min-width: 150px;
        background: #0B2D5A;
        border: 1px solid rgba(255,255,255,.14);
        border-radius: 10px;
        box-shadow: 0 10px 28px rgba(0,0,0,.42);
        padding: 4px;
        z-index: 60;
    }
    .header-inner > #nav-lang-dd .nav-dd-item {
        padding: 11px 14px;           /* comfortable tap target */
        white-space: nowrap;
    }
}

/* Very small phones: drop the "EN" label, keep the 🌐 glyph only */
@media (max-width: 380px) {
    .header-inner > #nav-lang-dd .nav-dd-label { display: none; }
    .header-inner > #nav-lang-dd .nav-dd-toggle { padding: 7px 8px; }
}

/* ── Mobile menu overflow guard ──────────────────────────────────────
   .main-nav is position:absolute under a position:sticky header, so any
   content taller than the remaining viewport is unreachable — you cannot
   scroll to it. Cap the height and let it scroll internally. ── */
@media (max-width: 760px) {
    .main-nav {
        max-height: calc(100vh - 64px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}
