/* PLAYROUND — foglio di stile condiviso dalle tre applicazioni.
 *
 * Non è un tema «ispirato a»: i token, i font e le varianti dei componenti sono
 * gli stessi del frontend Next.js in `playround/` (src/app/globals.css e
 * src/components/ui/*). Chi apre una delle tre app deve riconoscere subito lo
 * stesso prodotto.
 *
 * Cosa è stato ripreso alla lettera:
 *   · la palette light e dark, incluse le versioni scurite di rosso e verde
 *     rese conformi WCAG AA sul tema chiaro;
 *   · i quattro font: Albuquerque (wordmark), Coolvetica (titoli e nav),
 *     Schibsted Grotesk (testo), monospace di sistema per il codice;
 *   · le varianti di bottone (blu primario, giallo secondario, outline e ghost
 *     gialli, rosso destructive, verde success) e di badge;
 *   · il meccanismo del tema: classe `.dark` sull'elemento radice, preferenza
 *     salvata in localStorage sotto `playround-theme`, default scuro.
 *
 * I due font del brand sono serviti dalle app stesse (copiati da
 * playround/public/fonts) e non da una CDN: le app devono funzionare offline.
 * Schibsted Grotesk arriva da Google Fonts e, se la rete manca, ricade sulla
 * sans di sistema senza rompere nulla.
 */

@import url("https://fonts.googleapis.com/css2?family=Schibsted+Grotesk:wght@400;500;600;700&display=swap");

@font-face {
  font-family: "Albuquerque";
  src: url("/_shared/fonts/AlbuquerqueTRIAL-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Coolvetica";
  src: url("/_shared/fonts/Coolvetica-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

/* ------------------------------------------------------------------ */
/* Token — tema chiaro (identici a playround/src/app/globals.css)       */
/* ------------------------------------------------------------------ */

:root {
  /* Palette grezza del brand */
  --brand-black: #000000;
  --brand-blue: #1938c8;
  --brand-red: #ea3325;
  --brand-yellow: #eaaf3c;
  --brand-sage: #b6c4c3;

  --background: #ffffff;
  --foreground: #000000;
  --card: #ffffff;
  --card-foreground: #000000;
  --popover: #ffffff;
  --popover-foreground: #000000;
  --primary: #1938c8;
  --primary-foreground: #ffffff;
  --secondary: #eaaf3c;
  --secondary-foreground: #000000;
  --muted: #f1f4f3;
  --muted-foreground: #56635f;
  --accent: #eef1f0;
  --accent-foreground: #000000;
  /* Rosso e verde semantici scuriti per passare AA su fondo chiaro; il rosso
     decorativo del marchio (--brand-red) resta invariato. */
  --destructive: #bf2117;
  --destructive-foreground: #ffffff;
  --success: #13753d;
  --success-foreground: #ffffff;
  --warning: #eaaf3c;
  --warning-foreground: #000000;
  --border: #e3e7e6;
  --input: #cfd6d4;
  --ring: #1938c8;

  --radius: 0.625rem;
  --radius-md: calc(var(--radius) * 0.8);
  --radius-sm: calc(var(--radius) * 0.6);

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 8px 24px -16px rgb(0 0 0 / .25);

  --font-sans: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-heading: "Coolvetica", "Schibsted Grotesk", ui-sans-serif, sans-serif;
  --font-display: "Albuquerque", "Coolvetica", serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --toggle-surface: rgb(0 0 0 / 0.04);
}

/* Tema scuro — «estetica glass scura PlayRound con accenti brand» */
.dark {
  --background: #0a0c0c;
  --foreground: #eaf1f0;
  --card: #14181a;
  --card-foreground: #eaf1f0;
  --popover: #14181a;
  --popover-foreground: #eaf1f0;
  --primary: #3a5bec;
  --primary-foreground: #ffffff;
  --secondary: #eaaf3c;
  --secondary-foreground: #000000;
  --muted: #1b2122;
  --muted-foreground: #93a9a8;
  --accent: #1b2122;
  --accent-foreground: #eaf1f0;
  --destructive: #ea3325;
  --destructive-foreground: #ffffff;
  --success: #2fb36a;
  --success-foreground: #04140c;
  --warning: #eaaf3c;
  --warning-foreground: #000000;
  --border: rgb(182 196 195 / 16%);
  --input: rgb(182 196 195 / 26%);
  --ring: #5b79f0;
  --shadow: 0 1px 2px rgb(0 0 0 / .5), 0 8px 24px -16px rgb(0 0 0 / .9);
  --toggle-surface: rgb(0 0 0 / 0.4);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  font-family: var(--font-sans);
}

@media (max-width: 1023px) {
  html { overflow-x: hidden; -webkit-overflow-scrolling: touch; }
}

body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}

/* I titoli usano Coolvetica, come nel layer base del frontend. */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: 1.15;
  margin: 0 0 .5rem;
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .75rem; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

code, kbd, pre { font-family: var(--font-mono); font-size: .85em; }
pre {
  background: var(--muted); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .75rem .9rem; overflow-x: auto;
}

:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.font-display { font-family: var(--font-display); }
.font-heading { font-family: var(--font-heading); }

/* ------------------------------------------------------------------ */
/* Guscio di pagina — VendorShell del frontend                          */
/* ------------------------------------------------------------------ */

.shell {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  overflow-x: hidden;
  padding: 2rem 2.5rem 3.5rem;
}

@media (max-width: 640px) {
  .shell { padding: 1.5rem 1.1rem 2.5rem; }
}

/* Wordmark: Albuquerque nel rosso del marchio, centrato. */
.wordmark {
  pointer-events: none;
  display: flex;
  flex-shrink: 0;
  justify-content: center;
  padding: 0 .5rem;
}
.wordmark h1 {
  margin: 0;
  font-family: var(--font-display);
  text-align: center;
  color: var(--brand-red);
  letter-spacing: -0.02em;
  font-size: clamp(48px, 15vw, 156px);
  line-height: 0.92;
}
@media (min-width: 1024px) {
  .wordmark h1 { font-size: 240px; line-height: 1; }
}

/* Versione compatta per le pagine dense (console, tabelle, cruscotti):
   stesso font e stesso rosso, altezza che non ruba lo spazio ai dati. */
.wordmark.compact h1 {
  font-size: clamp(34px, 7vw, 64px);
  line-height: 1;
}
@media (min-width: 1024px) {
  .wordmark.compact h1 { font-size: 64px; }
}

.model-label {
  margin: .35rem 0 0;
  text-align: center;
  font-family: var(--font-heading);
  font-size: 15px;
  color: var(--muted-foreground);
}

.column {
  position: relative;
  z-index: 10;
  margin: 2rem auto 0;
  display: flex;
  width: 100%;
  max-width: 1100px;
  flex: 1 1 auto;
  flex-direction: column;
}
.column.wide { max-width: 1280px; }
.column.narrow { max-width: 780px; }

.page-title {
  text-align: center;
  font-family: var(--font-heading);
  font-size: 28px;
  color: var(--foreground);
  margin: 0;
}
@media (min-width: 1024px) { .page-title { font-size: 34px; } }

.page-subtitle {
  margin: .25rem 0 1.5rem;
  text-align: center;
  font-family: var(--font-heading);
  font-size: 15px;
  color: var(--muted-foreground);
}

/* Navigazione a pillole, centrata. */
.pillnav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
  margin-bottom: 2rem;
}
.pillnav a {
  border-radius: 999px;
  padding: .5rem 1rem;
  border: 1px solid var(--border);
  font-family: var(--font-heading);
  font-size: 14px;
  color: var(--muted-foreground);
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.pillnav a:hover {
  border-color: color-mix(in srgb, var(--foreground) 40%, transparent);
  color: var(--foreground);
  text-decoration: none;
}
.pillnav a.active {
  background: #bf2117;
  border-color: transparent;
  color: #ffffff;
}

/* Suggerimenti di ricerca: pillole discrete, non bottoni. Sei call-to-action
   gialle una accanto all'altra griderebbero più della ricerca stessa. */
.chiplist { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: .8rem; }
.chip {
  border-radius: 999px;
  padding: .4rem .85rem;
  border: 1px solid var(--border);
  background: transparent;
  font-family: var(--font-heading);
  font-size: 13px;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.chip:hover {
  border-color: color-mix(in srgb, var(--foreground) 40%, transparent);
  color: var(--foreground);
  text-decoration: none;
}

/* Monogramma di chiusura. */
.marks {
  position: relative;
  z-index: 30;
  display: flex;
  flex-shrink: 0;
  justify-content: center;
  padding: 2rem 2.5rem 0;
}
.marks svg {
  height: 4rem;
  width: 4rem;
  color: var(--brand-red);
  filter: drop-shadow(0 2px 8px rgb(0 0 0 / 0.35));
}

/* Selettore tema, fisso in alto a destra come nel frontend. */
.theme-toggle {
  position: fixed;
  right: .75rem;
  top: .75rem;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--toggle-surface);
  padding: .25rem;
  backdrop-filter: blur(8px);
}
@media (min-width: 1024px) { .theme-toggle { right: 1.25rem; top: 1.25rem; } }
.theme-toggle button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: .5rem;
  cursor: pointer;
  color: var(--muted-foreground);
  font: inherit;
  transition: color .15s ease, background-color .15s ease;
}
.theme-toggle button:hover { color: var(--foreground); }
.theme-toggle button[aria-checked="true"] {
  background: var(--primary);
  color: var(--primary-foreground);
}
.theme-toggle svg { height: 1rem; width: 1rem; }

/* ------------------------------------------------------------------ */
/* Griglie                                                              */
/* ------------------------------------------------------------------ */

.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1 1 auto; }

/* ------------------------------------------------------------------ */
/* Card — `rounded-lg border bg-card shadow-sm`, padding p-6            */
/* ------------------------------------------------------------------ */

.card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--card-foreground);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
}
.card.flush { padding: 0; overflow: hidden; }
.card > h2 { margin-bottom: .35rem; }
.card .hint { color: var(--muted-foreground); font-size: .85rem; }

.section-title {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  flex-wrap: wrap;
  margin: 2rem 0 .85rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
}
.section-title h2 { margin: 0; }
.section-title .hint { color: var(--muted-foreground); font-size: .82rem; }

.stat { display: flex; flex-direction: column; gap: .15rem; }
.stat .label {
  font-family: var(--font-heading);
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.stat .value {
  font-family: var(--font-heading);
  font-size: 1.9rem;
  line-height: 1.1;
  letter-spacing: -.01em;
}
.stat .sub { font-size: .8rem; color: var(--muted-foreground); }
.stat .value.pos { color: var(--success); }
.stat .value.neg { color: var(--destructive); }

/* ------------------------------------------------------------------ */
/* Bottoni — stesse varianti di components/ui/button.tsx                */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  gap: .45rem;
  height: 2.5rem;
  padding: .5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
  /* default = blu primario (UI Kit «Add to Cart») */
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: color-mix(in srgb, var(--primary) 90%, black); text-decoration: none; }
.btn:disabled { pointer-events: none; opacity: .5; }

.btn.secondary { background: var(--secondary); color: var(--secondary-foreground); }
.btn.secondary:hover { background: color-mix(in srgb, var(--secondary) 85%, black); }

.btn.outline {
  background: transparent;
  border-color: var(--secondary);
  color: var(--secondary);
  box-shadow: none;
}
.btn.outline:hover { background: var(--secondary); color: var(--secondary-foreground); }

.btn.ghost {
  background: transparent;
  color: var(--secondary);
  box-shadow: none;
}
.btn.ghost:hover { background: color-mix(in srgb, var(--secondary) 10%, transparent); }

.btn.danger { background: var(--destructive); color: var(--destructive-foreground); }
.btn.danger:hover { background: color-mix(in srgb, var(--destructive) 90%, black); }

.btn.success { background: var(--success); color: var(--success-foreground); }

.btn.small { height: 2.25rem; padding: .35rem .75rem; font-size: .82rem; }

/* ------------------------------------------------------------------ */
/* Campi — `h-10 rounded-md border-input bg-background text-sm`         */
/* ------------------------------------------------------------------ */

input[type=text], input[type=search], input[type=number], input[type=url],
input[type=password], input[type=email], select, textarea {
  display: flex;
  height: 2.5rem;
  width: 100%;
  padding: .5rem .75rem;
  font-family: var(--font-sans);
  font-size: .875rem;
  color: var(--foreground);
  background: var(--background);
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
}
textarea { height: auto; min-height: 5rem; }
input[type=file] {
  width: 100%;
  padding: .5rem 0;
  font-size: .875rem;
  color: var(--muted-foreground);
}
input::placeholder, textarea::placeholder { color: var(--muted-foreground); }
input:disabled, select:disabled, textarea:disabled { opacity: .5; cursor: not-allowed; }

label {
  display: block;
  font-family: var(--font-heading);
  font-size: .88rem;
  margin-bottom: .3rem;
  color: var(--foreground);
}
.field { margin-bottom: .85rem; }
.field .help, .help { font-size: .78rem; color: var(--muted-foreground); margin-top: .25rem; }

.searchbar { display: flex; gap: .5rem; }
.searchbar input { height: 3rem; font-size: 1rem; }
.searchbar .btn { height: 3rem; padding-inline: 1.5rem; }

/* ------------------------------------------------------------------ */
/* Tabelle                                                              */
/* ------------------------------------------------------------------ */

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--border); }
th {
  font-family: var(--font-heading);
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  white-space: nowrap;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 600; border-top: 2px solid var(--border); border-bottom: none; }
tr.subtotal td { font-weight: 600; background: var(--muted); }
tr.selected td { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.table-scroll { overflow-x: auto; }

/* ------------------------------------------------------------------ */
/* Badge — `rounded-full border px-2.5 py-0.5 text-xs font-semibold`    */
/* ------------------------------------------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: .125rem .625rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--foreground);
  background: transparent;
}
/* default = blu pieno */
.badge.solid { border-color: transparent; background: var(--primary); color: var(--primary-foreground); }
/* NEW = verde pieno */
.badge.ok { border-color: var(--success); color: var(--success); background: transparent; }
/* Only X left = contorno giallo */
.badge.warn { border-color: var(--secondary); color: var(--secondary); background: transparent; }
/* SALE = rosso pieno */
.badge.bad { border-color: transparent; background: var(--destructive); color: var(--destructive-foreground); }
/* chip selezionata = blu tenue */
.badge.accent { border-color: transparent; background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
/* neutro */
.badge.muted { border-color: var(--border); background: var(--muted); color: var(--muted-foreground); }

/* ------------------------------------------------------------------ */
/* Avvisi, misuratori, stati vuoti                                      */
/* ------------------------------------------------------------------ */

.notice {
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  background: var(--muted);
  border-radius: var(--radius-md);
  padding: .8rem 1rem;
  font-size: .88rem;
  margin-bottom: 1rem;
}
.notice.warn { border-left-color: var(--secondary); }
.notice.bad { border-left-color: var(--destructive); }
.notice strong { font-weight: 600; }

.meter { height: 6px; border-radius: 999px; background: var(--muted); overflow: hidden; margin-top: .4rem; }
.meter > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.meter.over > span { background: var(--destructive); }

.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted-foreground);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ------------------------------------------------------------------ */
/* Prodotti                                                             */
/* ------------------------------------------------------------------ */

.products { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }
.product {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  padding: .9rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.product .title { font-family: var(--font-heading); font-size: 1rem; line-height: 1.25; }
.product .brand { font-size: .78rem; color: var(--muted-foreground); }
.product .price { font-weight: 600; font-variant-numeric: tabular-nums; }
.product .attrs { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .25rem; }
.product .why { font-size: .75rem; color: var(--muted-foreground); margin-top: auto; padding-top: .4rem; }

.attr-list { display: grid; grid-template-columns: auto 1fr; gap: .25rem .8rem; font-size: .87rem; }
.attr-list dt { color: var(--muted-foreground); }
.attr-list dd { margin: 0; font-weight: 500; }

.foot {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: .78rem;
  color: var(--muted-foreground);
  text-align: center;
}


/* --------------------------------------------------------------------------
   Dentro l'iframe dell'admin di Shopify.

   Non è un tema alternativo: sono le due o tre cose che, dentro l'admin,
   sarebbero un doppione o un'indiscrezione. La navigazione la disegna Shopify
   nella barra laterale (e la sua linea guida dice esplicitamente di non
   ripeterla nel corpo della pagina); il vocabolario interno del monorepo non
   riguarda chi usa l'app.

   L'attributo lo mette lo script in testa a base.html, prima del primo paint.
   -------------------------------------------------------------------------- */

.solo-incorporata { display: none; }

:root[data-incorporata] .pillnav,
:root[data-incorporata] .model-label,
:root[data-incorporata] .solo-interna { display: none; }

:root[data-incorporata] .solo-incorporata { display: inline; }

/* Senza la pillnav il titolo resterebbe attaccato al wordmark. */
:root[data-incorporata] .page-title { margin-top: 1.2rem; }
