/* ==========================================================================
   styles.css - integration du design system Claude Design (tache 10)
   --------------------------------------------------------------------------
   Le design system complet (tokens + base + composants ss-*) vit dans
   design/ et est importe tel quel : c'est la source de verite validee par
   Robin, pas une copie qui pourrait diverger. Ce fichier ne contient que ce
   qui est propre a StarServe : la coquille de page (topbar, panel, ecrans
   d'amorcage) et les rendus specifiques (planches QR, courbe de notes) que
   le design system generique ne couvre pas.
   ========================================================================== */

@import "design/styles.css";

#app {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
}

/* Le plafond de 480px vient du squelette mobile-first initial (Tache 3),
   pense pour les serveurs en salle sur telephone. Le gerant, lui, consulte
   surtout le tableau de bord sur ordinateur (voir maquette bureau) : au-dela
   d'un telephone en paysage, on laisse l'app respirer plutot que de rester
   coincee dans une colonne etroite. Le login/onboarding restent centres et
   etroits via .auth-card, coherent avec la maquette bureau correspondante. */
@media (min-width: 720px) {
  #app { max-width: 1040px; }
  .topbar { padding: var(--space-4) var(--space-8); }
  .panel { padding: var(--space-8) var(--space-8); gap: var(--space-6); }
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hint { font: var(--weight-medium) var(--text-sm)/1.5 var(--font-sans); color: var(--text-muted); text-align: center; }

/* --------------------------------------------------------------------
   Amorcage
   -------------------------------------------------------------------- */

.boot {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  padding: 0 var(--space-8);
  text-align: center;
}

.boot .t1 { font-family: var(--font-display); font-size: var(--text-h2); font-weight: var(--weight-semibold); color: var(--text-strong); }
.boot .t2 { font: var(--weight-regular) var(--text-sm)/var(--leading-normal) var(--font-sans); color: var(--text-muted); max-width: 340px; }
.boot code {
  font-family: var(--font-mono);
  color: var(--text-accent);
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------
   Authentification et onboarding
   -------------------------------------------------------------------- */

.auth {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.auth-card {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-weight: var(--weight-bold);
  color: var(--text-strong);
}

/* --------------------------------------------------------------------
   Ossature partagee des ecrans authentifies
   -------------------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-subtle);
}
.topbar .brand { font-family: var(--font-display); font-size: var(--text-h3); font-weight: var(--weight-semibold); color: var(--text-strong); }

.topnav { display: flex; gap: var(--space-4); flex: 1; overflow-x: auto; }
.topnav a {
  font: var(--weight-semibold) var(--text-sm)/1.3 var(--font-sans);
  color: var(--text-muted);
  text-decoration: none;
  padding: var(--space-2) 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.topnav a.on { color: var(--text-accent); border-bottom-color: var(--accent); }

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-5);
}

/* --------------------------------------------------------------------
   Equipe
   -------------------------------------------------------------------- */

.server-row-inactive { opacity: .6; }

/* --------------------------------------------------------------------
   Tableau de bord et classement
   -------------------------------------------------------------------- */

.stat-total { display: flex; align-items: baseline; gap: var(--space-2); }
.stat-value {
  font-family: var(--font-display);
  font-size: var(--metric-xl);
  font-weight: var(--metric-weight);
  letter-spacing: var(--metric-tracking);
  line-height: var(--metric-leading);
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
}
.stat-label { font: var(--weight-semibold) var(--text-sm)/1 var(--font-sans); color: var(--text-muted); }

.ranking-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.ranking-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-xs);
}
.ranking-row.inactive { opacity: .6; }
.ranking-row .rank {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  color: var(--text-body);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
}
.ranking-row:first-child .rank { background: var(--accent); color: var(--text-on-accent); }
.ranking-row .server-name { flex: 1; font-size: var(--text-base); font-weight: var(--weight-semibold); color: var(--text-strong); }
.ranking-row .count {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
}

/* --------------------------------------------------------------------
   Planches QR
   -------------------------------------------------------------------- */

.protocol-banner {
  background: var(--attention-soft);
  color: var(--attention);
  border-bottom: 1px solid var(--attention);
  padding: var(--space-3) var(--space-5);
  font: var(--weight-semibold) var(--text-sm)/1.5 var(--font-sans);
  text-align: center;
}

.qr-sheet { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-bottom: var(--space-2); }

.qr-block { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); text-align: center; }
.qr-restaurant { font: var(--weight-semibold) var(--text-2xs)/1.2 var(--font-sans); color: var(--text-muted); text-transform: uppercase; letter-spacing: var(--tracking-label); }
.qr-name { font-family: var(--font-display); font-size: var(--text-h1); font-weight: var(--weight-bold); color: var(--text-strong); }
.qr-code { width: 5cm; height: 5cm; }
.qr-code svg { display: block; width: 100%; height: 100%; }
.qr-cta { font: var(--weight-semibold) var(--text-sm)/1.3 var(--font-sans); color: var(--text-body); }
.qr-fallback { font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--text-subtle); letter-spacing: .05em; }

.qr-card {
  width: 6.5cm;
  padding: var(--space-4);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

/* Chevalet : deux moities identiques separees par un pli, la seconde
   pivotee a 180deg pour se lire a l'endroit une fois le papier replie. */
.qr-tent {
  width: 8cm;
  display: flex;
  flex-direction: column;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.qr-tent-half { padding: var(--space-4); }
.qr-tent-half:first-child { border-bottom: 1px dashed var(--border-default); }
.qr-tent-flip { transform: rotate(180deg); }

/* --------------------------------------------------------------------
   Releves de note Google
   -------------------------------------------------------------------- */

.rating-chart {
  width: 100%;
  height: 100px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

@media print {
  .no-print { display: none !important; }
  html, body { background: #ffffff; }
  #app { max-width: none; background: #ffffff; }
  .screen { display: block; }
  .panel { padding: 0; gap: 24px; }

  .qr-card, .qr-tent {
    background: #ffffff;
    border: 1px solid #000000;
    box-shadow: none;
    break-inside: avoid;
  }
  .qr-tent-half:first-child { border-bottom: 1px dashed #000000; }
  .qr-restaurant, .qr-name, .qr-cta, .qr-fallback { color: #000000; }

  .protocol-banner {
    /* Statique et non fixe : un fixed a l'impression se superpose au
       contenu de chaque page sans lui reserver de place, et cachait le
       haut des cartes de la premiere rangee. */
    margin-bottom: 10mm;
    background: #ffe5e5;
    color: #7a0000;
    border: 2px solid #7a0000;
  }

  @page { size: A4; margin: 10mm; }
}
