/* ===========================================================================
   TWIZA FANTACALCIO — V2 "STRATEGY ROOM" UI LAYER
   Intento: foglio di stile additivo, caricato DOPO il CSS inline corrente.
   Vincolo tipografico: ogni testo usa Titillium Web; fanno eccezione soltanto
   gli elementi che ospitano il logo grafico ufficiale (immagine/wordmark).
   =========================================================================== */

@font-face {
  font-family: "Titillium Web";
  src: url("/fonts/TitilliumWeb-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Titillium Web";
  src: url("/fonts/TitilliumWeb-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Titillium Web";
  src: url("/fonts/TitilliumWeb-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Typography — no monospace outside the official logo asset. */
  --f: "Titillium Web", Arial, sans-serif;
  --fm: "Titillium Web", Arial, sans-serif;
  --fb: "Titillium Web", Arial, sans-serif;

  /* Core colour tokens. */
  --fc-black: #050806;
  --fc-deep: #07100b;
  --fc-panel: rgba(11, 23, 16, .82);
  --fc-panel-strong: rgba(9, 19, 13, .94);
  --fc-inset: rgba(2, 8, 5, .72);
  --fc-line: rgba(137, 190, 153, .28);
  --fc-line-strong: rgba(148, 229, 174, .54);
  --fc-text: #f5f8f6;
  --fc-text-muted: #c4d3ca;
  --fc-text-dim: #90a799;
  --fc-green: #45d984;
  --fc-green-intense: #9aff4b;
  --fc-green-deep: #137a47;
  --fc-gold: #f5cf68;
  --fc-info: #74d4ff;
  --fc-danger: #ff7d6a;
  --fc-success: #6de5a1;

  --bg: var(--fc-deep);
  --bg2: #0c1b12;
  --panel: var(--fc-panel);
  --panel2: rgba(18, 38, 27, .86);
  --inset: var(--fc-inset);
  --line: var(--fc-line);
  --line2: var(--fc-line-strong);
  --text: var(--fc-text);
  --muted: var(--fc-text-muted);
  --faint: var(--fc-text-dim);
  --pitch: var(--fc-green);
  --pitch-d: var(--fc-green-deep);
  --pitch-deep: #0b6037;
  --neon: var(--fc-green-intense);
  --gold: var(--fc-gold);
  --gold-d: #ae7e16;
  --crit: var(--fc-danger);
  --good: var(--fc-success);
  --info: var(--fc-info);

  --fc-r-xs: 8px;
  --fc-r-sm: 12px;
  --fc-r-md: 18px;
  --fc-r-lg: 26px;
  --fc-glass: blur(24px) saturate(1.25);
  --fc-shadow: 0 18px 50px rgba(0, 0, 0, .48);
  --fc-glow: 0 0 0 1px rgba(69, 217, 132, .20), 0 0 28px rgba(69, 217, 132, .14);
  --fc-gold-glow: 0 0 0 1px rgba(245, 207, 104, .36), 0 0 28px rgba(245, 207, 104, .17);
  --fc-ease: cubic-bezier(.2, .8, .2, 1);
}

/* ---------------------------------------------------------------------------
   1. Typography, legibility and accessibility.
   --------------------------------------------------------------------------- */
html,
body,
button,
input,
select,
textarea,
table,
.mono,
.tnum,
.credits,
.kpi-value,
.bspent,
.brephd,
.faint,
.msg,
.wm,
.sb-title,
.sb-badge,
.nav-label,
.badge,
* {
  font-family: var(--f) !important;
}

/* The image itself is the logo; do not force a font inside it. */
.logobadge img,
.logo img,
.sb-logo img,
[data-brand-logo] img {
  font-family: initial !important;
}

body {
  color: var(--fc-text);
  font-size: 16px;
  line-height: 1.5;
  background-color: var(--fc-black);
  background-image:
    linear-gradient(180deg, rgba(5, 8, 6, .48) 0%, rgba(5, 8, 6, .93) 72%, rgba(5, 8, 6, .99) 100%),
    url("/assets/ui/bg_app_stadium.jpg");
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Admin page applies the dedicated net image while preserving the shell. */
body.admin,
body:has(#shell .sidebar) {
  background-image:
    linear-gradient(90deg, rgba(5, 8, 6, .88), rgba(5, 8, 6, .63)),
    url("/assets/ui/bg_admin_net.jpg");
}

/* Numeric column alignment remains stable, without a monospace typeface. */
.tnum,
.mono,
.kpi-value,
.credits .v,
.bspent,
.brephd,
th,
.badge,
.nav-label {
  font-family: var(--f) !important;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: .015em;
}

h1, h2, h3, h4,
.wm,
.sb-title {
  color: var(--fc-text);
  font-family: var(--f) !important;
}
h1 { font-size: clamp(38px, 5vw, 64px); line-height: .98; letter-spacing: -.025em; }
h2 { font-size: clamp(24px, 2.4vw, 32px); line-height: 1.1; font-weight: 700; }
h3 { font-size: 20px; line-height: 1.2; font-weight: 700; }
label,
.faint,
.msg { font-size: 14px; }

/* Focal keyboard ring: visibly distinct from the green active state. */
:where(button, input, select, textarea, a):focus-visible {
  outline: 3px solid var(--fc-gold) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 7px rgba(245, 207, 104, .17) !important;
}

/* ---------------------------------------------------------------------------
   2. Full-bleed shell and navigation.
   --------------------------------------------------------------------------- */
.top,
.topbar {
  min-height: var(--topbar-h, 76px);
  padding: 8px clamp(18px, 3vw, 42px);
  background: rgba(5, 8, 6, .65);
  border-color: var(--fc-line);
  -webkit-backdrop-filter: var(--fc-glass);
  backdrop-filter: var(--fc-glass);
  position: sticky;
  top: 0;
  z-index: 40;
}
.top::after {
  height: 3px;
  opacity: 1;
  background: linear-gradient(90deg, transparent, var(--fc-green) 35%, var(--fc-gold) 62%, transparent);
}
.top .wm {
  font-size: clamp(20px, 2vw, 25px);
  font-weight: 700;
  letter-spacing: -.01em;
}

nav.tabs {
  top: var(--topbar-h, 76px);
  padding: 13px clamp(18px, 3vw, 42px);
  background: rgba(5, 8, 6, .52);
  border-bottom: 1px solid var(--fc-line);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
  gap: 9px;
}
nav.tabs button {
  min-height: 42px;
  padding: 10px 17px;
  color: var(--fc-text-muted);
  font-size: 16px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid transparent;
}
nav.tabs button:hover {
  color: var(--fc-text);
  background: rgba(255, 255, 255, .075);
  border-color: rgba(255, 255, 255, .11);
}
nav.tabs button.on {
  color: #04110a;
  background: linear-gradient(135deg, var(--fc-green-intense), var(--fc-green));
  box-shadow: var(--fc-glow), inset 0 1px 0 rgba(255,255,255,.4);
}

.wrap {
  max-width: 1440px;
  padding: clamp(26px, 4vw, 52px) clamp(18px, 3vw, 44px) 96px;
}

/* ---------------------------------------------------------------------------
   3. Cards, CTA and input controls.
   --------------------------------------------------------------------------- */
.card,
.sec,
.bcol,
.kpi,
.login .card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    linear-gradient(132deg, rgba(255,255,255,.065), rgba(255,255,255,0) 28%),
    linear-gradient(180deg, rgba(18, 36, 26, .88), rgba(6, 14, 9, .89));
  border: 1px solid var(--fc-line);
  border-radius: var(--fc-r-lg);
  box-shadow: var(--fc-shadow), inset 0 1px 0 rgba(255,255,255,.07);
  -webkit-backdrop-filter: var(--fc-glass);
  backdrop-filter: var(--fc-glass);
}
.card::before,
.sec::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  opacity: .94;
  background: linear-gradient(90deg, transparent 2%, var(--fc-green) 37%, var(--fc-gold) 61%, transparent 98%);
}
.card:hover,
.sec:hover {
  border-color: var(--fc-line-strong);
}

input,
select,
textarea {
  min-height: 46px;
  padding: 11px 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--fc-text);
  background: rgba(1, 7, 4, .70);
  border: 1px solid rgba(145, 211, 164, .36);
  border-radius: var(--fc-r-sm);
}
input::placeholder { color: #a4b8a9; opacity: 1; }
input:hover,
select:hover,
textarea:hover { border-color: var(--fc-green); }
input:focus,
select:focus,
textarea:focus {
  border-color: var(--fc-green);
  box-shadow: 0 0 0 4px rgba(69, 217, 132, .18);
}

.btn,
button.btn,
button:not(.nav-item):not(.nav-tab) {
  min-height: 44px;
  padding: 10px 18px;
  color: #041009;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--fc-green-intense), var(--fc-green));
  border-radius: var(--fc-r-sm);
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: var(--fc-glow), inset 0 1px 0 rgba(255,255,255,.42);
}
.btn:hover,
button.btn:hover,
button:not(.nav-item):not(.nav-tab):hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}
.btn.ghost,
button.ghost,
button.btn.ghost {
  color: var(--fc-text);
  background: rgba(255,255,255,.055);
  border-color: rgba(176, 220, 190, .35);
  box-shadow: none;
}
.btn.ghost:hover,
button.ghost:hover,
button.btn.ghost:hover {
  color: var(--fc-green-intense);
  border-color: var(--fc-green);
  background: rgba(69, 217, 132, .12);
}

/* ---------------------------------------------------------------------------
   4. Information hierarchy: KPI, status, tables and auction targets.
   --------------------------------------------------------------------------- */
.credits,
.kpi,
.kpi-card {
  padding: 17px 20px;
  background: linear-gradient(135deg, rgba(75, 53, 5, .86), rgba(21, 16, 3, .92));
  border-color: rgba(245, 207, 104, .70);
  box-shadow: var(--fc-gold-glow);
}
.credits .l,
.kpi .l,
.kpi-label {
  margin-bottom: 6px;
  color: var(--fc-text-muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.credits .v,
.kpi .n,
.kpi-value {
  color: var(--fc-gold);
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 700;
  line-height: .9;
  text-shadow: 0 0 14px rgba(245, 207, 104, .3);
}

.msg,
.msg.ok,
.msg.err {
  padding: 11px 13px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--fc-r-xs);
}
.msg.ok { color: #d9ffe7; background: rgba(109, 229, 161, .14); border: 1px solid rgba(109, 229, 161, .35); }
.msg.err { color: #ffe1dc; background: rgba(255, 125, 106, .13); border: 1px solid rgba(255, 125, 106, .34); }

.table-scroll { overflow: auto; border: 1px solid var(--fc-line); border-radius: var(--fc-r-md); }
table { color: var(--fc-text); font-size: 15.5px; }
/* Le intestazioni restano sticky solo dentro un loro viewport di scorrimento.
   Applicarle a ogni tabella le sganciava dalla card amministrativa e le sovrapponeva alle righe. */
.table-scroll th,
#root #playersTbl th {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 15px 14px;
  color: var(--fc-text-muted);
  background: #0e1f15;
  border-bottom: 1px solid var(--fc-line-strong);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
td { padding: 15px 14px; border-bottom-color: rgba(170, 221, 187, .13); }
tbody tr:hover { background: linear-gradient(90deg, rgba(69,217,132,.13), transparent 78%); }

.rb,
.role-badge {
  width: 23px;
  height: 23px;
  border-radius: 7px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.32), 0 3px 8px rgba(0,0,0,.25);
}

.tgt {
  min-height: 72px;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: var(--fc-r-sm);
}
.tgt:hover {
  transform: translateX(4px);
  border-color: rgba(69,217,132,.43);
  background: linear-gradient(90deg, rgba(69,217,132,.16), rgba(69,217,132,.01) 76%);
}
.tgt .nm { font-size: 17px; font-weight: 700; }
.tgt .pr { color: var(--fc-gold); font-size: 15px; font-weight: 700; }

/* ---------------------------------------------------------------------------
   5. Rich visual moments: auction, formation, agent and cards.
   --------------------------------------------------------------------------- */
/* Add `data-scene="auction"` to the Asta/board parent card. */
[data-scene="auction"] {
  background-image:
    linear-gradient(90deg, rgba(6, 13, 9, .90) 0%, rgba(6,13,9,.50) 72%, rgba(6,13,9,.88) 100%),
    url("/assets/ui/bg_auction_spotlight.jpg");
  background-size: cover;
  background-position: center;
}
/* Add `data-scene="formation"` to the formation card or parent. */
[data-scene="formation"],
.pitch {
  background-image:
    linear-gradient(180deg, rgba(4, 15, 9, .18), rgba(4, 15, 9, .62)),
    url("/assets/ui/bg_formation_pitch.jpg");
  background-size: cover;
  background-position: center;
}
.pitch {
  min-height: 550px;
  max-width: 600px;
  border: 1px solid rgba(142, 238, 170, .62);
  border-radius: var(--fc-r-lg);
  box-shadow: inset 0 0 68px rgba(0,0,0,.48), 0 22px 42px rgba(0,0,0,.34), var(--fc-glow);
}
.pitch::after {
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0,0,0,.38) 100%);
}

.player-face,
.plr .sh {
  width: 58px;
  height: 66px;
  clip-path: polygon(50% 0%, 95% 15%, 95% 70%, 50% 100%, 5% 70%, 5% 15%);
  background: linear-gradient(145deg, #244d38, #061008);
  box-shadow: 0 0 0 2px var(--fc-green), 0 7px 16px rgba(0,0,0,.48), 0 0 18px rgba(69,217,132,.18);
}
.player-face.gk,
.plr.gk .sh { box-shadow: 0 0 0 2px var(--fc-gold), 0 7px 16px rgba(0,0,0,.48), 0 0 18px rgba(245,207,104,.18); }
.plr { width: 95px; }
.plr .nm { font-size: 13px; font-weight: 700; }
.plr .pv { color: var(--fc-green-intense); font-weight: 700; font-size: 14px; text-shadow: 0 0 9px rgba(154,255,75,.32); }

.agentbox {
  border-left: 4px solid var(--fc-green-intense);
  border-radius: var(--fc-r-md);
  color: var(--fc-text);
  background: linear-gradient(90deg, rgba(69,217,132,.18), rgba(4,12,7,.5) 55%);
}
.seg {
  gap: 7px;
  padding: 5px;
  border-radius: 14px;
  background: rgba(1, 7, 4, .68);
  border-color: var(--fc-line);
}
.seg button { min-height: 42px; border-radius: 9px; color: var(--fc-text-muted); background: transparent; box-shadow: none; }
.seg button.on { color: #041009; background: linear-gradient(135deg, var(--fc-green-intense), var(--fc-green)); box-shadow: var(--fc-glow); }

/* ---------------------------------------------------------------------------
   6. Admin shell and data operations.
   --------------------------------------------------------------------------- */
.sidebar {
  width: 280px;
  min-width: 280px;
  background: rgba(5, 8, 6, .78);
  border-color: var(--fc-line);
  -webkit-backdrop-filter: var(--fc-glass);
  backdrop-filter: var(--fc-glass);
}
.sb-head { padding: 22px 20px 18px; border-color: var(--fc-line); }
.sb-title { font-size: 20px; font-weight: 700; }
.sb-badge { color: var(--fc-green-intense); font-size: 12px; font-weight: 700; }
.nav-label { padding: 16px 10px 7px; color: var(--fc-text-dim); font-size: 12px; font-weight: 700; }
.nav-item {
  padding: 11px 12px;
  color: var(--fc-text-muted);
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--fc-r-xs);
}
.nav-item:hover { color: var(--fc-text); background: rgba(255,255,255,.07); }
.nav-item.active { color: var(--fc-green-intense); background: rgba(69,217,132,.16); }
.nav-item.active::before { width: 4px; background: var(--fc-green-intense); box-shadow: 0 0 12px rgba(69,217,132,.55); }
.main .content { padding: clamp(24px, 4vw, 48px); }
.sec { padding: clamp(22px, 3vw, 34px); }
.badge { padding: 5px 10px; font-size: 12px; font-weight: 700; }

/* ---------------------------------------------------------------------------
   7. Motion and responsive safety.
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .card,
  .sec,
  .tgt,
  .plr,
  .btn,
  nav.tabs button,
  .nav-item,
  .player-face {
    transition: transform 180ms var(--fc-ease), box-shadow 180ms var(--fc-ease), border-color 180ms var(--fc-ease), background-color 180ms var(--fc-ease), filter 180ms var(--fc-ease);
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
@media (max-width: 900px) {
  body { background-attachment: scroll; }
  .top,
  .topbar { min-height: 64px; padding-inline: 16px; }
  nav.tabs { top: 64px; padding-inline: 16px; }
  nav.tabs button { font-size: 15px; min-height: 40px; }
  .wrap { padding: 22px 16px 76px; }
  .card,
  .sec { border-radius: var(--fc-r-md); }
  .pitch { min-height: 470px; }
  th { top: 116px; }
}
@media (max-width: 620px) {
  h1 { font-size: 38px; }
  h2 { font-size: 25px; }
  body { font-size: 16px; }
  .credits .v,
  .kpi .n,
  .kpi-value { font-size: 34px; }
  .hide-mobile { display: none !important; }
  td, th { padding: 13px 11px; }
  .pitch { min-height: 420px; }
}
@media (forced-colors: active) {
  .card,
  .sec,
  input,
  select,
  .btn,
  .nav-item { forced-color-adjust: auto; border: 1px solid CanvasText; }
}

/* End of V2 UI layer. */
