/* assets/css/tabellone.css */

/* --- 1. LAYOUT GENERALE & FIX FOOTER --- */
.bracket-container {
    width: 100%;
    /* FIX FOOTER: Altezza minima garantita per spingere il footer in basso */
    min-height: 80vh; 
    
    margin: 0;
    padding: 40px 20px;
    box-sizing: border-box;

    display: flex;
    /* FIX SCROLL: Default centrato, ma gestito con media query sotto */
    justify-content: center;
    align-items: center;
    gap: 50px;
    
    /* SCROLL ORIZZONTALE */
    overflow-x: auto;
    
    /* Impedisce ai box di andare a capo */
    white-space: nowrap; 
    
    /* Nascondi Scrollbar */
    scrollbar-width: none; 
    -ms-overflow-style: none;
}
.bracket-container::-webkit-scrollbar { display: none; }


/* --- 2. STRUTTURA COLONNE --- */
.bracket-side {
    display: flex;
    gap: 40px;
    align-items: center;
    flex-shrink: 0; /* Impedisce schiacciamento */
}

.bracket-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 40px;
    position: relative;
}

/* Colonna Centrale (Finale) */
.bracket-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
    margin: 0 40px;
}


/* --- 3. MATCH BOX (Opacità 70%) --- */
.match-box {
    text-decoration: none;
    
    /* RICHIESTA: Sfondo nero al 70% */
    background: rgba(0, 0, 0, 0.7); 
    
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    width: 260px; 
    padding: 12px 15px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    transition: transform 0.2s ease, border-color 0.2s;
    z-index: 5;
    white-space: normal; /* Ripristina il testo a capo dentro il box */
}

.match-box.empty { opacity: 0.5; border-style: dashed; }

.match-box:hover {
    transform: translateY(-2px);
    border-color: var(--rosa-neon);
    box-shadow: 0 6px 15px rgba(0,0,0,0.6);
}

/* Testi Box Partita */
.match-header {
    font-size: 0.65rem; color: rgba(255,255,255,0.5);
    text-align: center; text-transform: uppercase; font-weight: bold;
}

.team-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.team-row:last-child { border-bottom: none; }

.team-info { display: flex; align-items: center; gap: 10px; overflow: hidden; }
.t-logo { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; }

.t-name-full {
    font-size: 0.9rem; color: white; font-weight: bold; text-transform: uppercase;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}
.t-name-short { display: none; font-size: 1rem; color: white; font-weight: bold; text-transform: uppercase; }

.t-score {
    font-family: 'DrukWide', sans-serif; color: white; font-size: 1rem; margin-left: 10px;
}
.winner .t-name-full, .winner .t-score { color: var(--rosa-neon); }


/* --- 4. LINEE DI CONNESSIONE --- */
.match-box::after {
    content: ''; position: absolute; top: 50%; width: 20px; height: 1px;
    background: rgba(255,255,255,0.3); z-index: -1;
}
.left-side .match-box::after { right: -20px; }
.right-side .match-box::after { left: -20px; }

.col-quarti::before {
    content: ''; position: absolute; top: 25%; bottom: 25%; width: 1px;
    background: rgba(255,255,255,0.3); z-index: -2;
}
.left-side .col-quarti::before { right: -20px; border-radius: 0 4px 4px 0; }
.right-side .col-quarti::before { left: -20px; border-radius: 4px 0 0 4px; }

.col-semi .match-box::before {
    content: ''; position: absolute; top: 50%; width: 20px; height: 1px;
    background: rgba(255,255,255,0.3); z-index: -1;
}
.left-side .col-semi .match-box::before { left: -20px; }
.right-side .col-semi .match-box::before { right: -20px; }


/* --- 5. INTESTAZIONE CAMPIONE (Logo Grande + Coppa Sovrapposta) --- */
.final-header-container {
    position: relative;
    width: 200px; 
    height: 140px; /* Spazio sufficiente per logo e coppa */
    display: flex;
    justify-content: center;
    align-items: flex-end;
    margin-bottom: 10px;
}

/* LOGO SQUADRA: Grande e Centrale */
.champion-logo {
    width: 130px; 
    height: 130px;
    object-fit: contain;
    position: relative;
    z-index: 1;
    filter: none; /* Pulito */
}

/* COPPA: Piccola, in basso a destra */
.champion-cup-img {
    position: absolute;
    width: 50px; 
    height: auto;
    bottom: 50px;
    right: 20px; /* Aggiusta questo valore per spostarla orizzontalmente */
    z-index: 2;
    filter: none;
    transform: rotate(5deg); /* Leggera inclinazione dinamica */
}

/* SCRITTA CAMPIONE */
.champion-data { width: 100%; text-align: center; margin-top: 5px; }
.champion-label {
    display: block; font-family: 'DrukWide', sans-serif; 
    color: #fff; font-size: 1.1rem; letter-spacing: 1px;
}

/* BOX FINALE */
.final-box {
    border: 2px solid var(--rosa-neon);
    box-shadow: 0 5px 20px rgba(0,0,0,0.6);
}
.final-box::after { display: none; }


/* --- 6. CORIANDOLI --- */
.confetti-wrapper {
    position: absolute; top: -50px; left: 50%; transform: translateX(-50%);
    width: 100%; height: 100%; pointer-events: none; z-index: 0;
}
.confetti {
    position: absolute; width: 5px; height: 5px; top: -20px; opacity: 0;
    animation: fall linear infinite;
}
.c-pink { background-color: #ff19ff; }
.c-white { background-color: #ffffff; }

@keyframes fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(250px) rotate(720deg); opacity: 0; }
}
/* Generazione coriandoli */
.confetti:nth-child(1)  { left: 10%; animation-duration: 2.5s; }
.confetti:nth-child(2)  { left: 20%; animation-duration: 3s; width: 4px; height: 4px; }
.confetti:nth-child(3)  { left: 30%; animation-duration: 2.2s; }
.confetti:nth-child(4)  { left: 40%; animation-duration: 2.8s; width: 6px; height: 6px; }
.confetti:nth-child(5)  { left: 50%; animation-duration: 3.2s; }
.confetti:nth-child(6)  { left: 60%; animation-duration: 2.4s; }
.confetti:nth-child(7)  { left: 70%; animation-duration: 2.9s; width: 4px; height: 4px; }
.confetti:nth-child(8)  { left: 80%; animation-duration: 3.5s; }
.confetti:nth-child(9)  { left: 90%; animation-duration: 2.6s; }
.confetti:nth-child(10) { left: 15%; animation-duration: 3.1s; width: 6px; height: 6px; }


/* --- 7. RESPONSIVE MOBILE & FIX SCROLL --- */

@media (max-width: 1300px) {
    /* FIX SCROLL: Sotto i 1300px, allinea a sinistra */
    .bracket-container {
        justify-content: flex-start;
    }
}

@media (max-width: 1100px) {
    .t-name-full { display: none; }
    .t-name-short { display: block; }
}

@media (max-width: 900px) {
    /* MOBILE LAYOUT: Verticale */
    .bracket-container {
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch; /* Allarga i figli al massimo */
        gap: 10px; /* Spazio tra i blocchi */
        min-height: auto;
        padding: 20px 10px 60px 10px; /* Padding ridotto laterale (10px) per box più larghi */
    }

    /* TRUCCO ORDERING: "Scompatta" i contenitori laterali */
    .bracket-side {
        display: contents; 
    }

    /* RIORDINO VISIVO */
    
    /* 1. Finale in alto */
    .bracket-center { 
        order: 1; 
        margin: 0 0 10px 0; 
        width: 100%; 
    }
    
    /* 2. Semifinali subito sotto */
    .col-semi {
        order: 2;
        width: 100%;
    }
    
    /* 3. Quarti di finale in fondo */
    .col-quarti {
        order: 3;
        width: 100%;
    }

    /* STILE COLONNE & BOX MOBILE */
    .bracket-col { 
        width: 100%; 
        display: flex;
        flex-direction: column;
        align-items: center; 
        gap: 10px; 
    }
    
    .match-box { 
        width: 100%;  /* Occupa tutto lo spazio disponibile */
        max-width: none; /* Rimuove limiti di larghezza */
        box-sizing: border-box;
    }
    
    /* Nascondi linee di connessione su mobile */
    .match-box::after, .match-box::before, .col-quarti::before, .col-semi::before { 
        display: none !important; 
    }

    /* Gestione Nomi */
    .t-name-full { display: block; font-size: 0.85rem; }
    .t-name-short { display: none; }

    /* Ridimensionamento Header Finale */
    .final-header-container { width: 100%; height: auto; padding-bottom: 20px; }
    .champion-logo { width: 90px; height: 90px; }
    .champion-cup-img { width: 35px; right: 40%; bottom: 25px; } /* Aggiustato posizionamento coppa */
}