/* ════════════════════════════════════════════════════════════════════
   FARO POS — theme.css — Design system condiviso
   ────────────────────────────────────────────────────────────────────
   Fornisce design tokens (CSS vars) e componenti base (.btn .card
   .input .modal .ds-alert) per tutte le pagine.

   Caricamento: deve essere il PRIMO <link rel="stylesheet"> di ogni
   pagina HTML, cosi' regole successive (main.css, page-*.css, style
   inline) vincono per cascade order. Questo permette il refactor
   incrementale senza regressioni: il nuovo theme e' "default" e
   subentra dove non ci sono override gia' esistenti.

   Convenzioni:
   - Tokens: prefisso semantico (--bg-, --text-, --border-, --accent,
     --success/warning/danger/info, --fs-, --sp-, --r-, --z-).
     NON sovrascrive le vars vecchie di main.css (--nero, --crema,
     --bordeaux, ecc) che restano valide finche' non migrate.
   - Componenti: classi nuove pulite (.btn .btn-primary .card .input).
     Per evitare collisioni con .toast esistente in main.css, gli
     alert del nuovo sistema si chiamano .ds-alert.
   ════════════════════════════════════════════════════════════════════ */

:root {
  /* ── PALETTE: superfici landing FARO ─────────────────────── */
  --bg-0: #08080B;          /* sfondo base pagina */
  --bg-1: #111014;          /* card / pannelli */
  --bg-2: #171419;          /* input / card elevata */
  --bg-3: #211B20;          /* hover / focus */

  /* ── PALETTE: testo ───────────────────────────────────────── */
  --text-primary: #F7F3EA;
  --text-secondary: #C9C1B6;
  --text-muted: #827A73;
  --text-inverse: #1A120A;  /* su superfici chiare/accento */

  /* ── PALETTE: bordi ───────────────────────────────────────── */
  --border-soft: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(213, 179, 111, 0.34);

  /* ── PALETTE: accenti brand ───────────────────────────────── */
  --accent: #D5B36F;        /* ottone landing — CTA primarie */
  --accent-hover: #F0D79C;
  --accent-2: #8F1427;      /* bordeaux landing — secondario/brand */
  --accent-2-hover: #C51D37;

  /* ── PALETTE: semantici ───────────────────────────────────── */
  --success: #3FAE6B;
  --success-bg: rgba(63, 174, 107, 0.12);
  --warning: #D5B36F;
  --warning-bg: rgba(213, 179, 111, 0.12);
  --danger: #C51D37;
  --danger-bg: rgba(143, 20, 39, 0.12);
  --info: #C9C1B6;
  --info-bg: rgba(201, 193, 182, 0.12);

  /* ── TIPOGRAFIA: scala ────────────────────────────────────── */
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: 2.5rem;

  /* ── TIPOGRAFIA: famiglie ─────────────────────────────────── */
  --font-body:    "EB Garamond", Georgia, serif;            /* corpo testo */
  --font-heading: "Cormorant Garamond", "EB Garamond", Georgia, serif;  /* titoli */
  --font-display: "Cormorant SC", "Cormorant Garamond", serif;          /* etichette/CTA stile small-caps */
  --font-mono:    "Courier New", ui-monospace, monospace;   /* dati tabellari, log */

  /* ── SPACING: scala 8px-base ──────────────────────────────── */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;

  /* ── BORDER RADIUS: 4 valori standard ─────────────────────── */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-full: 999px;

  /* ── SHADOW ───────────────────────────────────────────────── */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);

  /* ── Z-INDEX SCALE ────────────────────────────────────────── */
  --z-header: 100;
  --z-sticky: 200;
  --z-dropdown: 300;
  --z-overlay: 400;
  --z-modal: 500;
  --z-toast: 600;
  --z-tooltip: 700;

  /* ── TRANSITIONS ──────────────────────────────────────────── */
  --transition-fast: 0.12s ease;
  --transition-base: 0.18s ease;

  /* ════════════════════════════════════════════════════════════
     ALIAS DI COMPATIBILITÀ (FARO_DS_UNIFY_V1, 2026-05-20)
     Le page-*.css (costi, report, cucina, giochi) usano un naming
     alternativo di token che NON era mai stato definito → in quelle
     pagine colori/spaziature/raggi/font cadevano su valori invalidi.
     Qui li definiamo come alias verso i token del design system: così
     theme.css torna a essere la SORGENTE UNICA e cambiare tema (o
     applicare la palette cliente, che fa override di questi token DS)
     si propaga automaticamente a tutte le pagine.
     ════════════════════════════════════════════════════════════ */
  /* colori brand / testo / bordi */
  --rosso-primario:   var(--accent-2);
  --rosso-scuro:      var(--accent-2-hover);
  --testo-primario:   var(--text-primary);
  --testo-secondario: var(--text-secondary);
  --testo-muted:      var(--text-muted);
  --border-default:   var(--border-soft);
  --bg2:              var(--bg-2);
  --bg3:              var(--bg-3);
  --blue2:            var(--accent);
  /* sfumature bordeaux (alpha — valori fissi, non theme-aware) */
  --rosso-soft-08:    rgba(143, 20, 39, 0.08);
  --rosso-soft-30:    rgba(143, 20, 39, 0.30);
  --shadow-glow:      0 0 0 1px rgba(197,29,55,0.48), 0 18px 44px rgba(143,20,39,0.28);
  /* spacing */
  --sp-xs: var(--sp-1);
  --sp-sm: var(--sp-2);
  --sp-md: var(--sp-4);
  --sp-lg: var(--sp-5);
  --sp-xl: var(--sp-6);
  /* radius */
  --radius-sm:   var(--r-sm);
  --radius-md:   var(--r-md);
  --radius-lg:   var(--r-lg);
  --radius-full: var(--r-full);
  --radius-pill: var(--r-full);
  /* transizioni */
  --t-fast: var(--transition-fast);
  --t-base: var(--transition-base);
  /* tipografia */
  --font-sans: var(--font-body);
  --font-ui:   var(--font-body);
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;
  --ls-label: 0.08em;
  /* touch target minimi */
  --touch-min: 44px;
  --touch-pos: 44px;
}

/* ════════════════════════════════════════════════════════════════════
   COMPONENTI BASE — disponibili in tutte le pagine
   ════════════════════════════════════════════════════════════════════ */

/* ── BOTTONI ─────────────────────────────────────────────────────────
   Sistema: .btn (base) + 5 varianti + 3 size.
   Le pagine che hanno gia' .btn-primary/secondary/danger/success
   inline o in main.css continuano a vincere via cascade.
   ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 10px 18px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn:active:not(:disabled) {
  transform: translateY(0);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary   { background: var(--accent); color: var(--text-inverse); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary { background: var(--bg-2); color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-3); }

.btn-danger    { background: var(--danger); color: #2a0a0a; }
.btn-danger:hover:not(:disabled) { background: #ff8a8a; }

.btn-success   { background: var(--success); color: #052e16; }
.btn-success:hover:not(:disabled) { background: #6df097; }

.btn-warning   { background: var(--warning); color: #422006; }
.btn-warning:hover:not(:disabled) { background: #fcd34d; }

.btn-ghost     { background: transparent; color: var(--text-secondary); border-color: var(--border-soft); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-1); color: var(--text-primary); border-color: var(--border-strong); }

.btn-bordeaux  { background: var(--accent-2); color: var(--text-primary); }
.btn-bordeaux:hover:not(:disabled) { background: var(--accent-2-hover); }

/* size */
.btn-sm { padding: 6px 12px; font-size: var(--fs-xs); }
.btn-lg { padding: 14px 24px; font-size: var(--fs-md); }

/* full width */
.btn-block { display: flex; width: 100%; }

/* ── INPUT / SELECT / TEXTAREA ────────────────────────────────────── */
.input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-2);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: var(--fs-sm);
  line-height: 1.4;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 152, 58, 0.2);
}
.input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.input::placeholder { color: var(--text-muted); }

.input-sm { padding: 6px 10px; font-size: var(--fs-xs); }
.input-lg { padding: 14px 16px; font-size: var(--fs-md); }

/* ── CARD ────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--sp-4);
}
.card-header {
  font-family: var(--font-heading);
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: var(--sp-2);
}
.card-elevated {
  background: var(--bg-2);
  box-shadow: var(--shadow-md);
}

/* ── MODAL (nuovo, non collide con .modal-overlay esistente) ──────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}
.modal-window {
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  z-index: var(--z-modal);
}
.modal-window-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-heading);
  font-size: var(--fs-xl);
  color: var(--accent);
}
.modal-window-body { padding: var(--sp-5); }
.modal-window-footer {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
}

/* ── ALERT / NOTIFICA INLINE (.ds-alert per non collidere) ────────── */
.ds-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  border-left: 4px solid;
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.ds-alert-success { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.ds-alert-warning { background: var(--warning-bg); border-color: var(--warning); color: var(--warning); }
.ds-alert-danger  { background: var(--danger-bg);  border-color: var(--danger);  color: var(--danger);  }
.ds-alert-info    { background: var(--info-bg);    border-color: var(--info);    color: var(--info);    }

/* ── BADGE ────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--bg-2);
  color: var(--text-secondary);
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  }
.badge-info    { background: var(--info-bg);    color: var(--info);    }
.badge-accent  { background: var(--accent); color: var(--text-inverse); }

/* ── UTILITY ──────────────────────────────────────────────────────── */
.text-muted     { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent    { color: var(--accent); }
.text-success   { color: var(--success); }
.text-warning   { color: var(--warning); }
.text-danger    { color: var(--danger); }
.text-center    { text-align: center; }
.text-right     { text-align: right; }
.text-mono      { font-family: var(--font-mono); }
.text-heading   { font-family: var(--font-heading); }

.fs-xs { font-size: var(--fs-xs); }
.fs-sm { font-size: var(--fs-sm); }
.fs-md { font-size: var(--fs-md); }
.fs-lg { font-size: var(--fs-lg); }
.fs-xl { font-size: var(--fs-xl); }

.flex          { display: flex; }
.flex-col      { display: flex; flex-direction: column; }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }

.mt-1 { margin-top: var(--sp-1); } .mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); } .mt-4 { margin-top: var(--sp-4); }
.mb-1 { margin-bottom: var(--sp-1); } .mb-2 { margin-bottom: var(--sp-2); } .mb-3 { margin-bottom: var(--sp-3); } .mb-4 { margin-bottom: var(--sp-4); }
