/* ============================================================
   Smart WP Menu v2 — menu.css
   VERTICAL sidebar nav, BuddyPress-style.

   Design philosophy:
   • Uses ONLY var(--token) values so it inherits ANY theme's
     CSS custom properties automatically.
   • Falls back to neutral safe values if no theme tokens exist.
   • Velvet theme tokens are used natively — no overrides needed.
   • Zero !important rules — specificity only.
   ============================================================ */

/* ── Fallback tokens (used when theme doesn't define these) ── */
.swm-sidebar-nav,
.swm-drawer,
.swm-fab {
    --swm-bg:         var(--bg-card,          #1a1a2e);
    --swm-bg-el:      var(--bg-elevated,       #22223b);
    --swm-border:     var(--border,            rgba(255,255,255,.10));
    --swm-border-l:   var(--border-light,      rgba(255,255,255,.16));
    --swm-accent:     var(--gold,              #c8922a);
    --swm-accent-lt:  var(--gold-light,        #e8b84a);
    --swm-accent-dim: var(--gold-dim,          #6b4a10);
    --swm-accent-bg:  rgba(200,146,42,.06);
    --swm-text:       var(--text-primary,      #f0ece4);
    --swm-text-2:     var(--text-secondary,    #9a9088);
    --swm-text-muted: var(--text-muted,        #504848);
    --swm-danger:     var(--crimson-light,     #e03050);
    --swm-danger-bg:  rgba(192,32,48,.06);
    --swm-radius:     var(--radius-md,         6px);
    --swm-radius-lg:  var(--radius-lg,         10px);
    --swm-font-d:     var(--font-display,      Georgia, serif);
    --swm-font-b:     var(--font-body,         system-ui, sans-serif);
    --swm-font-lbl:   var(--font-label,        'Courier New', monospace);
    --swm-shadow:     var(--shadow-card,       0 4px 28px rgba(0,0,0,.7));
    --swm-transition: var(--transition-fast,   0.15s ease);
    --swm-glow:       var(--neon-glow-sm,      0 0 6px rgba(200,146,42,.45));
}

/* ══════════════════════════════════════════════
   SIDEBAR NAV  (desktop — placed via shortcode
   or swm_render_menu() in theme template)
══════════════════════════════════════════════ */
.swm-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-family: var(--swm-font-b);
}

/* ── Identity block (matches .profile-avatar-block) ── */
.swm-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--swm-bg);
    border: 1px solid var(--swm-border);
    border-radius: var(--swm-radius-lg);
    padding: 16px;
    transition: border-color var(--swm-transition);
}
.swm-identity:hover {
    border-color: var(--swm-border-l);
}

.swm-avatar-ring {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--swm-accent-dim);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--swm-bg-el);
    transition: border-color var(--swm-transition);
}
.swm-identity:hover .swm-avatar-ring {
    border-color: var(--swm-accent);
    box-shadow: var(--swm-glow);
}

.swm-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.swm-avatar-initial {
    font-family: var(--swm-font-d);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--swm-accent);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.swm-identity-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}
.swm-display-name {
    font-family: var(--swm-font-d);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--swm-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.swm-member-label {
    font-family: var(--swm-font-lbl);
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--swm-accent);
}

/* ── Nav list (matches .profile-nav-links) ── */
.swm-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background: var(--swm-bg);
    border: 1px solid var(--swm-border);
    border-radius: var(--swm-radius-lg);
    overflow: hidden;
}

.swm-nav-item-wrap:not(:last-child) {
    border-bottom: 1px solid var(--swm-border);
}

/* ── Nav link (matches .profile-nav-link) ── */
.swm-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 18px;
    color: var(--swm-text-2);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--swm-transition), background var(--swm-transition);
    position: relative;
}

/* Active indicator bar (left edge) */
.swm-nav-item--active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: var(--swm-accent);
    border-radius: 0 2px 2px 0;
    box-shadow: var(--swm-glow);
}

/* Hover */
.swm-nav-item:hover {
    color: var(--swm-accent-lt);
    background: var(--swm-accent-bg);
}
.swm-nav-item:hover .swm-nav-icon svg {
    stroke: var(--swm-accent-lt);
}

/* Active */
.swm-nav-item--active {
    color: var(--swm-accent);
    background: var(--swm-accent-bg);
}
.swm-nav-item--active .swm-nav-icon svg {
    stroke: var(--swm-accent);
}

/* Danger (sign out) */
.swm-nav-item--danger:hover {
    color: var(--swm-danger);
    background: var(--swm-danger-bg);
}
.swm-nav-item--danger:hover .swm-nav-icon svg {
    stroke: var(--swm-danger);
}

/* Icon */
.swm-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}
.swm-nav-icon svg {
    width: 15px;
    height: 15px;
    stroke: var(--swm-text-muted);
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    transition: stroke var(--swm-transition);
}

/* Label */
.swm-nav-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Badge (unread count) */
.swm-nav-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--swm-accent);
    color: #0a0810;
    font-family: var(--swm-font-lbl);
    font-size: 0.62rem;
    font-weight: 700;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

/* Tag (e.g. "Admin" label) */
.swm-nav-tag {
    font-family: var(--swm-font-lbl);
    font-size: 0.58rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--swm-text-muted);
    background: var(--swm-bg-el);
    padding: 2px 6px;
    border-radius: 10px;
    flex-shrink: 0;
}

/* ── Guest CTA block ── */
.swm-guest-cta {
    background: var(--swm-bg);
    border: 1px solid var(--swm-border);
    border-radius: var(--swm-radius-lg);
    padding: 16px;
    text-align: center;
}
.swm-guest-cta p {
    font-size: 0.8rem;
    color: var(--swm-text-muted);
    margin: 0 0 10px;
}
.swm-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 20px;
    background: var(--swm-accent);
    color: #0a0810;
    font-family: var(--swm-font-d);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    border-radius: var(--swm-radius);
    text-decoration: none;
    transition: box-shadow var(--swm-transition), transform var(--swm-transition);
}
.swm-cta-btn:hover {
    box-shadow: var(--swm-glow);
    transform: translateY(-1px);
    color: #0a0810;
}
.swm-cta-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
}

/* ══════════════════════════════════════════════
   MOBILE FAB (Floating Action Button)
   Rendered once by auto_insert on wp_body_open
══════════════════════════════════════════════ */
.swm-fab {
    display: none; /* shown only on mobile via media query */
    position: fixed;
    bottom: 24px;
    right: 20px;
    z-index: 8888;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid var(--swm-accent-dim);
    background: var(--swm-bg);
    color: var(--swm-text-2);
    cursor: pointer;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(0,0,0,.6);
    transition: border-color var(--swm-transition), box-shadow var(--swm-transition), transform var(--swm-transition);
    padding: 0;
}
.swm-fab:hover {
    border-color: var(--swm-accent);
    box-shadow: var(--swm-glow), 0 4px 24px rgba(0,0,0,.6);
    transform: scale(1.06);
}
.swm-fab svg {
    width: 20px;
    height: 20px;
    stroke: var(--swm-accent);
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.swm-fab-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}

/* ══════════════════════════════════════════════
   MOBILE DRAWER OVERLAY + PANEL
══════════════════════════════════════════════ */
.swm-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9990;
    background: rgba(0,0,0,.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.swm-drawer-overlay.swm-open {
    opacity: 1;
}

.swm-drawer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--swm-bg);
    border-top: 1px solid var(--swm-border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 40px rgba(0,0,0,.6);
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
    /* Pull handle */
    padding-top: 8px;
}
.swm-drawer::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--swm-border-l);
    border-radius: 2px;
    margin: 0 auto 12px;
}
.swm-drawer-overlay.swm-open .swm-drawer {
    transform: translateY(0);
}

.swm-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px 14px;
    border-bottom: 1px solid var(--swm-border);
}
.swm-drawer-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}
.swm-drawer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--swm-accent-dim);
    display: block;
}
.swm-drawer-identity strong {
    display: block;
    font-family: var(--swm-font-d);
    font-size: 0.92rem;
    color: var(--swm-text);
}
.swm-drawer-identity small {
    display: block;
    font-size: 0.72rem;
    color: var(--swm-text-muted);
    margin-top: 2px;
}
.swm-drawer-site {
    font-family: var(--swm-font-d);
    font-size: 1rem;
    font-weight: 600;
    color: var(--swm-accent);
    letter-spacing: 0.05em;
}
.swm-drawer-close {
    width: 32px;
    height: 32px;
    border-radius: var(--swm-radius);
    border: 1px solid var(--swm-border);
    background: var(--swm-bg-el);
    color: var(--swm-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color var(--swm-transition), border-color var(--swm-transition);
}
.swm-drawer-close:hover {
    color: var(--swm-accent);
    border-color: var(--swm-accent-dim);
}
.swm-drawer-close svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.swm-drawer-list {
    list-style: none;
    padding: 8px 12px 24px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
/* Inside drawer use same .swm-nav-item styles,
   but rounded instead of flush edge */
.swm-drawer-list .swm-nav-item {
    border-radius: var(--swm-radius);
    padding: 12px 14px;
}
.swm-drawer-list .swm-nav-item--active::before {
    top: 25%;
    bottom: 25%;
}

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Hide the inline sidebar nav on mobile (use FAB+drawer instead) */
    .swm-sidebar-nav {
        display: none;
    }

    /* Show FAB */
    .swm-fab {
        display: flex;
    }

    /* Show drawer when open */
    .swm-drawer-overlay {
        display: block;
    }
}

/* Admin bar offset for FAB */
.admin-bar .swm-fab {
    bottom: calc(24px + 32px);
}
@media screen and (max-width: 782px) {
    .admin-bar .swm-fab {
        bottom: calc(24px + 46px);
    }
}

/* Print: hide everything */
@media print {
    .swm-sidebar-nav,
    .swm-fab,
    .swm-drawer-overlay { display: none !important; }
}
