/* ============================================================
   AX-ON — Topbar navigation (Chantier C2 / Lots L1 + L5)
   Reference : docs/adr/0006-ux-refonte-2-onglets-apres-vente.md §3.1
   ============================================================ */

/* ── Logo ─────────────────────────────────────────────────── */

.topbar-logo-btn {
    opacity: 0.92;
    border-radius: var(--radius-sm);
    transition: opacity 120ms, filter 120ms;
}

.topbar-logo-btn:hover,
.topbar-logo-btn:focus-visible {
    opacity: 1;
    filter: brightness(1.08);
    outline: none;
}

.topbar-logo-btn:focus-visible {
    outline: 2px solid var(--ax-gold-500);
    outline-offset: 3px;
}

/* ── Liens directs (Analyses, Portefeuille) ───────────────── */

/* Distinct du toggle dropdown : pas de chevron, underline actif en place du chevron */
.topbar-nav-link {
    display: inline-flex;
    align-items: center;
    height: 100%;
    padding: 0 16px;
    font-size: 13.5px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.78); /* opacité 78% sur navy — pas de token dédié */
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    /* Compense le border-bottom pour ne pas décaler le contenu verticalement */
    margin-bottom: -2px;
    cursor: pointer;
    white-space: nowrap;
    letter-spacing: 0.005em;
    transition: color 120ms, background 120ms, border-color 120ms;
}

.topbar-nav-link:hover {
    color: var(--ax-ivory-0);
    background: rgba(255, 255, 255, 0.04); /* surbrillance subtile sur navy — pas de token dédié */
}

.topbar-nav-link:focus-visible {
    outline: 2px solid var(--ax-gold-500);
    outline-offset: -2px;
    color: var(--ax-ivory-0);
}

/* État actif posé par _setSidebarActive → classe nav-active */
.topbar-nav-link.nav-active {
    color: var(--ax-ivory-0);
    font-weight: 600;
    border-bottom-color: var(--ax-gold-500);
    background: transparent;
}

/* ── Bouton action principal (Démarrer une analyse) ───────── */

#topbar-action-demarrer {
    background: var(--ax-gold-500);
    color: var(--ax-navy-800);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 12.5px;
    font-weight: 600;
    /* Liseré subtil pour ancrer le bouton sur fond navy — rgba navy sans token dédié */
    box-shadow: 0 0 0 1px rgba(11, 37, 69, 0.12), 0 1px 3px rgba(11, 37, 69, 0.2);
    transition: background 120ms, box-shadow 120ms, transform 80ms;
}

#topbar-action-demarrer:hover {
    background: var(--ax-gold-300);
}

#topbar-action-demarrer:focus-visible {
    outline: 2px solid var(--ax-gold-300);
    outline-offset: 2px;
}

#topbar-action-demarrer:active {
    transform: translateY(1px);
}

/* ── Modale Démarrer une analyse ──────────────────────────── */

/* .hidden est fourni par Tailwind (display:none) — on confirme le masquage
   ici au cas où Tailwind ne charge pas dans cet environnement */
#modal-demarrer-analyse.hidden {
    display: none !important;
}

#modal-demarrer-analyse > div {
    /* Entrée douce — la modale monte légèrement à l'ouverture */
    animation: modal-in 160ms ease-out;
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(6px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)  scale(1);    }
}

#modal-demarrer-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--ax-ink-400);
    transition: color 120ms, background 120ms;
}

#modal-demarrer-close:hover {
    color: var(--ax-ink-700);
    background: var(--ax-paper-2);
}

/* Carte principale recueil */
#demarrer-choix-recueil {
    border: 1px solid var(--ax-ink-200);
    border-radius: var(--radius-md);
    background: var(--ax-paper-2);
    cursor: pointer;
    transition: border-color 120ms, background 120ms, box-shadow 120ms;
}

#demarrer-choix-recueil:hover {
    border-color: var(--ax-gold-500);
    background: var(--ax-paper-3);
    box-shadow: 0 0 0 1px var(--ax-gold-300);
}

#demarrer-choix-recueil:focus-visible {
    outline: none;
    border-color: var(--ax-gold-500);
    box-shadow: 0 0 0 2px var(--ax-gold-300);
}

/* Séparateur "Ou lancer directement" */
.demarrer-modules-separator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ax-ink-400);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.demarrer-modules-separator::before,
.demarrer-modules-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--ax-ink-100);
}

/* Grille des 5 modules */
.demarrer-modules-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.demarrer-module-btn {
    padding: 8px 10px;
    font-size: 12.5px;
    font-weight: 500;
    text-align: left;
    color: var(--ax-ink-700);
    background: var(--ax-paper-2);
    border: 1px solid var(--ax-ink-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 120ms, background 120ms, color 120ms, box-shadow 120ms;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.demarrer-module-btn:hover {
    border-color: var(--ax-gold-500);
    background: var(--ax-paper-3);
    color: var(--ax-navy-800);
    box-shadow: 0 0 0 1px var(--ax-gold-300);
}

.demarrer-module-btn:focus-visible {
    outline: none;
    border-color: var(--ax-gold-500);
    box-shadow: 0 0 0 2px var(--ax-gold-300);
    color: var(--ax-navy-800);
}

.topbar-family {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.topbar-family-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 100%;
    padding: 0 16px;
    font-size: 13.5px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.78); /* opacité 78% sur navy — pas de token dédié */
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    white-space: nowrap;
    letter-spacing: 0.005em;
    transition: color 120ms, background 120ms, border-color 120ms;
}

.topbar-family-toggle:hover {
    color: var(--ax-ivory-0);
    background: rgba(255, 255, 255, 0.04); /* surbrillance subtile sur navy — pas de token dédié */
}

.topbar-family-toggle:focus-visible {
    outline: 2px solid var(--ax-gold-500);
    outline-offset: -2px;
    color: var(--ax-ivory-0);
}

.topbar-family-toggle[aria-expanded="true"] {
    color: var(--ax-ivory-0);
    background: rgba(255, 255, 255, 0.06); /* surbrillance ouverte sur navy — pas de token dédié */
}

.topbar-family-toggle[data-active="true"] {
    color: var(--ax-ivory-0);
    font-weight: 600;
    border-bottom-color: var(--ax-gold-500);
}

.topbar-family-toggle .topbar-family-chevron {
    width: 12px;
    height: 12px;
    color: rgba(255, 255, 255, 0.5); /* opacité 50% sur navy — pas de token dédié */
    transition: transform 160ms ease, color 120ms;
}

.topbar-family-toggle[aria-expanded="true"] .topbar-family-chevron {
    transform: rotate(180deg);
    color: var(--ax-gold-500);
}

.topbar-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 2px;
    min-width: 240px;
    background: var(--ax-ivory-0);
    border: 1px solid var(--ax-ink-200);
    border-radius: var(--radius-md);
    box-shadow: 0 18px 40px -12px rgba(11, 37, 69, 0.28), 0 2px 6px rgba(11, 37, 69, 0.08); /* ombres navy sans token dédié */
    z-index: 9999;
    padding: 4px 0;
    overflow: hidden;
}

.topbar-dropdown[hidden] {
    display: none;
}

.topbar-dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    font-size: 13.5px;
    font-weight: 500;
    text-align: left;
    color: var(--ax-ink-700);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 120ms, color 120ms;
}

.topbar-dropdown-item:hover,
.topbar-dropdown-item:focus-visible {
    background: var(--ax-paper-2);
    color: var(--ax-navy-800);
    outline: none;
}

.topbar-dropdown-item:focus-visible {
    box-shadow: inset 3px 0 0 var(--ax-gold-500);
}

.topbar-dropdown-item svg {
    width: 16px;
    height: 16px;
    color: var(--ax-navy-700);
    flex-shrink: 0;
}

.topbar-dropdown-item:hover svg,
.topbar-dropdown-item:focus-visible svg {
    color: var(--ax-gold-600);
}

.topbar-dropdown-section {
    padding: 8px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ax-ink-500);
}

.topbar-dropdown-separator {
    height: 1px;
    margin: 4px 0;
    background: var(--ax-ink-100);
    border: none;
}
