/* ============================================================
   barman.css — Interface barman · Bar Festival
   Personnalisez les variables dans :root pour adapter
   l'esthétique à votre festival
   ============================================================ */

/* ── COULEURS & THÈME ─────────────────────────────────────────
   Changez ces valeurs pour adapter au visuel de votre festival
   ─────────────────────────────────────────────────────────── */
:root {
  /* Couleurs des boutons */
  --btn-beer-pinte-from:  #F5A623;   /* Dégradé pinte bière — haut */
  --btn-beer-pinte-to:    #C07308;   /* Dégradé pinte bière — bas  */
  --btn-beer-pichet-from: #D4861A;   /* Dégradé pichet bière — haut */
  --btn-beer-pichet-to:   #9A5600;   /* Dégradé pichet bière — bas  */
  --btn-shot1-from:       #F04040;   /* Dégradé 1 shot — haut */
  --btn-shot1-to:         #A81010;   /* Dégradé 1 shot — bas  */
  --btn-shot5-from:       #C02020;   /* Dégradé 5 shots — haut */
  --btn-shot5-to:         #7A0000;   /* Dégradé 5 shots — bas  */

  /* Couleur du texte sur chaque bouton */
  --btn-beer-text:  #3a1a00;
  --btn-shot-text:  #2a0000;

  /* Couleurs d'accentuation dans la session bar */
  --accent-beer: #E8930A;
  --accent-shot: #E53935;

  /* Interface générale */
  --bg:      #0a0a0a;   /* Fond de page */
  --surface: #161616;   /* Fond header / session bar / undo bar */
  --border:  #2a2a2a;   /* Séparateurs */
  --text:    #f0f0f0;   /* Texte principal */
  --muted:   #555;      /* Texte secondaire */

  /* Typographie */
  --font-display: 'Barlow Condensed', sans-serif;
  --font-body:    'Barlow', sans-serif;

  /* Géométrie des boutons */
  --btn-radius: 16px;   /* Arrondi des coins */
  --grid-gap:   10px;   /* Espacement entre boutons */
  --grid-pad:   10px;   /* Padding autour de la grille */
}

/* ── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

/* ── HEADER ───────────────────────────────────────────────── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}

.header-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* Pastille de statut réseau */
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4CAF50;
  box-shadow: 0 0 5px currentColor;
  transition: background .3s;
}
.dot.offline { background: var(--accent-shot); }
.dot.syncing { background: var(--accent-beer); animation: blink 1s infinite; }

@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

/* Badge "X en attente" (mode offline) */
.queue-pill {
  background: var(--accent-beer);
  color: #000;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  display: none;
}
.queue-pill.on { display: inline-block; }

/* Bouton config */
.cfg-btn {
  background: none; border: none;
  color: var(--muted); font-size: 18px;
  cursor: pointer; padding: 4px; line-height: 1;
}

/* ── SESSION STRIP ────────────────────────────────────────── */
.session {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.session-cell {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
}

.session-cell + .session-cell {
  border-left: 1px solid var(--border);
}

.s-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 2px;
}

.s-val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
}
.s-val.beer { color: var(--accent-beer); }
.s-val.shot { color: var(--accent-shot); }

/* ── GRILLE 2×2 ───────────────────────────────────────────── */
.grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: var(--grid-gap);
  padding: var(--grid-pad);
  min-height: 0;
}

/* ── BOUTONS ──────────────────────────────────────────────── */
.btn {
  position: relative;
  border: none;
  border-radius: var(--btn-radius);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform .07s, filter .07s;
}

.btn:active {
  transform: scale(.95);
  filter: brightness(.82);
}

/* Couleurs des boutons (modifiables via les variables :root) */
.btn.beer-pinte {
  background: linear-gradient(150deg, var(--btn-beer-pinte-from) 0%, var(--btn-beer-pinte-to) 100%);
  color: var(--btn-beer-text);
}
.btn.beer-pichet {
  background: linear-gradient(150deg, var(--btn-beer-pichet-from) 0%, var(--btn-beer-pichet-to) 100%);
  color: var(--btn-beer-text);
}
.btn.shot-1 {
  background: linear-gradient(150deg, var(--btn-shot1-from) 0%, var(--btn-shot1-to) 100%);
  color: var(--btn-shot-text);
}
.btn.shot-5 {
  background: linear-gradient(150deg, var(--btn-shot5-from) 0%, var(--btn-shot5-to) 100%);
  color: var(--btn-shot-text);
}

/* Contenu des boutons */
.btn-icon {
  font-size: clamp(32px, 7vw, 52px);
  line-height: 1;
  pointer-events: none;
}
.btn-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(20px, 4.5vw, 32px);
  text-transform: uppercase;
  letter-spacing: .04em;
  pointer-events: none;
}
.btn-vol {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: clamp(13px, 2.5vw, 17px);
  opacity: .6;
  pointer-events: none;
}

/* Effet ripple au tap */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.28);
  transform: scale(0);
  animation: rip .5s ease-out forwards;
  pointer-events: none;
}
@keyframes rip { to { transform: scale(6); opacity: 0; } }

/* ── BARRE D'ANNULATION ───────────────────────────────────── */
.undo-bar {
  flex-shrink: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
}

.last-txt {
  font-size: 13px;
  color: var(--muted);
}
.last-txt b {
  color: var(--text);
  font-weight: 500;
}

.undo-btn {
  background: var(--border);
  border: none;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  display: none;
}
.undo-btn.on { display: block; }
.undo-btn:active { background: #3a3a3a; }

/* ── TOAST ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  top: 18px; left: 50%;
  transform: translateX(-50%) translateY(-70px);
  background: #1e1e1e;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  padding: 9px 20px;
  border-radius: 30px;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
  z-index: 300;
  pointer-events: none;
  white-space: nowrap;
}
.toast.on { transform: translateX(-50%) translateY(0); }

/* ── MODAL DE CONFIGURATION ───────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.8);
  z-index: 200;
  display: none;
  align-items: flex-end;
}
.modal-bg.on { display: flex; }

.modal {
  background: #1a1a1a;
  border-radius: 20px 20px 0 0;
  padding: 24px;
  width: 100%;
  border-top: 1px solid var(--border);
}
.modal h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}
.modal label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.modal input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 16px;
  padding: 11px 13px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-family: var(--font-body);
}
.modal-btns { display: flex; gap: 10px; }
.mbtn {
  flex: 1; padding: 13px;
  border-radius: 12px; border: none;
  font-family: var(--font-display);
  font-weight: 700; font-size: 16px;
  text-transform: uppercase; letter-spacing: .05em;
  cursor: pointer;
}
.mbtn.ok  { background: var(--accent-beer); color: #000; }
.mbtn.ko  { background: var(--border);      color: var(--text); }
