/* ============================================================================
 * odc-app.css — Shell dell'app (index.html)
 * ============================================================================
 *
 * Restyle 2026-07 in linea col design dell'ingresso (odc-entry.css) ma
 * TEMATIZZATO: qui i colori derivano da --primary (= --tm-primary-color del
 * torneo corrente, definito da tm-theme.css che viene incluso DOPO questo
 * file e ridefinisce i token --bg/--card/--stroke/--muted...).
 *
 * ATTENZIONE: index-tabs.js genera DOM usando queste classi — i nomi NON
 * vanno cambiati (round-card, match-row, standings-*, pill-*, more-*, ...).
 * ========================================================================= */

:root {
  /* Phase 3c — colore primario branded dal torneo corrente. */
  --tm-primary-color: #667eea;
  --primary: var(--tm-primary-color, #667eea);
  --secondary: #764ba2;
  --bg: #0b0f16;
  --card: rgba(255, 255, 255, 0.06);
  --stroke: rgba(255, 255, 255, 0.1);
  --muted: rgba(255, 255, 255, 0.72);
  --muted-2: rgba(255, 255, 255, 0.5);
  --shadow: 0 14px 46px rgba(0, 0, 0, 0.35);
  --r-lg: 22px;
  --r-md: 16px;
  --font-display: "Barlow Condensed", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: #fff;
  margin: 0;
}

.page {
  min-height: 100vh;
  background:
    radial-gradient(1100px 700px at 25% 0%, color-mix(in oklab, var(--primary) 26%, transparent), transparent 68%),
    radial-gradient(1000px 650px at 105% 45%, color-mix(in oklab, var(--secondary) 16%, transparent), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0));
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.wrap {
  width: 100%;
  max-width: 1200px;
  padding: 18px 14px 110px;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 2px 2px 8px;
}

.logo {
  width: 54px;
  height: 54px;
  border-radius: 17px;
  background: linear-gradient(140deg, color-mix(in oklab, var(--primary) 90%, white), color-mix(in oklab, var(--primary) 62%, black));
  border: 1px solid color-mix(in oklab, var(--primary) 40%, rgba(255, 255, 255, 0.14));
  box-shadow: 0 14px 36px color-mix(in oklab, var(--primary) 30%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.logo img {
  width: 74%;
  height: 74%;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.35));
}

.head-title {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 28px;
  line-height: 0.95;
  letter-spacing: 0.01em;
}

.head-subtitle {
  margin-top: 4px;
  color: color-mix(in oklab, var(--primary) 55%, #fff);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

/* ── Screens ────────────────────────────────────────────────────────────── */

.screen {
  display: none;
  min-height: calc(100vh - 195px);
}

.screen.active {
  display: block;
  animation: screenIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Toolbar partite ────────────────────────────────────────────────────── */

.matches-toolbar {
  position: sticky;
  top: 8px;
  z-index: 15;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(8, 12, 20, 0.82);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.045);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.search-wrap:focus-within {
  border-color: color-mix(in oklab, var(--primary) 55%, transparent);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 14%, transparent);
}

.search-wrap i {
  font-size: 13px;
  color: var(--muted-2);
}

.search-wrap input {
  border: none;
  outline: none;
  width: 100%;
  background: transparent;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.search-wrap input::placeholder {
  color: rgba(255, 255, 255, 0.5);
  font-weight: 650;
}

.rules-link {
  width: fit-content;
  color: rgba(255, 255, 255, 0.84);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 700;
  font-size: 12px;
}

.rules-link:hover { color: #fff; }

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

/* ── Pill (filtri fase / edizione) ──────────────────────────────────────── */

.pill-tabs,
.edition-pills {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
}

.pill-tabs::-webkit-scrollbar,
.edition-pills::-webkit-scrollbar { display: none; }

.pill-btn,
.edition-pill {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.18s ease;
}

.pill-btn:hover,
.edition-pill:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: translateY(-1px);
}

.pill-btn.active,
.edition-pill.active {
  color: var(--on-primary, #fff);
  border-color: color-mix(in oklab, var(--primary) 70%, white);
  background: linear-gradient(135deg, color-mix(in oklab, var(--primary) 92%, white), color-mix(in oklab, var(--primary) 80%, black));
  box-shadow: 0 8px 22px color-mix(in oklab, var(--primary) 30%, transparent);
}

/* ── Card giornata + righe partita ──────────────────────────────────────── */

.round-card {
  margin-bottom: 12px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.round-header {
  width: 100%;
  border: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
}

.round-title {
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 17px;
  letter-spacing: 0.02em;
}

.round-subtitle {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.round-chevron {
  color: var(--muted-2);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.round-card.collapsed .round-chevron { transform: rotate(-90deg); }

.round-content {
  padding: 10px;
  display: grid;
  gap: 8px;
}

.round-card.collapsed .round-content { display: none; }

.match-row {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  text-align: left;
  padding: 12px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.match-row:hover {
  border-color: color-mix(in oklab, var(--primary) 40%, rgba(255, 255, 255, 0.2));
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3);
}

.match-main {
  min-width: 0;
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex: 1;
}

.field-badge {
  min-width: 64px;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  color: color-mix(in oklab, var(--primary) 30%, #fff);
  background: color-mix(in oklab, var(--primary) 22%, transparent);
  border: 1px solid color-mix(in oklab, var(--primary) 40%, transparent);
  border-radius: 999px;
  padding: 5px 10px;
  text-transform: uppercase;
  align-self: center;
  flex-shrink: 0;
}

.teams-stack {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 8px;
  border-left: 2px solid color-mix(in oklab, var(--primary) 45%, rgba(255, 255, 255, 0.14));
  padding-left: 10px;
}

.team-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.team-line img {
  width: 22px;
  height: 22px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  flex-shrink: 0;
}

.team-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.match-side {
  min-width: 68px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
  text-align: right;
}

.match-primary {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.match-secondary {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.match-secondary.not-started { color: #d1d5db; }

.match-secondary.live {
  color: #fca5a5;
  animation: livePulse 1.6s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  55%      { opacity: 0.55; }
}

.match-secondary.finished { color: #86efac; }

.empty-card {
  border-radius: var(--r-md);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  padding: 14px 12px;
}

/* ── Classifica ─────────────────────────────────────────────────────────── */

.standings-wrap {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: #fff;
}

.standings-table th,
.standings-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  white-space: nowrap;
}

.standings-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.03);
  position: sticky;
  top: 0;
  z-index: 1;
}

.standings-table tbody tr {
  transition: background 0.15s ease;
}

.standings-table tbody tr:hover {
  background: color-mix(in oklab, var(--primary) 8%, transparent);
}

.standings-table th.num,
.standings-table td.num {
  text-align: center;
  width: 56px;
}

.standings-table td.rank {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 15px;
  width: 46px;
  text-align: center;
}

.standings-team {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.standings-team img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.22);
  flex-shrink: 0;
}

.standings-team span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

/* ── Head to head ───────────────────────────────────────────────────────── */

.h2h-list { display: grid; gap: 10px; }

.h2h-card {
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 12px;
}

.h2h-title {
  margin: 0;
  font-size: 14px;
  font-weight: 850;
  letter-spacing: -0.2px;
}

.h2h-meta {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.h2h-pill {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  padding: 5px 10px;
}

.teams-frame {
  width: 100%;
  min-height: calc(100vh - 205px);
  border: none;
  display: block;
  background: transparent;
}

/* ── Notifiche ──────────────────────────────────────────────────────────── */

.notice-card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.notice-top {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.notice-title {
  margin: 0;
  font-size: 15px;
  font-weight: 850;
  letter-spacing: -0.2px;
}

.notice-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.switch {
  position: relative;
  width: 52px;
  height: 30px;
  flex-shrink: 0;
  display: inline-block;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: 0.2s ease;
  cursor: pointer;
}

.slider::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}

.switch input:checked + .slider {
  background: color-mix(in oklab, var(--primary) 55%, transparent);
  border-color: color-mix(in oklab, var(--primary) 65%, white);
}

.switch input:checked + .slider::before {
  transform: translateX(22px);
}

.permission-label {
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 700;
}

.notif-list { display: grid; gap: 8px; }

.notif-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 11px 12px;
}

.notif-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 6px;
}

.notif-title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

.notif-date {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.notif-body {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  font-weight: 650;
}

/* ── Menu profilo ───────────────────────────────────────────────────────── */

.more-menu { display: grid; gap: 10px; }

.more-item {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
  padding: 13px 12px;
  border-radius: var(--r-md);
  background: var(--card);
  border: 1px solid var(--stroke);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.22);
  transition: all 0.18s ease;
}

.more-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: color-mix(in oklab, var(--primary) 35%, rgba(255, 255, 255, 0.2));
  transform: translateY(-1px);
}

.more-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in oklab, var(--primary) 16%, rgba(255, 255, 255, 0.05));
  border: 1px solid color-mix(in oklab, var(--primary) 26%, rgba(255, 255, 255, 0.1));
  color: color-mix(in oklab, var(--primary) 42%, #fff);
  flex-shrink: 0;
  font-size: 15px;
}

.more-title {
  margin: 0;
  font-size: 14px;
  font-weight: 850;
  letter-spacing: -0.2px;
}

.more-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 650;
}

.more-chevron {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 13px;
  flex-shrink: 0;
}

/* ── Tabbar ─────────────────────────────────────────────────────────────── */

.tabbar-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  padding: 0 10px calc(10px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}

.tabbar {
  max-width: 920px;
  margin: 0 auto;
  background: rgba(9, 13, 20, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  pointer-events: auto;
  overflow: hidden;
}

.tab-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2px;
  padding: 10px 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: 0.2s ease;
  /* Margin così l'active highlight ha "aria" attorno ai 4 angoli
     invece di riempire fino ai bordi retti della tabbar. */
  margin: 6px 4px;
  border-radius: 15px;
}

.tab-btn i { font-size: 15px; transition: transform 0.2s ease; }

.tab-btn.active {
  color: color-mix(in oklab, var(--primary) 45%, #fff);
  background: color-mix(in oklab, var(--primary) 16%, rgba(255, 255, 255, 0.05));
  border-radius: 15px;
}

.tab-btn.active i { transform: translateY(-1px); }

.tab-btn:active { transform: scale(0.96); }

/* ── PWA install card ───────────────────────────────────────────────────── */

.pwa-card {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 86px;
  max-width: 560px;
  margin: 0 auto;
  background: rgba(10, 14, 22, 0.96);
  backdrop-filter: blur(18px);
  border-radius: 20px;
  padding: 12px;
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.5);
  z-index: 1001;
  transform: translateY(150%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.pwa-card.show { transform: translateY(0); }

.pwa-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pwa-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 26px color-mix(in oklab, var(--primary) 18%, transparent);
}

.pwa-text { flex: 1; min-width: 0; }

.pwa-title {
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  margin: 0 0 2px;
  line-height: 1.25;
}

.pwa-description {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  margin: 0;
}

.pwa-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.pwa-btn {
  border-radius: 14px;
  font-weight: 900;
  font-size: 12px;
  border: none;
  cursor: pointer;
  transition: 0.18s ease;
  white-space: nowrap;
  user-select: none;
}

.pwa-btn-install {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
}

.pwa-btn-install:hover { transform: translateY(-1px); }

.pwa-btn-close {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pwa-btn-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: translateY(-1px);
}

.pwa-instructions {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.pwa-instructions p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 650;
  margin: 0;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 820px) {
  .wrap { max-width: 100%; }
  .tabbar { max-width: 100%; }
}

@media (max-width: 520px) {
  .head-title { font-size: 25px; }

  .logo {
    width: 48px;
    height: 48px;
  }

  .match-row { align-items: flex-start; }

  .match-main {
    flex-direction: column;
    gap: 8px;
  }

  .field-badge {
    align-self: flex-start;
    min-width: 56px;
  }

  .match-side { min-width: 56px; }

  .standings-table { font-size: 12px; }

  .standings-table th,
  .standings-table td { padding: 9px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .screen.active,
  .match-secondary.live { animation: none !important; }
}
