/* ==========================================================
   BUVETTE.BE
   Design System v1
   ========================================================== */
:root {
    /* Couleurs */
    --anthracite: #1A181B;
    --gold: #D2BF55;
    --terracotta: #BE6E46;
    --white: #FFFFFF;
    --light: #F7F7F5;
    --border: #ECEAE4;
    /* Typographie */
    --font:
        Inter,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    /* Dimensions */
    --radius-small: 6px;
    --radius: 12px;
    --radius-large: 20px;
    /* Ombres */
    --shadow-small: 0 2px 8px rgba(0,0,0,.05);
    --shadow: 0 8px 30px rgba(0,0,0,.08);
    /* Transitions */
    --transition: .25s ease;
    /* Espacements */
    --space-xs: .5rem;
    --space-sm: .75rem;
    --space: 1rem;
    --space-lg: 2rem;
    --space-xl: 4rem;
}
/* ==========================================================
   RESET
   ========================================================== */
*,
*::before,
*::after{
    box-sizing:border-box;
}
html{
    scroll-behavior:smooth;
}
body{
    margin:0;
    font-family:var(--font);
    font-size:16px;
    line-height:1.6;
    background:var(--light);
    color:var(--anthracite);
    -webkit-font-smoothing:antialiased;
    text-rendering:optimizeLegibility;
}
/* ==========================================================
   TYPOGRAPHIE
   ========================================================== */
h1,h2,h3,h4{
    margin:0 0 .5em;
    font-weight:800;
    line-height:1.15;
}
h1{
    font-size:3rem;
}
h2{
    font-size:2.2rem;
}
h3{
    font-size:1.5rem;
}
p{
    margin:0 0 1.25rem;
}
a{
    color:var(--terracotta);
    text-decoration:none;
    transition:var(--transition);
}
a:hover{
    color:var(--gold);
}
/* ==========================================================
   LAYOUT
   ========================================================== */
.container{
    width:min(1180px,92%);
    margin:auto;
}
.section{
    padding:5rem 0;
}
/* ==========================================================
   HEADER
   ========================================================== */
header{
    background:white;
    border-bottom:1px solid var(--border);
}
.nav{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:1.2rem 0;
}
.logo{
    display:flex;
    align-items:center;
    gap:.8rem;
}
.logo img{
    width:46px;
}
.logo span{
    font-size:1.7rem;
    font-weight:900;
    color:var(--anthracite);
}
.logo span small{
    color:var(--gold);
}
/* ==========================================================
   BOUTONS
   ========================================================== */
.btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:.5rem;
    padding:.85rem 1.5rem;
    border:none;
    border-radius:999px;
    cursor:pointer;
    font-weight:700;
    font-size:.95rem;
    transition:var(--transition);
}
.btn-primary{
    background:var(--terracotta);
    color:white;
}
.btn-primary:hover{
    background:var(--gold);
    color:var(--anthracite);
}
.btn-secondary{
    background:white;
    color:var(--anthracite);
    border:2px solid var(--border);
}
.btn-secondary:hover{
    border-color:var(--gold);
}
/* ==========================================================
   CARDS
   ========================================================== */
.card{
    background:white;
    border-radius:var(--radius-large);
    padding:2rem;
    box-shadow:var(--shadow);
    transition:var(--transition);
}
.card:hover{
    transform:translateY(-4px);
}
/* ==========================================================
   FORMULAIRES
   ========================================================== */
input,
select,
textarea{
    width:100%;
    padding:1rem;
    border:1px solid var(--border);
    border-radius:var(--radius);
    background:white;
    font:inherit;
    transition:var(--transition);
}
input:focus,
textarea:focus,
select:focus{
    outline:none;
    border-color:var(--gold);
    box-shadow:0 0 0 4px rgba(210,191,85,.18);
}
/* ==========================================================
   TABLES
   ========================================================== */
table{
    width:100%;
    border-collapse:collapse;
}
th{
    background:var(--anthracite);
    color:white;
}
th,
td{
    padding:1rem;
    border-bottom:1px solid var(--border);
}
/* ==========================================================
   BADGES
   ========================================================== */
.badge{
    display:inline-block;
    padding:.35rem .8rem;
    border-radius:999px;
    background:rgba(210,191,85,.15);
    color:var(--gold);
    font-size:.8rem;
    font-weight:700;
}
/* ==========================================================
   FOOTER
   ========================================================== */
footer{
    background:var(--anthracite);
    color:white;
    padding:4rem 0;
}
footer a{
    color:var(--gold);
}
/* ==========================================================
   UTILITAIRES
   ========================================================== */
.text-center{
    text-align:center;
}
.mt-1{
    margin-top:1rem;
}
.mt-2{
    margin-top:2rem;
}
.mt-3{
    margin-top:3rem;
}
.mb-1{
    margin-bottom:1rem;
}
.mb-2{
    margin-bottom:2rem;
}
.flex{
    display:flex;
}
.grid{
    display:grid;
    gap:2rem;
}
.grid-2{
    grid-template-columns:repeat(auto-fit,minmax(320px,1fr));
}
.grid-3{
    grid-template-columns:repeat(auto-fit,minmax(250px,1fr));
}
/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width:768px){
    h1{
        font-size:2.2rem;
    }
    h2{
        font-size:1.8rem;
    }
    .nav{
        flex-direction:column;
        gap:1rem;
    }
}

/* ==========================================================
   EXTENSIONS - APPLICATION BUVETTE.BE
   (composants specifiques a l'app, construits sur les tokens
   du Design System ci-dessus - n'alterent aucune regle de base)
   ========================================================== */

:root {
    /* alias de compatibilite avec d'anciens noms de variables */
    --dark: var(--anthracite);
    --cream: var(--light);
    --gray-light: var(--border);
    /* tokens complementaires non fournis par le design system de base */
    --muted: #6B6870;
    --ok: #4C7A52;
    --error: #B23A3A;
    --shadow-lg: 0 16px 40px rgba(26,24,27,.16);
}

* { box-sizing: border-box; }

html, body {
    -webkit-font-smoothing: antialiased;
}

/* Le pied de page reste toujours colle en bas, meme quand le contenu ne remplit pas
   l'ecran : body.app-shell (pages avec includes/header.php + footer.php uniquement -
   pas la page client l.php, qui a sa propre mise en page) devient une colonne flex sur
   toute la hauteur du viewport, et .page (le contenu principal) absorbe l'espace restant. */
body.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- Topbar / nav (application) ---------------- */

.topbar {
    background: var(--anthracite);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-small);
}

.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    flex-wrap: wrap;
    position: relative;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.brand:hover { text-decoration: none; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-manager { gap: 6px; align-items: flex-end; }
.brand-logo-admin { height: auto; display: block; }
.brand-name { font-size: 1.15rem; font-weight: 700; color: var(--white); letter-spacing: .2px; line-height: 2; }
.brand-dot { color: var(--gold); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.nav-links a {
    color: var(--white);
    opacity: .9;
    font-weight: 500;
}
.nav-links a:hover { opacity: 1; color: var(--gold); text-decoration: none; }

.nav-user { color: var(--border); font-size: .9rem; }

/* Bouton hamburger declenchant le tiroir de navigation mobile (voir plus bas
   ".nav-drawer" et assets/js/site.js) - masque sur PC/tablette, la nav horizontale
   ".nav-links" ci-dessus restant seule visible a ces largeurs. */
.nav-drawer-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 34px;
    height: 34px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.nav-drawer-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
}

@media (max-width: 720px) {
    .nav-links { display: none; }
    .nav-drawer-toggle { display: flex; }
}

/* Tiroir de navigation mobile : meme principe que les tiroirs lateraux de la page
   client (filtres/paiement dans l.php), ancre a droite, au-dessus de la topbar. */
.nav-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 90;
}
.nav-drawer {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    max-width: 82vw;
    background: var(--white);
    box-shadow: -6px 0 24px rgba(0,0,0,.3);
    z-index: 91;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .25s ease;
    margin: 0;
}
.nav-drawer.open { transform: translateX(0); }
.nav-drawer-body { flex: 1; }
.nav-drawer-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.nav-drawer-links a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border-radius: 8px;
    color: var(--anthracite);
    font-weight: 600;
}
.nav-drawer-links a:hover { background: var(--light); text-decoration: none; }
.nav-drawer-footer {
    flex-shrink: 0;
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.nav-drawer-admin-link {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--anthracite);
}
.nav-drawer-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--anthracite);
    font-weight: 500;
}
.nav-drawer-avatar { display: flex; color: var(--terracotta); }

/* ---------------- Layout application ---------------- */

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px 64px;
    flex: 1 0 auto;
    width: 100%;
}

.page-narrow { max-width: 640px; }

.footer { flex-shrink: 0; padding: 20px 16px; }

footer.footer p {
    text-align: center;
    margin: 0;
    opacity: .8;
    font-size: .85rem;
}

/* ---------------- Alerts ---------------- */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-size: .95rem;
}
.alert-ok { background: #E7F0E6; color: var(--ok); border: 1px solid #c5dcc3; }
.alert-error { background: #F5E3E0; color: var(--error); border: 1px solid #e6bdb6; }

/* ---------------- Boutons (variantes app) ---------------- */

.btn, button.btn, input[type="submit"].btn {
    background: var(--terracotta);
    color: var(--white);
    text-decoration: none;
}
.btn:hover { opacity: .9; text-decoration: none; }
.btn:active { transform: scale(0.98); }

.btn-gold { background: var(--gold); color: var(--anthracite); }
.btn-dark { background: var(--anthracite); color: var(--white); }
.btn-outline {
    background: transparent;
    border: 1.5px solid currentColor;
    color: inherit;
    padding: 9px 18px;
    font-weight: 600;
}
.btn-outline:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.btn-sm { padding: 6px 14px; font-size: .85rem; }

.link-button {
    background: none;
    border: none;
    padding: 0;
    color: var(--terracotta);
    cursor: pointer;
    font: inherit;
    text-decoration: underline;
}
.link-button:hover { color: var(--gold); }
.btn-danger { background: var(--error); color: var(--white); }
.btn-block { width: 100%; display: flex; }
.btn[disabled], .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* ---------------- Cartes (variantes app) ---------------- */

/* Demande utilisateur : les blocs ne doivent pas bouger au survol (annule l'effet
   de levitation defini sur .card dans la feuille de style de base). */
.card:hover { transform: none; }

/* Espacement vertical entre deux cartes empilees (ex: Configuration, Publication). */
.card + .card { margin-top: 20px; }

.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}
/* La regle ".card + .card" (cartes empilees verticalement, ex: Configuration/Publication)
   ne doit pas s'appliquer dans une grille : elle ajoute un margin-top aux 2e/3e cartes,
   les rendant plus "basses" que la 1ere dans une rangee etiree a hauteur egale (ex : les blocs
   Utilisateurs/Listes/Commandes de la page Administration, ou les 3 etapes "Comment ca marche"
   de la page d'accueil). Regle generique pour toute grille (".grid"/".grid-cards"). */
.grid > .card + .card,
.grid-cards > .card + .card { margin-top: 0; }

/* ---------------- Buvettes expirées (dashboard) ---------------- */

.expired-lists-collapse { border-top: 1px solid var(--border); padding-top: 18px; }
.expired-lists-collapse summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}
.expired-lists-collapse summary::-webkit-details-marker { display: none; }
.expired-lists-collapse summary::before {
    content: '+';
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--terracotta);
    transition: transform var(--transition);
    flex-shrink: 0;
}
.expired-lists-collapse[open] summary::before { transform: rotate(45deg); }
.expired-lists-collapse .list-card { opacity: .75; }

/* .list-card est un <a> natif (navigation garantie sans dependre du JS) : on reinitialise
   les styles de lien par defaut pour qu'il se comporte visuellement comme un bloc normal. */
.list-card {
    background: var(--white);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-small);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 4px solid var(--gold);
    transition: var(--transition);
    cursor: pointer;
    color: var(--anthracite);
    text-decoration: none;
}
.list-card:hover { color: var(--anthracite); text-decoration: none; }
.list-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.list-card.is-premium { border-top-color: var(--terracotta); }

.list-card-divider { border: none; border-top: 1px solid var(--border); margin: 0; }
.list-card-stats { display: flex; flex-direction: column; gap: 8px; }
.stat-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .92rem; }
.stat-value { display: inline-flex; align-items: center; }
.text-ok { color: var(--ok); }
.text-error { color: var(--error); }
.list-card-client-link { font-weight: 600; text-align: center; display: block; color: var(--terracotta); cursor: pointer; }
.list-card-client-link:hover { text-decoration: underline; }
.list-card-client-link.is-disabled { color: var(--muted); font-weight: 500; text-decoration: none; cursor: default; }

/* ---------------- Page de gestion (onglets) ---------------- */

.manage-header { margin-bottom: 20px; }
.manage-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    align-items: start;
}
.manage-sidebar {
    background: var(--white);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-small);
    padding: 10px;
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.manage-sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius);
    color: var(--anthracite);
    font-weight: 600;
    font-size: .95rem;
}
.manage-sidebar a svg { flex-shrink: 0; width: 18px; height: 18px; }
.manage-sidebar a:hover { background: var(--light); text-decoration: none; }
.manage-sidebar a.active { background: var(--anthracite); color: var(--white); }

.manage-content { min-width: 0; }

/* Liste deroulante remplaçant le menu de navigation ci-dessus, uniquement sur smartphone (voir
   media query plus bas) - masquee partout ailleurs (PC, tablette). */
.manage-tab-select {
    display: none;
    width: 100%;
    /* Marge a droite genereuse pour laisser la place a un caret plus gros et bien
       decolle du bord (voir background ci-dessous), plutot que la fleche native du
       navigateur, minuscule et collee au bord. */
    padding: 12px 46px 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 6l4.5 5 4.5-5' fill='none' stroke='%23BE6E46' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 16px center;
    background-size: 15px 15px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    font-family: inherit;
    font-weight: 600;
    font-size: .95rem;
    color: var(--anthracite);
    cursor: pointer;
}

@media (max-width: 860px) {
    .manage-layout { grid-template-columns: 1fr; }
    .manage-sidebar { position: static; flex-direction: row; overflow-x: auto; }
    .manage-sidebar a { white-space: nowrap; }
}

@media (max-width: 640px) {
    /* Sur smartphone, le menu (ligne d'onglets a defilement horizontal ci-dessus) est remplace
       par une liste deroulante, plus compacte et plus simple a utiliser au pouce. La version PC
       n'est pas concernee (regle ci-dessus, >860px, inchangee). */
    .manage-sidebar { display: none; }
    .manage-tab-select { display: block; }
}

/* ---------------- Modales (dialog natif) ---------------- */

dialog.modal {
    border: none;
    border-radius: var(--radius-large);
    padding: 0;
    width: min(560px, 92vw);
    box-shadow: var(--shadow-lg);
    color: var(--anthracite);
}
dialog.modal::backdrop { background: rgba(26,24,27,.55); }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; }
.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.modal-close:hover { background: var(--light); }
.modal-body { padding: 22px; max-height: 65vh; overflow-y: auto; }
.modal-footer {
    padding: 16px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ---------------- Composants du contenu (sections/articles) ---------------- */

.drag-handle {
    cursor: grab;
    color: var(--border);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.drag-handle:active { cursor: grabbing; }

.section-block.dragging, .article-row.dragging { opacity: .4; }
.section-block.drag-over-top { box-shadow: inset 0 3px 0 var(--gold); }
.article-row.drag-over-top { box-shadow: inset 0 3px 0 var(--gold); }
.article-row.drag-over-bottom { box-shadow: inset 0 -3px 0 var(--gold); }
.articles-dropzone.drag-target { background: rgba(210,191,85,.08); }

.component-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.component-row select { flex: 1.2; }
.component-row input[type="number"] { flex: 0 0 80px; }

.card-format-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.card-format-row input[type="text"] { flex: 1.4; }
.card-format-row input[type="number"] { flex: 1; }

.cash-method-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.cash-method-row .checkbox-row { flex: 1; }

/* ---------------- Jetons/tickets configurables (onglet Configuration) ---------------- */

.jeton-list { display: flex; flex-wrap: wrap; gap: 14px; }
.jeton-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 18px;
    cursor: pointer;
    transition: var(--transition);
    min-width: 84px;
    font-family: inherit;
}
.jeton-chip:hover { border-color: var(--gold); box-shadow: var(--shadow-small); }
.jeton-chip-price { font-weight: 700; font-size: .82rem; color: var(--anthracite); white-space: nowrap; }
.jeton-chip-add { color: var(--muted); border-style: dashed; justify-content: center; }
.jeton-chip-add:hover { color: var(--anthracite); border-color: var(--anthracite); }

.danger-zone { border: 1.5px solid #f0c9c3; background: #fdf4f2; border-radius: var(--radius); padding: 18px; }

/* ---------------- Selecteur de couleur (jetons/tickets) ---------------- */

.color-picker { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; transition: var(--transition); }
.color-picker.is-disabled { opacity: .55; }
.color-picker-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.color-picker-tab {
    flex: 1;
    background: var(--border);
    border: none;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}
.color-picker-tab.active { background: var(--anthracite); color: var(--white); }
.color-picker-tab:disabled { cursor: not-allowed; }
.color-swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, 26px); gap: 7px; }
.color-swatch {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: var(--transition);
}
.color-swatch:hover:not(:disabled) { transform: scale(1.08); box-shadow: var(--shadow-small); }
.color-swatch.selected { border-color: var(--anthracite); box-shadow: 0 0 0 2px var(--white) inset; }
.color-swatch:disabled { opacity: .25; cursor: not-allowed; }
.color-picker-custom-row { display: flex; align-items: center; gap: 10px; }
.color-picker-custom-row input[type="color"] { width: 46px; height: 38px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.color-picker-custom-row input[type="text"] { flex: 1; }
.color-picker-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: .85rem;
    color: var(--muted);
}
.color-picker-preview-swatch { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--border); flex-shrink: 0; }

/* ---------------- Toggle "switch" (ex: Publier la buvette) ---------------- */

.toggle-label { font-weight: 700; font-size: 1.02rem; }
.switch-row { display: flex; align-items: center; gap: 10px; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; cursor: pointer; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 999px;
    transition: var(--transition);
}
.switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: var(--white);
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: var(--shadow-small);
}
.switch input:checked + .switch-track { background: var(--ok); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(20px); }
.switch-state { font-weight: 700; min-width: 26px; display: inline-block; }

/* variantes de badges (le design system definit .badge en gold par defaut) */
.badge-gold { background: var(--gold); color: var(--anthracite); }
.badge-dark { background: var(--anthracite); color: var(--white); }
.badge-draft { background: var(--border); color: var(--muted); }
.badge-published { background: var(--ok); color: var(--white); }
.badge-danger { background: var(--error); color: var(--white); }

/* ---------------- Formulaires (app) ---------------- */

.form-group { margin-bottom: 18px; }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .92rem; }
.help-text { color: var(--muted); font-size: .82rem; margin-top: 4px; }

input, select, textarea { color: var(--anthracite); }

.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 160px; }

.checkbox-row { display: flex; align-items: center; gap: 10px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; font-weight: 500; }

/* ---------------- Enregistrement automatique (coche verte) ---------------- */

.field-wrap { position: relative; }
.field-wrap input, .field-wrap select { padding-right: 40px; }
.field-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--ok);
    color: var(--white);
    font-size: .75rem;
    line-height: 1;
    opacity: 0;
    transform: scale(.6);
    transition: opacity .25s ease, transform .25s ease;
    flex-shrink: 0;
    pointer-events: none;
}
.field-check.show { opacity: 1; transform: scale(1); }
.field-wrap .field-check {
    position: absolute;
    right: 10px;
    top: 50%;
    margin-top: -11px;
    transform: scale(.6);
}
.field-wrap .field-check.show { transform: scale(1); }
.field-wrap.field-wrap-textarea .field-check { top: 14px; margin-top: 0; }
/* Sur un <select>, la fleche native du navigateur occupe deja le bord droit :
   on decale la coche plus a gauche pour ne pas la recouvrir. */
.field-wrap.field-wrap-select select { padding-right: 64px; }
.field-wrap.field-wrap-select .field-check { right: 34px; }
.card-format-row .field-check { margin-left: -4px; }

/* Champ obligatoire vide (ex: nom de la buvette) - voir list-settings.js : le champ refuse le
   focus tant qu'il est vide, avec un liseré rouge et un message d'aide pour l'expliquer. */
.field-wrap.has-error input,
.field-wrap.has-error textarea { border-color: var(--error); }
.field-error-text { color: var(--error); font-size: .82rem; margin-top: 6px; }

fieldset { border: 1.5px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
legend { font-weight: 700; padding: 0 8px; }

th, td { text-align: left; vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }

.quota-bar {
    height: 8px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
    margin: 8px 0;
}
.quota-bar-fill { height: 100%; background: var(--gold); }
.quota-bar-fill.is-full { background: var(--error); }

/* ---------------- Auth pages ---------------- */

.auth-wrap {
    max-width: 420px;
    margin: 40px auto;
}

/* ---------------- Editeur de liste : sections/articles ---------------- */

.section-block {
    background: var(--white);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-small);
    margin-bottom: 18px;
    overflow: hidden;
}
.section-header {
    background: var(--anthracite);
    color: var(--white);
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.section-header h3 { color: var(--white); margin: 0; }
.article-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.article-row:last-child { border-bottom: none; }
.article-info { flex: 1; min-width: 180px; }
.article-name { font-weight: 700; }
.article-desc { color: var(--muted); font-size: .88rem; }
.article-price { font-weight: 700; color: var(--terracotta); white-space: nowrap; }
.article-actions { display: flex; gap: 8px; }
.article-row.is-sold-out { background: #FBF3F2; }
.article-row.is-sold-out .article-name { color: var(--muted); }
.article-row.is-sold-out .article-price { color: var(--muted); }

.article-row.is-hidden-article { background: repeating-linear-gradient(135deg, #F4F4F5, #F4F4F5 10px, #ECECEE 10px, #ECECEE 20px); opacity: .75; }
.article-row.is-hidden-article .article-name { color: var(--muted); }
.section-block.is-hidden-section { opacity: .6; }
.section-block.is-hidden-section .section-header { background: var(--muted); }

/* ---------------- Onglet Commandes : tickets de caisse empilés ---------------- */

.orders-stack { display: flex; flex-direction: column; gap: 16px; max-width: 460px; margin: 0 auto; }
.ticket-card {
    background: var(--white);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-small);
    padding: 20px 22px;
    transition: var(--transition);
}
.ticket-card-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.ticket-card-code { font-size: 1.3rem; font-weight: 800; letter-spacing: .06em; color: var(--terracotta); }
.ticket-card-time { color: var(--muted); font-size: .82rem; }
.ticket-card-items { margin: 12px 0; }
.ticket-card .ticket-line { font-size: .88rem; }
.ticket-line.is-sold-out-line .ticket-line-name { text-decoration: line-through; color: var(--muted); }
.ticket-line-warning {
    display: inline-block;
    color: var(--error);
    font-weight: 700;
    font-size: .78rem;
    margin-left: 6px;
    text-decoration: none;
}
.ticket-line-participant { color: var(--muted); font-size: .82rem; font-style: italic; }

/* ---------------- Commande partagee (participant) ---------------- */
.shared-order-intro {
    background: var(--light);
    color: var(--anthracite);
    padding: 12px 18px;
    font-size: .9rem;
    text-align: center;
}
.shared-name-gate {
    max-width: 420px;
    margin: 28px auto;
    padding: 22px;
}
.shared-name-gate input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}
#share-name-modal input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    margin-top: 4px;
}
.ticket-card-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.ticket-card-total { font-weight: 800; }

/* Etat "finalisee" : ticket visuellement reduit, contenu masque */
.ticket-card.is-finalized {
    padding: 10px 18px;
    max-width: 340px;
    margin: 0 auto;
    opacity: .75;
}
.ticket-card.is-finalized .ticket-card-items,
.ticket-card.is-finalized .ticket-card-footer form { display: none; }
.ticket-card.is-finalized .ticket-card-code { font-size: 1rem; }
.ticket-card.is-finalized .ticket-card-header { font-size: .85rem; }

.orders-empty { text-align: center; padding: 40px 20px; color: var(--muted); }

/* Archive simple (listing des commandes finalisees) */
.orders-table { width: 100%; border-collapse: collapse; }
.orders-table th, .orders-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: .92rem; }
.orders-table th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: .74rem; letter-spacing: .05em; }

/* Sur smartphone, le tableau ci-dessus deborde (4 colonnes trop serrees) : on le masque au
   profit d'une liste de cartes sur 2 lignes (voir ".orders-archive-list" ci-dessous), masquee
   de son cote sur PC/tablette ou le tableau reste la presentation la plus lisible. */
.orders-archive-list { display: none; flex-direction: column; gap: 10px; }
.order-archive-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    text-align: left;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    font-family: inherit;
    cursor: pointer;
}
.order-archive-row-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .92rem; }
.order-archive-row-date { color: var(--muted); font-size: .85rem; }
.order-archive-row-total { font-weight: 700; }

@media (max-width: 640px) {
    .orders-table-wrap { display: none; }
    .orders-archive-list { display: flex; }
}

/* ---------------- Menu imprimable (modele fixe) ----------------
   Mise en page unique, non personnalisable (voir includes/print-template.php et list-print.php) :
   fond blanc pour l'impression, accents aux couleurs de la charte, police "Baloo 2" (ronde,
   lisible, plus dynamique que l'Inter utilise pour le reste du site).
   Tout l'en-tete (logo, nom de la buvette, moyens de paiement, QR code) se repete sur CHAQUE
   page imprimee via <thead> - fiable dans Chrome/Edge, MAIS seulement si son contenu n'utilise
   pas flexbox (sinon la hauteur reservee pour cette ligne repetee est mal calculee, ce qui fait
   chevaucher/disparaitre le contenu sur les pages suivantes - probleme reel et documente,
   constate aussi avec un <tfoot> pour un pied de page separe). Tout l'en-tete est donc mis en
   page par flottants plutot que par flex. Consequence : les moyens de paiement + le QR code sont
   ici regroupes dans l'en-tete plutot que dans un pied de page, pour garantir leur presence sur
   chaque page imprimee. */

.menu-print-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    font-family: 'Baloo 2', 'Inter', sans-serif;
    color: var(--anthracite);
}
.menu-print-table thead { display: table-header-group; }
.menu-print-table > thead > tr > td {
    padding: 0;
    border: none;
}
.menu-print-table > tbody > tr > td {
    padding: 0 32px;
    border: none;
}
.menu-print-header {
    overflow: hidden;
    padding: 16px 32px 12px;
    border-bottom: 3px solid var(--gold);
}
.menu-print-header-logo { height: 38px; width: auto; float: left; }
.menu-print-header-name { float: right; font-weight: 700; font-size: 1.5rem; line-height: 38px; text-align: right; }

.menu-print-header-payment {
    overflow: hidden;
    padding: 14px 32px 16px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
}
.menu-print-header-qr { float: right; margin-left: 24px; }
.menu-print-header-qr svg { width: 160px; height: 160px; display: block; }
.menu-print-header-payment-list { overflow: hidden; padding-top: 10px; }
.menu-print-header-payment-mode {
    display: block;
    font-weight: 700;
    color: var(--terracotta);
    text-transform: uppercase;
    letter-spacing: .03em;
    font-size: .95rem;
    margin-bottom: 8px;
}
.menu-print-header-payment-item {
    display: inline-block;
    margin: 0 22px 6px 0;
    font-size: .92rem;
    font-family: 'Inter', sans-serif;
}

/* Deux blocs cote a cote (pas de "column-count") : voir le commentaire dans
   includes/print-template.php sur la fiabilite d'impression de ce choix. */
.menu-print-columns { display: flex; gap: 40px; align-items: flex-start; }
.menu-print-column { flex: 1 1 0; min-width: 0; }
.menu-print-section { break-inside: avoid; margin-bottom: 22px; }
.menu-print-section-title {
    color: var(--terracotta);
    border-bottom: 2px solid var(--border);
    padding-bottom: 6px;
    margin: 0 0 8px;
    font-size: 1.2rem;
    font-weight: 700;
}
.menu-print-article-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 5px 0; break-inside: avoid; }
.menu-print-article-name { font-weight: 600; flex-shrink: 1; }
.menu-print-article-desc { display: block; font-size: .8em; font-weight: 400; color: var(--muted); font-family: 'Inter', sans-serif; }
.menu-print-article-dots { flex: 1 1 auto; border-bottom: 2px dotted var(--border); margin: 0 4px 6px; }
.menu-print-article-price { flex-shrink: 0; font-weight: 700; white-space: nowrap; }

.print-actions { text-align: center; margin: 20px 0; }

@media print {
    body { background: var(--white) !important; }
    .topbar, footer, .no-print { display: none !important; }
    .page { padding: 0; max-width: none; }
}

/* ---------------- Interface client publique (mobile first) ---------------- */

.client-header {
    background: var(--anthracite);
    color: var(--white);
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    /* Toujours visible en haut de l'ecran, meme en faisant defiler le menu. */
    position: sticky;
    top: 0;
    z-index: 40;
}
.client-header-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    max-width: 640px;
    margin: 0 auto;
}
.client-header-logo-link { display: flex; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.client-logo { height: 24px; width: auto; display: block; }
.client-header-title {
    flex: 1;
    text-align: right;
    font-weight: 700;
    font-size: 1.05rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Bouton chevron : deplie/replie uniquement la description de la buvette (le detail du mode de
   paiement est desormais toujours affiche a cote du bouton filtres - voir ".client-toolbar-
   payment" plus bas). Sur fond sombre (bandeau), donc transparent avec icone blanche. */
.client-header-toggle {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: var(--transition);
}
.client-header-toggle[aria-expanded="true"] i { transform: rotate(180deg); }
.client-header-toggle i { transition: var(--transition); display: block; }

.client-header-details {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 16px 16px;
}
.client-header-desc { color: var(--border); font-size: .88rem; margin: 0; }

/* Barre de filtres simple et toujours visible, utilisee par commande-partagee.php (l.php a sa
   propre variante en tiroir, voir plus bas "#client-filter-bar-wrap.client-filter-bar"). */
.client-filter-bar { max-width: 640px; margin: 12px auto 0; }
.client-filter-list { display: flex; flex-wrap: wrap; gap: 8px; }
.section-filter-chip {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 13px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
}
.section-filter-chip.active { background: var(--anthracite); color: var(--white); border-color: var(--anthracite); }

.client-body { max-width: 640px; margin: 0 auto; padding: 14px 14px 120px; }

.client-section-title {
    color: var(--terracotta);
    text-transform: uppercase;
    font-size: .95rem;
    letter-spacing: .06em;
    font-weight: 700;
    margin: 26px 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--gold);
}

.client-article {
    background: var(--white);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-small);
    padding: 14px 16px;
    margin-bottom: 12px;
}
.client-article-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.client-article-name { font-weight: 700; font-size: 1.02rem; flex: 1; }
.client-article-desc { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.client-article-price { color: var(--terracotta); font-weight: 700; font-size: .92rem; white-space: nowrap; margin-top: 4px; }

/* Article epuise : reste visible (le client comprend qu'il existait) mais grise, avec un
   badge explicite ; le stepper est desactive via l'attribut HTML "disabled" (voir l.php),
   ce qui suffit a empecher toute selection sans JS supplementaire. */
.client-article.is-sold-out { opacity: .65; }
.client-article-sold-out-badge {
    display: inline-block;
    background: var(--error);
    color: var(--white);
    font-size: .72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 6px;
    vertical-align: middle;
}
.client-article.is-sold-out .stepper button { cursor: not-allowed; opacity: .5; }

.stepper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.stepper button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--border);
    color: var(--anthracite);
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.stepper button.plus { background: var(--terracotta); color: var(--white); }
.stepper .qty { min-width: 22px; text-align: center; font-weight: 700; font-size: 1rem; }

.client-note {
    margin-top: 10px;
    display: none;
    align-items: center;
    gap: 8px;
}
.client-note.visible { display: flex; }
.client-note input {
    flex: 1;
    padding: 8px 10px;
    border-radius: var(--radius-small);
    font-size: .88rem;
}
.note-save-btn {
    display: none;
    flex-shrink: 0;
    background: var(--terracotta);
    color: var(--white);
    border: none;
    border-radius: var(--radius-small);
    padding: 8px 12px;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}
.note-save-btn.visible { display: inline-block; }

.client-note-lines { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.client-note-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--cream, #F7F4EE);
    border-radius: var(--radius-small);
    padding: 5px 9px;
    font-size: .8rem;
    color: var(--muted);
}
.client-note-line-delete {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: .85rem;
    line-height: 1;
    padding: 2px 4px;
}
.client-note-line-delete:hover { color: var(--terracotta); }

/* Par defaut (mode "navigation"), le client parcourt le menu sans +/- ni notes visibles : le
   bouton flottant "Payer ma tournee" bascule vers le mode "selection" (voir plus bas). */
.stepper { display: none; }
body.ordering-mode .stepper { display: flex; }
.client-note-lines { display: none; }
body.ordering-mode .client-note-lines { display: flex; }
.client-note { display: none !important; }
body.ordering-mode .client-note.visible { display: flex !important; }

.fab-order-btn {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 45;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--terracotta);
    color: var(--white);
    border: none;
    border-radius: 999px;
    padding: 14px 20px;
    font-family: inherit;
    font-weight: 700;
    font-size: .95rem;
    box-shadow: 0 6px 18px rgba(0,0,0,.28);
    cursor: pointer;
}
body.ordering-mode .fab-order-btn { display: none; }

.cart-bar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--anthracite);
    color: var(--white);
    padding: 14px 18px;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    box-shadow: 0 -4px 18px rgba(0,0,0,.25);
    z-index: 40;
}
body.ordering-mode .cart-bar { display: flex; }
/* La page de participation a une commande partagee (commande-partagee.php) n'a pas de mode
   "navigation/selection" : sa propre barre panier (voir assets/js/shared-order.js) continue de
   s'afficher via cette classe, independamment du mode ci-dessus (propre a l.php). */
.cart-bar.visible { display: flex; }
.cart-bar-info { display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.cart-bar-count { font-size: .95rem; font-weight: 700; }
.cart-bar-detail { font-size: .85rem; color: var(--gold); }
.cart-bar-actions .btn:disabled { opacity: .45; cursor: not-allowed; }
.cart-bar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* Rangee sous le bandeau : bouton filtres a gauche (tiroir gauche), bouton moyens de paiement
   a droite (tiroir droit, voir plus bas ".payment-panel") - "margin-left: auto" sur ce dernier
   le pousse a droite que le bouton filtres soit present ou non. */
.client-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 10px;
    max-width: 640px;
    margin: 10px auto 0;
    padding: 0 14px;
}

/* Filtres de sections : ouvre un tiroir qui glisse de gauche a droite par-dessus le contenu
   (plutot qu'une simple ligne de puces toujours visible). */
.filters-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--anthracite);
    color: var(--white);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    position: relative;
    /* Volontairement sous le tiroir de filtres (z-index 61) : une fois ouvert, le tiroir le
       recouvre entierement plutot que de le laisser visible/cliquable par-dessus. */
    z-index: 10;
}
@media (max-width: 640px) {
    /* Sur smartphone, la page est pleine largeur (pas de marge de centrage) : le bouton reste
       accroche au bord gauche reel de l'ecran, en "onglet" rogne a gauche - comme avant l'ajout
       du detail de paiement juste a cote. Au-dela (ordinateur), on le laisse tel quel : un
       bouton rond normal dans la rangee, sans toucher le bord de la fenetre. */
    .filters-toggle-btn {
        margin-left: -14px;
        border-radius: 0 999px 999px 0;
    }
}
.client-filter-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    /* Au-dessus de tous les autres elements fixes de la page (bouton/barre de tournee, bouton
       historique...) : voir leurs z-index plus haut/bas, tous inferieurs a 60. */
    z-index: 60;
}
/* Tiroir de filtres propre a l.php (glisse de gauche a droite). La page de participation a
   une commande partagee (commande-partagee.php) garde sa propre barre de filtres simple,
   toujours visible - voir ".client-filter-bar" plus bas, non reutilisee ici expres. */
#client-filter-bar-wrap.client-filter-bar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 240px;
    max-width: 78vw;
    background: var(--white);
    box-shadow: 2px 0 8px rgba(0,0,0,.15);
    /* Au-dessus de tous les autres elements fixes de la page (bouton/barre de tournee "Payer ma
       tournee", barre panier, bouton et popup de l'historique...) quand il est ouvert. */
    z-index: 61;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform .25s ease;
    margin: 0;
}
#client-filter-bar-wrap.client-filter-bar.open { transform: translateX(0); }
#client-filter-bar-wrap .client-filter-list { flex-direction: column; }

/* Moyens de paiement : meme principe que le tiroir de filtres, mais ancre a droite. */
.payment-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--anthracite);
    color: var(--white);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    position: relative;
    margin-left: auto;
    z-index: 10;
}
@media (max-width: 640px) {
    /* Symetrique du bouton filtres : accroche au bord droit reel de l'ecran sur smartphone. */
    .payment-toggle-btn {
        margin-right: -14px;
        border-radius: 999px 0 0 999px;
    }
}
.payment-panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 60;
}
#payment-panel-wrap.payment-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    max-width: 82vw;
    background: var(--white);
    box-shadow: -6px 0 24px rgba(0,0,0,.3);
    z-index: 61;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .25s ease;
    margin: 0;
}
#payment-panel-wrap.payment-panel.open { transform: translateX(0); }

/* En-tete/fermeture communs aux deux tiroirs lateraux (filtres et moyens de paiement) - titre +
   croix de fermeture, dans le meme style pour les deux. */
.side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    color: var(--anthracite);
    flex-shrink: 0;
}
.side-panel-header span { display: flex; align-items: center; gap: 8px; }
.side-panel-close { background: none; border: none; cursor: pointer; padding: 4px; display: flex; flex-shrink: 0; }
.side-panel-body { padding: 16px; overflow-y: auto; }

.payment-panel-mode { font-weight: 700; color: var(--dark); margin-bottom: 14px; }
.payment-panel-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.payment-panel-list li { display: flex; align-items: center; gap: 8px; font-size: .92rem; color: var(--dark); }

/* Historique des tournees terminees : bouton discret en bas a gauche (masque tant qu'il n'y a
   aucune tournee a afficher - voir assets/js/client.js), et petite fenetre popup associee,
   ancree au bouton (pas un tiroir plein ecran). */
.history-toggle-btn {
    position: fixed;
    left: 18px;
    bottom: 18px;
    z-index: 45;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--anthracite);
    color: var(--white);
    border: none;
    border-radius: 999px;
    padding: 12px 16px;
    font-family: inherit;
    font-weight: 700;
    font-size: .85rem;
    box-shadow: 0 6px 18px rgba(0,0,0,.28);
    cursor: pointer;
}
/* Le bouton part avec l'attribut HTML "hidden" (voir l.php) et n'est revele par JS (voir
   assets/js/client.js) que s'il existe au moins une tournee terminee en historique. Sans cette
   regle, "display: flex" ci-dessus (regle d'auteur) l'emporterait sur le style navigateur par
   defaut "[hidden] { display: none }" (regle user-agent, toujours perdante face a une regle
   d'auteur meme a specificite egale) et le bouton resterait visible en permanence. */
.history-toggle-btn[hidden] { display: none !important; }
body.ordering-mode .history-toggle-btn { display: none; }
.history-toggle-count { min-width: 16px; }
.history-panel {
    position: fixed;
    left: 18px;
    bottom: 72px;
    z-index: 44;
    width: min(320px, calc(100vw - 36px));
    background: var(--white);
    border-radius: var(--radius-large);
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
    overflow: hidden;
}
.history-panel-header { background: var(--anthracite); color: var(--white); font-weight: 700; padding: 10px 16px; font-size: .9rem; }
.history-panel-list { max-height: 260px; overflow-y: auto; }
.history-panel-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 10px 16px;
    font-family: inherit;
    font-size: .88rem;
    cursor: pointer;
    text-align: left;
}
.history-panel-row:last-child { border-bottom: none; }
.history-panel-row:hover { background: var(--cream, #F7F4EE); }
.history-panel-row-code { font-weight: 700; letter-spacing: .05em; }
.history-panel-row-total { color: var(--muted); font-size: .82rem; }

.ticket-logo { display: block; height: 30px; width: auto; margin: 0 auto 14px; }
/* Logo icone+nom du site (brand_mark_html()) reutilise dans les tickets : fond blanc, donc
   texte en anthracite (au lieu du blanc utilise sur les fonds sombres topbar/entete client). */
.ticket-brand { display: flex; align-items: flex-end; gap: 6px; }
.ticket-brand .brand-name { color: var(--anthracite); }
.ticket-brand-standalone { justify-content: center; margin: 0 auto 14px; }

/* Rangee "logo au meme niveau que les boutons partager/fermer" (popups cote client sur l.php
   uniquement) : grille a 3 colonnes egales pour garder le logo parfaitement centre, que le
   bouton partager soit present (tournee active) ou remplace par un espaceur invisible de meme
   largeur (tournee terminee, popup historique - pas de partage). Le ticket de l'archive vendeur
   (render_order_ticket_html) n'utilise pas cette rangee et garde son ancienne disposition
   (bouton fermer seul, en position absolue - voir ".ticket-close"/".ticket-share" plus bas). */
.ticket-top-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-bottom: 14px;
}
.ticket-top-row .ticket-logo { height: 20px; margin: 0; justify-self: center; }
.ticket-top-row .ticket-brand { justify-self: center; }
.ticket-top-row .ticket-share,
.ticket-top-row .ticket-close,
.ticket-top-row .ticket-top-row-spacer { position: static; }
.ticket-top-row .ticket-share { justify-self: start; }
.ticket-top-row .ticket-close { justify-self: end; }
.ticket-top-row-spacer { width: 21px; height: 1px; }
.ticket {
    background: var(--white);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-lg);
    padding: 26px;
    max-width: 460px;
    margin: 0 auto;
}
/* Utilise par le ticket de l'archive vendeur (render_order_ticket_html) : le ticket cote
   client, lui, n'affiche plus de numero de commande (voir l.php). */
.ticket-code {
    text-align: center;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: .1em;
    color: var(--terracotta);
    margin: 6px 0 18px;
}
.ticket-line { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: .92rem; }
.ticket-total { display: flex; justify-content: space-between; font-weight: 800; font-size: 1.15rem; padding-top: 14px; margin-top: 8px; border-top: 3px solid var(--gold); }

/* Liseré de petits cercles en haut/bas du ticket, pour simuler un pointillé de pré-découpage
   (comme un vrai ticket de caisse detachable). */
.ticket-perforation {
    height: 10px;
    margin: 0 -26px 18px;
    background-image: radial-gradient(circle, var(--border) 3px, transparent 3.2px);
    background-size: 16px 10px;
    background-repeat: repeat-x;
    background-position: center;
}
.ticket-perforation:last-child { margin: 18px -26px 0; }

/* Le ticket affiche dans une popup (commande client sur l.php, ou archive vendeur) n'a pas
   besoin de sa propre carte flottante : la <dialog> fournit deja le cadre et l'ombre. Coins
   non arrondis (comme un vrai ticket de caisse), contrairement aux autres popups de
   l'application. */
.ticket-modal { border-radius: 0; }
.ticket-modal .ticket {
    box-shadow: none;
    margin: 0;
    max-width: none;
    border-radius: 0;
    position: relative;
    padding-top: 44px;
}
/* Popups cote client (l.php) : la rangee ".ticket-top-row" gere deja son propre espacement en
   haut (logo/boutons dans le flux normal), plus besoin de la marge reservee ci-dessus pour un
   bouton en position absolue. */
.ticket-modal .ticket.ticket-has-top-row { padding-top: 26px; }

/* Petit bouton discret (pas de fond/cercle visible) au-dessus du liseré pointille du haut. */
.ticket-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ticket-close:hover { color: var(--anthracite); }

/* Meme traitement discret, en miroir a gauche, pour le bouton de partage. */
.ticket-share {
    position: absolute;
    top: 12px;
    left: 14px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ticket-share:hover { color: var(--anthracite); }

/* ---------------- Utilitaires (app) ---------------- */

.text-muted { color: var(--muted); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }

/* ---------------- Icones d'action (crayon, etc.) ---------------- */

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--white);
    color: var(--anthracite);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--gold); background: var(--light); }
.icon-btn.on-dark { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); color: var(--white); }
.icon-btn.on-dark:hover { background: rgba(255,255,255,.2); border-color: var(--gold); }
.icon-btn.btn-sm { width: 28px; height: 28px; }

/* ---------------- Panneaux repliables (reglages / renommage) ---------------- */

.toggle-panel { display: none; }
.toggle-panel.open { display: block; }

.settings-panel {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px dashed var(--border);
}

.section-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 180px;
}
.section-title-row h1, .section-title-row h3 { margin: 0; }
.section-rename-panel {
    padding: 0 18px 14px;
    background: var(--white);
}

/* ---------------- Icones de moyen de paiement ---------------- */

.icon-payment { display: block; flex-shrink: 0; }

.price-unit-group { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.price-unit-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    color: var(--terracotta);
}
.price-unit-qty { font-size: .95rem; }
.price-cash { font-weight: 700; color: var(--terracotta); }

/* ==========================================================
   PAGE D'ACCUEIL (LANDING) - v2
   Page en pleine largeur (bandes de sections alternees), voir
   "body.is-landing .page" ci-dessous. Chaque section reutilise .landing-wrap
   pour aligner son contenu sur la meme largeur que le reste du site (1100px).
   ========================================================== */

body.is-landing .page { max-width: none; padding: 0; }

.landing-wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

.landing-section { padding: var(--space-xl) 0; }
.landing-section-tight { padding: var(--space-lg) 0; }
.landing-section-white { background: var(--white); }
.landing-section-light { background: var(--light); }
.landing-section-dark { background: var(--anthracite); color: var(--white); }
.landing-section-dark .section-eyebrow { color: var(--gold); }
.landing-section-dark h2 { color: var(--white); }
.landing-section-dark .section-heading p { color: rgba(255,255,255,.75); }

.section-eyebrow {
    display: block;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: .78rem;
    font-weight: 700;
    color: var(--terracotta);
    margin-bottom: .6rem;
}
.section-heading { text-align: center; max-width: 620px; margin: 0 auto var(--space-lg); }
.section-heading h2 { margin-bottom: .4em; }
.section-heading p { color: var(--muted); font-size: 1.05rem; margin: 0; }

/* ---------------- Apparition progressive au scroll ---------------- */
/* Classe posee par assets/js/landing.js (IntersectionObserver) sur les blocs a
   faire apparaitre ; ".is-visible" declenche la transition. Desactivee si
   l'utilisateur prefere reduire les animations. */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity .7s ease, transform .7s ease;
}
.reveal.is-visible { opacity: 1; transform: none; }
.reveal-delay-1 { transition-delay: .08s; }
.reveal-delay-2 { transition-delay: .18s; }
.reveal-delay-3 { transition-delay: .28s; }
@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------------- Hero ---------------- */

.hero {
    background: var(--light);
    border-radius: var(--radius-large);
    padding: 3.5rem 2.5rem;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 2rem;
    align-items: center;
    overflow: hidden;
}
.hero-title { font-size: 3rem; margin-bottom: .4em; }
.hero-title .accent { color: var(--terracotta); }
.hero-lede { font-size: 1.15rem; color: var(--muted); max-width: 42ch; }
.hero-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: .4rem; }
.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 1.6rem; }
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--anthracite);
}
.hero-visual { display: flex; align-items: center; justify-content: center; }
.hero-visual img { width: 100%; height: auto; }
.hero-visual .landing-illu { width: 100%; height: auto; }

.recent-buvettes { margin: var(--space-lg) 0 0; }
.recent-buvettes-title { font-size: 1rem; color: var(--muted); margin-bottom: .6rem; }
.recent-buvettes-list { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------------- Illustrations animees (voir includes/landing-illustrations.php) ---------------- */
/* Toutes les animations continues sont conditionnees a "prefers-reduced-motion: no-preference"
   pour respecter le confort des personnes sensibles au mouvement. */
@media (prefers-reduced-motion: no-preference) {
    .illu-foam-bubble {
        animation: illu-foam-float 3.4s ease-in-out infinite;
        transform-box: fill-box;
        transform-origin: center;
    }
    .illu-foam-bubble-2 { animation-duration: 3.9s; animation-delay: .3s; }
    .illu-foam-bubble-3 { animation-duration: 3.1s; animation-delay: .6s; }

    .illu-ticket {
        animation: illu-ticket-slide 3.8s ease-in-out infinite;
        transform-box: view-box;
    }

    .illu-qr-pulse {
        animation: illu-qr-pulse 2.6s ease-out infinite;
        transform-box: fill-box;
        transform-origin: center;
    }
}
.illu-qr-pulse { opacity: .8; }

@keyframes illu-foam-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
@keyframes illu-ticket-slide {
    0%, 100% { transform: translate(150px, 95px) rotate(18deg); }
    50% { transform: translate(161px, 82px) rotate(13deg); }
}
@keyframes illu-qr-pulse {
    0% { transform: scale(0.88); opacity: .85; }
    70%, 100% { transform: scale(1.18); opacity: 0; }
}
.recent-buvette-card {
    display: inline-flex;
    align-items: center;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 16px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--anthracite);
    text-decoration: none;
    box-shadow: var(--shadow-small);
    transition: var(--transition);
}
.recent-buvette-card:hover { border-color: var(--terracotta); color: var(--terracotta); }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    text-align: center;
    margin: var(--space-lg) 0;
}
.feature-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto .9rem;
}
.feature-icon svg { width: 30px; height: 30px; }
.feature-icon.f-terracotta { background: var(--terracotta); color: var(--white); }
.feature-icon.f-gold { background: var(--gold); color: var(--anthracite); }
.feature-icon.f-ok { background: var(--ok); color: var(--white); }
.feature-card h3 { margin-bottom: .3em; }
.feature-card p { color: var(--muted); font-size: .95rem; margin: 0; }

@media (max-width: 768px) {
    .hero { grid-template-columns: 1fr; padding: 2rem 1.5rem; text-align: center; }
    .hero-lede { max-width: none; margin: 0 auto 1.25rem; }
    .hero-actions, .hero-badges { justify-content: center; }
    .hero-visual { order: -1; max-width: 220px; margin: 0 auto; }
}

/* ---------------- Fonctionnement (etapes numerotees) ---------------- */

.step-card { position: relative; padding-top: 2.4rem; }
.step-number {
    position: absolute;
    top: -18px;
    left: 22px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--anthracite);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.05rem;
    box-shadow: var(--shadow-small);
}
.landing-section .card:hover, .advantage-card:hover, .testimonial-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}
.card, .advantage-card, .testimonial-card { transition: transform var(--transition), box-shadow var(--transition); }

/* ---------------- Démonstration ---------------- */

.demo-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; }
.demo-visual { display: flex; justify-content: center; }
.demo-visual .landing-illu { width: 100%; max-width: 220px; height: auto; }
.demo-visual-pair { align-items: center; gap: 14px; flex-wrap: wrap; }
.demo-visual-pair .landing-illu-qr { max-width: 110px; flex-shrink: 0; }
.demo-visual-pair .landing-illu-phone { max-width: 190px; flex-shrink: 0; }
.demo-visual-pair i { color: var(--muted); flex-shrink: 0; }
@media (max-width: 480px) {
    .demo-visual-pair { flex-direction: column; }
    .demo-visual-pair i { transform: rotate(90deg); }
}
.demo-points { list-style: none; margin: 1.4rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.demo-points li { display: flex; gap: 12px; align-items: flex-start; font-weight: 500; }
.demo-point-icon {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--anthracite);
    display: flex;
    align-items: center;
    justify-content: center;
}
@media (max-width: 860px) {
    .demo-layout { grid-template-columns: 1fr; }
    .demo-points li { text-align: left; }
}

/* ---------------- Avantages ---------------- */

.advantage-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.advantage-card { background: var(--white); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow-small); }
.advantage-card h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 1rem; }
.advantage-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.advantage-list li { display: flex; gap: 10px; align-items: flex-start; color: var(--anthracite); }
.advantage-list li i { flex-shrink: 0; margin-top: 3px; color: var(--terracotta); }
.advantage-note {
    grid-column: 1 / -1;
    text-align: center;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--anthracite);
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: var(--shadow-small);
}
@media (max-width: 768px) {
    .advantage-columns { grid-template-columns: 1fr; }
}

/* ---------------- Statistiques ---------------- */

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 2rem; text-align: center; }
.landing-stat-value { font-size: 2.6rem; font-weight: 800; color: var(--gold); margin-bottom: .2rem; }
.landing-stat-label { color: rgba(255,255,255,.75); font-size: .95rem; }

/* ---------------- Témoignages ---------------- */

.testimonial-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; }
.testimonial-card { background: var(--white); border-radius: var(--radius); padding: 1.8rem; box-shadow: var(--shadow-small); }
.testimonial-quote { font-style: italic; color: var(--anthracite); margin-bottom: 1rem; }
.testimonial-quote::before { content: '\201C'; }
.testimonial-quote::after { content: '\201D'; }
.testimonial-author { font-weight: 700; font-size: .92rem; }
.testimonial-author-role { color: var(--muted); font-weight: 500; font-size: .85rem; }
.testimonial-note { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 1.6rem; }

/* ---------------- FAQ ---------------- */

.faq-list { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.faq-item { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.faq-item summary {
    cursor: pointer;
    padding: 1.1rem 1.4rem;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: '+';
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--terracotta);
    transition: transform var(--transition);
    flex-shrink: 0;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item-body { padding: 0 1.4rem 1.3rem; color: var(--muted); }

/* ---------------- CTA final ---------------- */

.cta-final { text-align: center; }
.cta-final p { color: rgba(255,255,255,.85); max-width: 520px; margin: 0 auto 1.6rem; }
.cta-final .btn { font-size: 1.05rem; padding: 14px 28px; }

/* ---------------- Tarifs (page d'accueil) ---------------- */

.pricing-grid { max-width: 760px; margin-left: auto; margin-right: auto; }
.pricing-grid.grid-3 { max-width: 1080px; }
.pricing-promo-strike { text-decoration: line-through; color: var(--muted); font-size: .55em; font-weight: 600; display: block; }
.pricing-card { text-align: center; position: relative; display: flex; flex-direction: column; }
/* Les 3 boutons d'action (Gratuit/Evenement/Illimite) restent alignes sur la meme ligne en bas
   des cartes, meme si le contenu au-dessus (liste de fonctionnalites) n'a pas exactement la
   meme hauteur d'une carte a l'autre. */
.pricing-card > a:last-child,
.pricing-card > form:last-child { margin-top: auto; }
.pricing-card-premium { border: 1.5px solid var(--gold); }
.pricing-card-premium .badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); }
.pricing-price { font-size: 2rem; font-weight: 800; color: var(--terracotta); margin: 6px 0 18px; }
.pricing-features { list-style: none; padding: 0; margin: 0 0 20px; text-align: left; }
.pricing-features li { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: .92rem; color: var(--muted); }
.pricing-features li:last-child { border-bottom: none; }
