/* ============================================================
   navbar.css — SINGLE SOURCE OF TRUTH for the platform navbar
   ------------------------------------------------------------
   One navbar, shared across: public pages, dashboard, and admin.
   Rendered by: includes/navbar.php

   ▶ To restyle the navbar everywhere, edit THIS file only.

   Color tokens come from assets/css/cabadz-ui.css when present
   (--ink, --line, --accent-*, …). Every var() below has a
   hard-coded fallback so the bar still looks right on any page,
   even one that hasn't loaded the design system.
   ============================================================ */

.cz-nav {
    background: var(--paper, #F2F2EF);
    /* translucent + blur on top of the page */
    background: color-mix(in srgb, var(--paper, #F2F2EF) 88%, transparent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line, #DCDFE8);
    position: sticky;
    top: 0;
    z-index: 900;
    font-family: var(--cz-sans, 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
}
.cz-nav-inner {
    max-width: 80rem;
    margin: 0 auto;
    padding: 0 1.25rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* ── Logo ─────────────────────────────────────────────────── */
.cz-nav-logo {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none; flex-shrink: 0;
}
.cz-nav-logo-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-btn, #1A1D2E);
    color: #fff; font-size: 15px;
    flex-shrink: 0;
}
.cz-nav-logo-text {
    font-size: 18px; font-weight: 700;
    color: var(--ink, #1A1D2E); line-height: 1;
}
.cz-nav-logo-dz { color: var(--accent-ink, #1A1D2E); }

/* ── Desktop link strip ───────────────────────────────────── */
.cz-nav-links {
    display: none; align-items: center; gap: 2px;
    flex: 1; justify-content: center;
}
@media (min-width: 768px) { .cz-nav-links { display: flex; } }

.cz-nav-link {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 10px; border-radius: 8px;
    color: var(--ink-2, #5A5F78); font-size: 13.5px; font-weight: 500;
    text-decoration: none; white-space: nowrap; position: relative;
    transition: color .15s, background .15s;
}
.cz-nav-link:hover { color: var(--ink, #1A1D2E); background: var(--paper-2, #E6E6E2); }
.cz-nav-link[aria-current="page"] { color: var(--accent-ink, #1A1D2E); font-weight: 600; }

/* Unread badge on nav links */
.cz-nav-badge {
    position: absolute; top: 1px; right: 1px;
    min-width: 16px; height: 16px;
    background: #E03131; color: #fff;
    font-size: 10px; font-weight: 700; line-height: 1;
    border-radius: 9999px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 3px;
}

/* ── Right cluster ────────────────────────────────────────── */
.cz-nav-right { display: flex; align-items: center; gap: 6px; }

/* CTA buttons (used for logged-out: Login / Register) */
.cz-nav-btn,
.cz-nav-btn-ghost {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 14px; border-radius: 9px;
    font-size: 13.5px; font-weight: 600;
    text-decoration: none; white-space: nowrap; cursor: pointer;
    border: 1px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
}
.cz-nav-btn {
    background: var(--accent-btn, #1A1D2E); color: #fff;
}
.cz-nav-btn:hover { filter: brightness(1.08); }
.cz-nav-btn-ghost {
    background: transparent; color: var(--ink, #1A1D2E);
    border-color: var(--line, #DCDFE8);
}
.cz-nav-btn-ghost:hover { background: var(--paper-2, #E6E6E2); }
/* ── Mobile (< 768 px): collapse CTA buttons ─────────────────
   On mobile the drawer handles all navigation including login
   and register, so both buttons can be minimised.
   - Ghost "Connexion" is hidden entirely
   - "S'inscrire" collapses to icon-only to keep the bar clean */
@media (max-width: 767px) {
    .cz-nav-btn-ghost { display: none; }

    .cz-nav-inner {
        padding: 0 0.75rem;
        gap: 0.5rem;
    }

    /* Icon-only register button */
    .cz-nav-btn {
        padding: 7px 9px;
        font-size: 0;
        min-width: 36px;
        justify-content: center;
    }
    .cz-nav-btn i { font-size: 14px; }
}

/* ── Extra-small (≤ 480 px): also shrink logo text ──────────── */
@media (max-width: 480px) {
    .cz-nav-logo-text { font-size: 15px; }
}

/* ── Tiniest phones (≤ 360 px) ───────────────────────────────
   Drop the register button and logo icon entirely — drawer
   handles all navigation. */
@media (max-width: 360px) {
    .cz-nav-logo-icon { display: none; }
    .cz-nav-btn       { display: none; }
}

/* ── Avatar ───────────────────────────────────────────────── */
.cz-nav-avatar {
    width: 34px; height: 34px; border-radius: 50%; overflow: hidden;
    background: var(--accent-btn, #1A1D2E); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; flex-shrink: 0;
    outline: 2px solid var(--accent-btn, #1A1D2E); outline-offset: 2px;
}
.cz-nav-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Desktop avatar dropdown ──────────────────────────────── */
.cz-nav-dd-wrap { position: relative; display: none; }
@media (min-width: 768px) { .cz-nav-dd-wrap { display: block; } }

.cz-nav-dd-btn {
    display: flex; align-items: center; gap: 7px;
    background: none; border: none; cursor: pointer; padding: 4px;
    border-radius: 9999px;
}
.cz-nav-dd-username {
    font-size: 13px; font-weight: 500; color: var(--ink, #1A1D2E);
    display: none; max-width: 120px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (min-width: 1024px) { .cz-nav-dd-username { display: block; } }

.cz-nav-dd-panel {
    position: absolute; inset-inline-end: 0; top: calc(100% + 8px);
    width: 210px; background: var(--surface, #FAFAFA);
    border: 1px solid var(--line, #DCDFE8); border-radius: 12px;
    box-shadow: var(--shadow-md, 0 6px 22px rgba(26,29,46,0.08)); padding: 6px; z-index: 1000;
    opacity: 0; pointer-events: none; transform: translateY(-6px);
    transition: opacity .15s, transform .15s;
}
.cz-nav-dd-wrap:hover .cz-nav-dd-panel,
.cz-nav-dd-wrap:focus-within .cz-nav-dd-panel {
    opacity: 1; pointer-events: auto; transform: translateY(0);
}
.cz-nav-dd-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 8px;
    color: var(--ink-2, #5A5F78); font-size: 13.5px;
    text-decoration: none; transition: background .12s;
}
.cz-nav-dd-link:hover { background: var(--paper-2, #E6E6E2); color: var(--ink, #1A1D2E); }
.cz-nav-dd-link.danger { color: #C92A2A; }
.cz-nav-dd-link.danger:hover { background: #FFF0F0; }
.cz-nav-dd-sep { height: 1px; background: var(--line, #DCDFE8); margin: 4px 0; }

/* ── Hamburger (mobile only) ──────────────────────────────── */
.cz-nav-hamburger {
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 8px;
    background: none; border: none; cursor: pointer;
    color: var(--ink-2, #5A5F78); transition: background .15s;
}
.cz-nav-hamburger:hover { background: var(--paper-2, #E6E6E2); color: var(--ink, #1A1D2E); }
@media (min-width: 768px) { .cz-nav-hamburger { display: none; } }

/* ── Mobile drawer ────────────────────────────────────────── */
.cz-drawer-overlay {
    display: none; position: fixed; inset: 0; z-index: 1998;
    background: rgba(0,0,0,.3); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.cz-drawer-overlay.open { display: block; }
.cz-drawer {
    position: fixed; top: 0; inset-inline-end: -100%; width: min(300px, 85vw);
    height: 100dvh; z-index: 1999; background: var(--surface, #FAFAFA);
    border-inline-start: 1px solid var(--line, #DCDFE8);
    box-shadow: var(--shadow-md, 0 6px 22px rgba(26,29,46,0.08));
    padding: 20px; overflow-y: auto;
    transition: inset-inline-end .25s cubic-bezier(.4,0,.2,1);
    display: flex; flex-direction: column; gap: 6px;
    font-family: var(--cz-sans, 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
}
.cz-drawer.open { inset-inline-end: 0; }
.cz-drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px; padding-bottom: 14px;
    border-bottom: 1px solid var(--line, #DCDFE8);
}
.cz-drawer-close {
    width: 34px; height: 34px; border-radius: 8px;
    background: var(--paper-2, #E6E6E2); border: none; cursor: pointer;
    color: var(--ink-2, #5A5F78); display: flex; align-items: center; justify-content: center;
}
.cz-drawer-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 10px;
    color: var(--ink-2, #5A5F78); font-size: 14px; font-weight: 500;
    text-decoration: none; transition: background .12s;
}
.cz-drawer-link i { width: 18px; text-align: center; flex-shrink: 0; }
.cz-drawer-link:hover { background: var(--paper-2, #E6E6E2); color: var(--ink, #1A1D2E); }
.cz-drawer-link[aria-current="page"] { background: var(--accent-soft, #E6E6E2); color: var(--accent-ink, #1A1D2E); }
.cz-drawer-sep { height: 1px; background: var(--line, #DCDFE8); margin: 4px 0; }
.cz-drawer-link.danger { color: #C92A2A; }
.cz-drawer-link.danger:hover { background: #FFF0F0; }
.cz-drawer-section-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .06em; color: var(--ink-3, #8E93A8);
    padding: 6px 12px 2px;
}
.cz-drawer-badge {
    margin-inline-start: auto; background: #E03131; color: #fff;
    border-radius: 999px; padding: 1px 7px; font-size: 11px; font-weight: 700;
}
