/*
 * g_retour : barre de navigation compacte facon Explorateur Windows 11,
 * en haut a gauche de chaque page :
 *   <-  ->  ^  actualiser  [ Accueil > Section > Page ]
 * Icones plates (sans bordure), infobulle « Retour a : page », fine barre
 * d'adresse : la barre occupe une seule ligne de 28 px.
 */

.g-retour-coin {
    margin: -.35rem 0 .45rem;
}

.g-retour-barre {
    --g-retour-accent: #4154f1;
    --g-retour-ink: #1f2937;
    --g-retour-muted: #6b7280;
    --g-retour-hover: rgba(15, 23, 42, .06);
    --g-retour-press: rgba(15, 23, 42, .1);
    --g-retour-line: #e3e6ef;
    --g-retour-field: rgba(255, 255, 255, .7);
    display: flex;
    align-items: center;
    gap: 2px;
    height: 28px;
    min-width: 0;
    font-size: .8rem;
}

/* Boutons : icones plates, survol discret (Windows 11). */
.g-retour-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--g-retour-ink);
    font-size: .95rem;
    line-height: 1;
    text-decoration: none;
    transition: background-color .12s ease;
}

.g-retour-barre .g-retour-btn,
.g-retour-barre .g-retour-btn:visited { color: var(--g-retour-ink); }

.g-retour-barre .g-retour-btn:hover { background: var(--g-retour-hover); color: var(--g-retour-ink); }
.g-retour-btn:active { background: var(--g-retour-press); }

.g-retour-btn:focus-visible {
    outline: 2px solid var(--g-retour-accent);
    outline-offset: 1px;
}

.g-retour-barre .g-retour-btn.disabled,
.g-retour-barre .g-retour-btn:disabled {
    background: transparent;
    color: var(--g-retour-muted);
    opacity: .4;
    cursor: default;
}

/* Le bouton Precedent n'affiche que sa fleche : la page de destination est
   dans l'infobulle (« Retour a : ... ») et dans le fil d'Ariane. */
.g-retour-btn--retour .g-retour-icone {
    display: inline-flex;
    font-size: .95rem;
}

.g-retour-btn--retour .g-retour-texte,
.g-retour-btn--retour .g-retour-sep,
.g-retour-btn--retour .g-retour-page {
    display: none !important;
}

/* Fil d'Ariane : fine barre d'adresse. */
.g-retour-chemin {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    min-width: 0;
    height: 26px;
    margin: 0 0 0 6px;
    padding: 0 6px;
    list-style: none;
    border: 1px solid var(--g-retour-line);
    border-radius: 6px;
    background: var(--g-retour-field);
    overflow: hidden;
}

.g-retour-chemin:empty { display: none; }

.g-retour-chemin-item {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    min-width: 0;
    max-width: 14rem;
    white-space: nowrap;
}

.g-retour-chemin-item + .g-retour-chemin-item::before {
    content: "\203A";
    flex: 0 0 auto;
    margin: 0 2px;
    color: var(--g-retour-muted);
    font-size: .9rem;
    line-height: 1;
}

.g-retour-chemin-item > a,
.g-retour-chemin-item > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    padding: 2px 5px;
    border-radius: 4px;
    color: var(--g-retour-ink);
    text-decoration: none;
}

.g-retour-barre .g-retour-chemin-item > a,
.g-retour-barre .g-retour-chemin-item > a:visited,
.g-retour-barre .g-retour-chemin-item.is-current > span { color: var(--g-retour-ink); }

.g-retour-barre .g-retour-chemin-item > a:hover { background: var(--g-retour-hover); color: var(--g-retour-ink); }
.g-retour-chemin-item.is-section > span { color: var(--g-retour-muted); }

.g-retour-chemin-item i { color: var(--g-retour-muted); font-size: .8rem; }

.g-retour-chemin-texte {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Si la place manque, seule la page courante se raccourcit. */
.g-retour-chemin-item.is-current {
    flex: 0 1 auto;
    max-width: none;
}

/* Ligne d'ou l'on vient, de nouveau selectionnee (comme dans l'Explorateur). */
tr.g-retour-selection > td,
tr.g-retour-selection > th {
    background-color: rgba(65, 84, 241, .1) !important;
}

tr.g-retour-selection > :first-child {
    box-shadow: inset 3px 0 0 #4154f1;
}

.g-retour-selection:not(tr) {
    background-color: rgba(65, 84, 241, .1) !important;
    outline: 1px solid rgba(65, 84, 241, .45);
    outline-offset: -1px;
}

/* Theme sombre */
:where(body.theme-dark, html[data-faccontrol-theme="dark"] body) .g-retour-barre {
    --g-retour-accent: #8b97ff;
    --g-retour-ink: #e5e7eb;
    --g-retour-muted: #9ca3af;
    --g-retour-hover: rgba(255, 255, 255, .08);
    --g-retour-press: rgba(255, 255, 255, .12);
    --g-retour-line: rgba(255, 255, 255, .12);
    --g-retour-field: rgba(255, 255, 255, .03);
}

/* Le theme sombre colore tous les liens en bleu (!important) : la barre
   garde des icones neutres, comme l'Explorateur. */
:where(body.theme-dark, html[data-faccontrol-theme="dark"] body) .g-retour-barre a.g-retour-btn,
:where(body.theme-dark, html[data-faccontrol-theme="dark"] body) .g-retour-barre .g-retour-chemin-item > a {
    color: var(--g-retour-ink) !important;
}

:where(body.theme-dark, html[data-faccontrol-theme="dark"] body) tr.g-retour-selection > td {
    background-color: rgba(139, 151, 255, .18) !important;
}

/* Caisse (POS) : le panneau de facture occupe la droite ; boutons seuls. */
body.pos-compact-sidebar .g-retour-chemin { display: none; }

/* Ecrans moyens : le fil d'Ariane garde l'accueil et la page courante. */
@media (max-width: 991.98px) {
    .g-retour-chemin-item:not(.is-current):not(:first-child) { display: none; }
}

/* Ecrans etroits : boutons seuls. */
@media (max-width: 575.98px) {
    .g-retour-chemin { display: none; }
}

@media print {
    .g-retour-coin { display: none !important; }
}
