/* ==========================================================
   DESIGN TOKENS
   ========================================================== */
:root {
    --c-ink:        #16171B;   /* nero neutro - header, hero, tabelloni */
    --c-ink-2:      #202226;   /* pannelli scuri secondari */
    --c-accent:     #C1272D;   /* rosso Indomabili - accento primario del brand */
    --c-accent-dark:#9C1F24;
    --c-success:    #1E8E56;   /* verde - solo stato "Giocata" (semantico, non brand) */
    --c-amber:      #F4B400;   /* oro - badge, evidenze secondarie */
    --c-red:        #D64545;   /* errori form */
    --c-paper:      #F3F5F8;   /* sfondo pagina */
    --c-line:       #E7E9EE;
    --c-text:       #16202E;
    --c-text-soft:  #6B7280;
    --c-white:      #FFFFFF;

    --f-display: 'Oswald', Impact, 'Arial Narrow', sans-serif;
    --f-body: 'Inter', 'Segoe UI', Arial, sans-serif;

    --r-lg: 20px;
    --r-md: 14px;
    --r-sm: 10px;
    --r-pill: 999px;

    --shadow-sm: 0 2px 10px rgba(15,17,20,.05);
    --shadow-md: 0 16px 40px rgba(15,17,20,.08);
    --shadow-lg: 0 30px 70px rgba(15,17,20,.13);
    --shadow-accent: 0 10px 24px rgba(193,39,45,.22);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--f-body);
    background: var(--c-paper);
    color: var(--c-text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

img { max-width: 100%; display: block; }

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px;
}

h1, h2, h3 {
    font-family: var(--f-display);
    font-weight: 600;
    line-height: 1.15;
    margin: 0;
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ---------- Badge circolare squadra ---------- */
.badge-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    background: #fff; /* sfondo neutro dietro ai loghi con trasparenza */
    box-shadow: 0 0 0 1.5px rgba(20,22,26,.18);
}
.badge-circle img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* mostra lo stemma intero, senza ritagliarlo */
    box-sizing: border-box;
    padding: 12%;
}
.badge-circle-letter {
    font-family: var(--f-display);
    font-weight: 600;
}

/* ---------- Header ---------- */
.site-header {
    background: var(--c-ink);
    color: #fff;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.site-header .logo {
    font-family: var(--f-display);
    font-size: 1.25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.logo-mark {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--c-accent);
    box-shadow: 0 4px 12px rgba(193,39,45,.45);
    position: relative;
    flex-shrink: 0;
}
.logo-mark::after {
    content: "";
    position: absolute;
    inset: 7px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.75);
}
.logo-word { color: #fff; }
.logo-city { color: var(--c-accent); }
.site-header nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 30px;
    margin: 0;
    padding: 0;
}
.site-header nav a {
    color: #cbd3e0;
    font-weight: 500;
    font-size: .95rem;
    transition: color .15s;
}
.site-header nav a:hover { color: #fff; }
.site-header nav a.nav-admin {
    background: var(--c-accent);
    color: #fff;
    padding: 8px 18px;
    border-radius: var(--r-pill);
    font-weight: 600;
    font-size: .88rem;
    box-shadow: var(--shadow-accent);
}

/* ---------- Hamburger (solo mobile) ---------- */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 5px;
    width: 38px;
    height: 38px;
    padding: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
}
.nav-toggle span {
    display: block;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .2s ease, opacity .15s ease;
}
.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 860px) {
    .nav-toggle { display: flex; }
    .site-header .container { position: relative; }
    .site-header nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--c-ink);
        border-top: 1px solid rgba(255,255,255,.12);
        box-shadow: var(--shadow-lg);
        max-height: calc(100vh - 100%);
        overflow-y: auto;
    }
    .site-header nav.is-open { display: block; }
    .site-header nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px 0;
    }
    .site-header nav ul li a {
        display: block;
        padding: 15px 24px;
        border-bottom: 1px solid rgba(255,255,255,.06);
    }
    .site-header nav ul li a.nav-admin {
        display: inline-block;
        margin: 12px 24px 4px;
        border-bottom: none;
    }
}

/* ---------- Hero ---------- */
/* Foto piena, senza oscuramenti: nessun testo sovrapposto all'immagine. */
.hero {
    position: relative;
    min-height: 80vh;
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

/* Card informativa sotto l'hero: qui vivono eyebrow, titolo e sottotitolo */
.hero-infobar {
    position: relative;
    z-index: 3;
    margin: -60px auto 0;
    max-width: 1040px;
    background: #fff;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: 34px 40px;
    text-align: center;
}
.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--c-paper);
    color: var(--c-ink);
    font-family: var(--f-display);
    font-size: .8rem;
    font-weight: 500;
    letter-spacing: .5px;
    padding: 7px 18px;
    border-radius: var(--r-pill);
    margin-bottom: 18px;
}
.hero-eyebrow::before {
    content: "";
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(193,39,45,.2);
}
.hero-infobar h1 {
    font-size: clamp(2rem, 4.2vw, 3.2rem);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 10px;
    color: var(--c-ink);
}
.hero-infobar .infobar-sub {
    font-size: 1rem;
    color: var(--c-text-soft);
    max-width: 52ch;
    margin: 0 auto;
}

/* ---------- Banner pagine interne (Calendario, Calciatori, Marcatori, Archivio, MatchDay) ---------- */
.page-banner {
    position: relative;
    height: 260px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}
.page-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(22,23,27,.15) 0%, rgba(22,23,27,.75) 100%);
}
.page-banner-inner {
    position: relative;
    z-index: 2;
    width: 100%;
    padding-bottom: 26px;
}
.page-banner h1 {
    color: #fff;
    font-size: clamp(1.6rem, 3.4vw, 2.4rem);
    text-transform: uppercase;
    letter-spacing: .3px;
    margin: 0;
}
.page-banner .page-banner-sub {
    color: rgba(255,255,255,.8);
    font-size: .92rem;
    margin-top: 6px;
}
@media (max-width: 700px) {
    .page-banner { height: 170px; }
}

/* ---------- Sezioni ---------- */
.section { padding: 100px 0; }
.section-title {
    font-size: 1.6rem;
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-title::before {
    content: "";
    width: 8px; height: 26px;
    border-radius: 4px;
    background: var(--c-accent);
    display: inline-block;
}
.grid-2 {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 48px;
    align-items: start;
}
@media (max-width: 800px) {
    .grid-2 { grid-template-columns: 1fr; }
    .hero { min-height: 52vh; }
    .hero-infobar { padding: 24px 22px; border-radius: var(--r-md); margin-top: -40px; }

    /* Calendario / fixture: due righe invece di una sola stipata */
    .fixture-ticket {
        flex-wrap: wrap;
        gap: 8px 14px;
        padding: 16px 18px;
    }
    .fixture-ticket .squadre {
        order: 1;
        width: 100%;
        font-size: .95rem;
    }
    .fixture-ticket .giornata-tag { order: 0; }
    .fixture-ticket .data { order: 2; }

    /* Match ticket (scoreboard) più compatto */
    .match-ticket-team .badge-circle { width: 48px; height: 48px; font-size: 20px; }
    .match-ticket-score { font-size: 2rem; }
    .match-ticket { padding: 22px 16px 18px; }

    /* Scheda calciatore: stat-box su una riga scorrevole invece di 3 colonne strette */
    .player-stats { grid-template-columns: repeat(3, minmax(90px, 1fr)); gap: 8px; }
    .player-stats .stat-box { padding: 12px 8px; }
    .player-stats .stat-box .num { font-size: 1.5rem; }

    .section { padding: 60px 0; }
    .section-title { font-size: 1.3rem; }
}

/* ---------- Card generica ---------- */
.card {
    background: #fff;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: box-shadow .2s, transform .2s;
}
.card-body { padding: 28px; }

/* ---------- Rosa Calciatori (griglia pubblica) ---------- */
.roster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 22px;
    margin-top: 18px;
}
.roster-card {
    background: #fff;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    text-decoration: none;
    color: var(--c-text);
    display: block;
    transition: box-shadow .2s, transform .2s;
}
.roster-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}
.roster-card img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
}
.roster-card-body {
    padding: 14px 16px 18px;
}
.roster-card-name {
    font-family: var(--f-display);
    font-size: 1.05rem;
    text-transform: uppercase;
    margin: 0 0 6px;
}
.roster-card-meta {
    color: var(--c-text-soft);
    font-size: .82rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.roster-card-num {
    background: var(--c-ink);
    color: var(--c-amber);
    font-family: var(--f-display);
    font-size: .78rem;
    padding: 2px 8px;
    border-radius: var(--r-pill);
}
@media (max-width: 480px) {
    .roster-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 14px; }
}

/* ---------- Match ticket (ultima partita / matchday) ---------- */
.match-ticket {
    background: var(--c-ink);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: 30px 28px 24px;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.match-ticket::before {
    content: "";
    position: absolute;
    top: -60px; right: -60px;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(193,39,45,.35), transparent 70%);
}
.match-ticket-teams {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 18px;
    text-align: center;
}
.match-ticket-team { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.match-ticket-team .badge-circle { width: 64px; height: 64px; font-size: 26px; box-shadow: 0 4px 14px rgba(0,0,0,.22), 0 0 0 1.5px rgba(255,255,255,.2); }
.match-ticket-team .name {
    font-family: var(--f-display);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: .3px;
    overflow-wrap: break-word;
}
.match-ticket-score {
    font-family: var(--f-display);
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: 1px;
    white-space: nowrap;
    padding: 0 6px;
}
.match-ticket-meta {
    position: relative;
    text-align: center;
    color: #9aa5b8;
    font-size: .85rem;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(255,255,255,.1);
}
.match-ticket-meta .tag-ft {
    display: inline-block;
    background: var(--c-amber);
    color: #2b2200;
    font-family: var(--f-display);
    font-weight: 600;
    font-size: .72rem;
    letter-spacing: .5px;
    padding: 3px 10px;
    border-radius: var(--r-pill);
    margin-right: 8px;
    vertical-align: middle;
}
.match-ticket-cta { position: relative; text-align: center; margin-top: 20px; }

/* ---------- Video ---------- */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    background: #000;
}
.video-wrapper iframe,
.video-wrapper video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Video caricati da file (non YouTube): mantengono le proporzioni reali
   invece di essere forzati in un riquadro 16:9. Un video verticale da
   telefono resta verticale, senza bande nere ai lati. */
.video-wrapper-native {
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: 480px;
    overflow: hidden;
}
.video-wrapper-native video {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 480px;
}
@media (max-width: 700px) {
    .video-wrapper-native,
    .video-wrapper-native video { max-height: 360px; }
}

/* Variante SOLO per il video del MatchDay: il riquadro si restringe alla
   larghezza reale del video invece di allargarsi su tutta la card.
   Selettore doppio (più specifico) per essere sicuri che vinca sulla
   regola base. Non tocca .video-wrapper-native usata in home. */
/* Card che contiene il video del MatchDay: larghezza fissa generosa
   (come la colonna video in home), invece di stare larga quanto tutta
   la pagina o stringersi al pixel esatto del video. Dentro, il video
   si centra con un po' di nero ai lati se è più stretto della card
   (stesso comportamento della home). */
.card-video-nativo {
    max-width: 560px;
}

/* ---------- Tabelle ---------- */
.table-card {
    background: #fff;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
    overflow-x: auto; /* su schermi piccoli scorre invece di schiacciare le colonne */
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}
th, td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--c-line);
    font-size: .95rem;
}
th {
    background: var(--c-ink);
    color: #fff;
    font-family: var(--f-display);
    font-weight: 500;
    text-transform: uppercase;
    font-size: .78rem;
    letter-spacing: .4px;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfd; }
td .row-team { display: flex; align-items: center; gap: 12px; }

/* ---------- Calendario / Fixture ticket ---------- */
.fixture-ticket {
    display: flex;
    align-items: center;
    gap: 18px;
    background: #fff;
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
    padding: 18px 24px;
    margin-bottom: 16px;
    transition: box-shadow .2s, transform .2s;
}
.fixture-ticket:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.fixture-ticket .giornata-tag {
    font-family: var(--f-display);
    background: var(--c-paper);
    color: var(--c-ink);
    font-size: .72rem;
    letter-spacing: .4px;
    padding: 6px 12px;
    border-radius: var(--r-pill);
    flex-shrink: 0;
}
.fixture-ticket .squadre {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    flex-wrap: wrap;
}
.fixture-ticket .squadre .badge-circle { width: 30px; height: 30px; font-size: 13px; }
.fixture-ticket .risultato {
    font-family: var(--f-display);
    font-size: 1.05rem;
}
.fixture-ticket .data {
    color: var(--c-text-soft);
    font-size: .85rem;
    white-space: nowrap;
}
.badge-giocata {
    color: var(--c-success);
    font-weight: 600;
    font-size: .82rem;
}
.badge-in-programma {
    color: #a3730a;
    font-weight: 600;
    font-size: .82rem;
}

/* ---------- Scheda calciatore ---------- */
.player-card {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 34px;
}
.player-card img {
    width: 100%;
    object-fit: cover;
    aspect-ratio: 3/4;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
}
.player-card h1 {
    font-size: 2rem;
    text-transform: uppercase;
}
.player-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 22px;
}
.player-stats .stat-box {
    background: var(--c-ink);
    color: #fff;
    padding: 20px 14px;
    text-align: center;
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
}
.player-stats .stat-box .num {
    font-family: var(--f-display);
    font-size: 2rem;
    font-weight: 600;
    color: var(--c-amber);
}
.player-stats .stat-box .label {
    font-size: .78rem;
    color: #aab3c2;
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-top: 2px;
}
@media (max-width: 700px) {
    .player-card { grid-template-columns: 1fr; }
}

/* ---------- Footer ---------- */
.site-footer {
    background: var(--c-ink);
    color: #8b93a3;
    text-align: center;
    padding: 40px 0;
    margin-top: 60px;
    font-size: .88rem;
}

/* ---------- Bottoni ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 12px 24px;
    background: var(--c-accent);
    color: #fff;
    font-family: var(--f-display);
    font-size: .9rem;
    letter-spacing: .3px;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    border-radius: var(--r-pill);
    box-shadow: var(--shadow-accent);
    transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:hover { background: var(--c-accent-dark); transform: translateY(-2px); box-shadow: 0 14px 30px rgba(193,39,45,.35); }
.btn-secondary { background: var(--c-ink); box-shadow: var(--shadow-md); }
.btn-secondary:hover { background: #060a14; }
.btn-outline {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.5);
    color: #fff;
    box-shadow: none;
}
.btn-outline:hover { background: #fff; color: var(--c-ink); transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ---------- Form ---------- */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: .92rem;
}
.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #d8dce3;
    border-radius: var(--r-sm);
    font-family: var(--f-body);
    font-size: 1rem;
    background: #fff;
}
.form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px rgba(193,39,45,.15);
}
.form-group input[type="checkbox"],
.form-group input[type="radio"] {
    width: auto;
    margin-right: 6px;
    vertical-align: middle;
}
.alert {
    padding: 13px 18px;
    margin-bottom: 20px;
    border-radius: var(--r-sm);
    font-size: .95rem;
}
.alert-success { background: #e6f5ec; color: #1e6b2c; }
.alert-error { background: #fbe9e9; color: #a5241f; }

/* ---------- Admin layout ---------- */
.admin-wrapper { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 240px;
    background: var(--c-ink);
    color: #fff;
    padding: 20px 0;
    flex-shrink: 0;
}
.admin-sidebar h2 {
    font-size: 1rem;
    text-transform: uppercase;
    padding: 0 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.15);
    margin: 0 0 16px;
}
.admin-sidebar a {
    display: block;
    padding: 10px 20px;
    color: #b7c0d1;
    font-size: .93rem;
    border-left: 3px solid transparent;
}
.admin-sidebar a:hover,
.admin-sidebar a.active {
    background: rgba(255,255,255,.06);
    color: #fff;
    border-left-color: var(--c-accent);
}
.admin-content {
    flex: 1;
    padding: 32px;
    max-width: 1100px;
}
.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 26px;
}
.admin-topbar h1 { font-size: 1.5rem; text-transform: uppercase; }
.table-actions a { margin-right: 10px; font-size: .88rem; color: var(--c-accent-dark); font-weight: 600; }
.login-box {
    max-width: 380px;
    margin: 90px auto;
    background: #fff;
    padding: 36px;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
}
.login-box h1 {
    font-size: 1.3rem;
    text-transform: uppercase;
    margin-top: 0;
    text-align: center;
    margin-bottom: 24px;
}

/* ---------- Admin responsive (mobile) ---------- */
@media (max-width: 860px) {
    .admin-wrapper { flex-direction: column; }
    .admin-sidebar {
        width: 100%;
        padding: 12px 0;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 2px;
    }
    .admin-sidebar h2 {
        width: 100%;
        border-bottom: none;
        padding: 0 16px 8px;
        margin: 0;
    }
    .admin-sidebar a {
        padding: 8px 14px;
        border-left: none;
        border-radius: var(--r-pill);
        font-size: .85rem;
    }
    .admin-sidebar a:hover,
    .admin-sidebar a.active {
        border-left-color: transparent;
        background: var(--c-accent);
        color: #fff;
    }
    .admin-content { padding: 20px 16px; max-width: 100%; }
    .admin-topbar { flex-wrap: wrap; gap: 10px; }
    .admin-topbar h1 { font-size: 1.2rem; }
}
