/* ===========================================================================
   TCG Vault — LAYOUT (shell mobile-first, en-tête, grille, vues)
   =========================================================================== */

/* Shell : colonne-téléphone centrée sur grand écran */
.app {
  position: relative;
  width: 100%; max-width: var(--app-max);
  height: 100%; overflow: hidden; margin: 0 auto;
  background: var(--c-bg);
  display: flex; flex-direction: column;
  box-shadow: 0 0 0 1px var(--c-line), 0 30px 80px rgba(40,30,15,.12);
}

/* En-tête collant */
.app-header {
  position: sticky; top: 0; z-index: var(--z-header);
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: var(--header-h); padding: calc(var(--sp-2) + var(--safe-top)) var(--sp-4) var(--sp-2);
  background: color-mix(in srgb, var(--c-bg) 90%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1.5px solid var(--c-line-2);
}
.app-header .brand { flex: 1; }
.header-actions { display: flex; gap: var(--sp-2); }
.app-header.is-searching .brand,
.app-header.is-searching .header-actions .icon-btn[data-action="scan"] { display: none; }

/* Contenu défilant (seule zone qui scroll ; header et nav restent fixes) */
.app-main {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: var(--sp-4) var(--sp-4) var(--sp-6);
}

/* Rangées d'onglets / stats / filtres */
.tabs { margin-bottom: var(--sp-3); }
.stats { margin-bottom: var(--sp-3); display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.stats .kpi { min-width: 0; }
.toolbar { margin-bottom: var(--sp-4); }

/* Titre de section */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--sp-3); }
.section-head h2 { font-size: var(--fs-18); text-transform: uppercase; letter-spacing: .02em; }
.section-head h2 span { color: var(--c-brand); }
.section-head .sort { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--c-ink-3); }

/* Grille de cartes : 2 colonnes mobile, s'élargit ensuite */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
@media (min-width: 540px) { .grid { grid-template-columns: repeat(3, 1fr); } }

/* Barre de navigation basse */
.app-nav {
  position: sticky; bottom: 0; z-index: var(--z-nav);
  display: flex; align-items: stretch; justify-content: space-between;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding: 0 var(--sp-4) var(--safe-bottom);
  background: color-mix(in srgb, var(--c-surface) 94%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  border-top: 1px solid var(--c-line-2);
}
.navitem {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 56px; justify-content: center;
  color: var(--c-ink-3); font-size: 9px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
}
.navitem svg { width: 22px; height: 22px; }
.navitem.is-active { color: var(--c-ink); }
.navitem.is-active::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 3px; border-radius: 0 0 2px 2px; background: var(--c-ink);
}
.navitem--fab { color: var(--c-on-ink); }
.navitem--fab > span:last-child { margin-top: -8px; }

/* Vue générique + état vide (placeholders Sets/Profil) */
.view-empty {
  display: grid; place-items: center; text-align: center; gap: var(--sp-3);
  min-height: 50vh; color: var(--c-ink-3); padding: var(--sp-6);
}
.view-empty h2 { font-size: var(--fs-22); color: var(--c-ink-2); text-transform: uppercase; }
.view-empty p { max-width: 32ch; }

/* Vue Valeur : récap stats agrandi */
.value-hero { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-lg);
  padding: var(--sp-6); box-shadow: var(--shadow-1); margin-bottom: var(--sp-4); text-align: center; }
.value-hero .big { font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-28); color: var(--accent, var(--c-value)); }

/* Bandeau « registre certifié » (bas de la collection) */
.reg-footer {
  margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--c-line);
  text-align: center; font-family: var(--font-mono); font-size: 9px; line-height: 1.9;
  letter-spacing: .08em; text-transform: uppercase; color: var(--c-ink-3);
}
.value-list { display: grid; gap: var(--sp-2); }
.value-row { display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); background: var(--c-surface); border: 1px solid var(--c-line);
  border-left: 3px solid var(--accent, var(--c-line-2)); border-radius: var(--r-md); }
.value-row > span:first-child { flex: 1; }
.value-row .mono { font-weight: 700; }
.value-row__share { color: var(--c-ink-3); font-weight: 600; }

/* ---- Détail de carte (dans la bottom-sheet) ---- */
.detail__card { position: relative; border-radius: var(--r-md); overflow: hidden;
  border: 1px solid var(--c-line); border-left: 3px solid var(--accent); box-shadow: var(--shadow-1); margin-bottom: var(--sp-4); }
.detail__art { aspect-ratio: 3 / 2.1; display: grid; place-items: center; position: relative;
  background: radial-gradient(120% 90% at 50% 25%, color-mix(in srgb, var(--accent) 24%, var(--c-surface)), var(--c-surface) 72%); }
.detail__art .card__glyph { font-size: 44px; }
.detail__fields { display: grid; gap: 0; }
.detail__field { display: flex; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-3) 0; border-bottom: 1px solid var(--c-line); }
.detail__field:last-child { border-bottom: none; }
.detail__field .k { color: var(--c-ink-3); }
.detail__field .v { font-family: var(--font-mono); font-weight: 600; text-align: right; }
