/* Sovrascritture o estensioni rispetto a style.css */

.back-link {
    position: absolute;
    bottom: -15px;
    right: 4rem;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    background: var(--card-bg-glass);
    border: 1px solid var(--card-border-glass);
    border-radius: 20px;
    backdrop-filter: blur(5px);
    transition: all 0.2s ease;
}

.back-link:hover {
    background: var(--hover-card);
    transform: translateY(-2px);
}

.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    padding: 2rem 4rem;
}

/* SPONSOR SECTION */
.sponsors-section {
    background: var(--girone-bg);
    border: 1px solid var(--girone-border);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    backdrop-filter: blur(10px);
}

.sponsors-section h2 {
    font-size: 1.8rem;
    color: var(--accent-gold);
    margin-bottom: 2rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.sponsors-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 3rem;
}

.sponsor-logo {
    max-height: 80px;
    max-width: 200px;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
    transition: transform 0.3s ease;
}

.sponsor-logo:hover {
    transform: scale(1.1);
}

/* MATCHES SECTION */
.matches-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    /* max-height rimosso per permettere lunghezza intera */
}

/* Custom Scrollbar for matches */
.matches-section::-webkit-scrollbar {
    width: 8px;
}
.matches-section::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}
.matches-section::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
}
.matches-section::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

.section-header h2 {
    font-size: 1.8rem;
    color: var(--accent-gold);
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
    border-bottom: 2px solid rgba(255,255,255,0.2);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.matches-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.match-card {
    background: var(--girone-bg);
    border: 1px solid var(--girone-border);
    border-radius: 15px;
    padding: 1rem 1.5rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: transform 0.2s ease;
}

#final-matches .match-card {
    padding: 2rem;
    margin-bottom: 1rem;
    border-color: var(--accent-gold);
    box-shadow: 0 5px 25px rgba(212, 175, 55, 0.2);
}

#final-matches .match-header {
    font-size: 1.2rem;
    color: var(--accent-gold);
    margin-bottom: 1rem;
    justify-content: center;
}

#final-matches .team-logo {
    width: 60px;
    height: 60px;
}

#final-matches .team-name {
    font-size: 1.4rem;
    font-weight: 700;
}

#final-matches .score-input {
    width: 60px;
    height: 60px;
    font-size: 2rem;
}

.match-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.3);
}

.match-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}

.match-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.team {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.team.right-team {
    flex-direction: row-reverse;
    text-align: right;
}

.team-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    padding: 5px;
}

.team-name {
    font-size: 1rem;
    font-weight: 500;
}

.score-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 900;
}

.score-input {
    width: 45px;
    height: 45px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    font-family: var(--font-main);
    transition: all 0.2s ease;
}

.score-input:focus {
    outline: none;
    background: rgba(255,255,255,0.25);
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

/* Input number hidden arrows */
.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.score-input[type=number] {
  -moz-appearance: textfield;
}

.final-match-select {
    background: rgba(0,0,0,0.5);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 0.5rem;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 0.9rem;
    width: 100%;
    max-width: 250px;
    outline: none;
}

.final-match-select:focus {
    border-color: var(--accent-gold);
}

.final-match-select option {
    background: #1e1e1e;
    color: white;
}

/* STANDINGS SECTION */
.standings-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.table-card {
    margin-bottom: 0;
    min-height: unset;
}

.table-container {
    padding: 1rem;
    background: rgba(0,0,0,0.2);
    border-radius: 0 0 20px 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: center;
    padding: 0.8rem 0.5rem;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.6);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-weight: 500;
}

th:first-child {
    text-align: left;
}

td {
    text-align: center;
    padding: 0.8rem 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

td:first-child {
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.td-logo {
    width: 25px;
    height: 25px;
    object-fit: contain;
}

tr:last-child td {
    border-bottom: none;
}

tr.qualified {
    background: rgba(16, 185, 129, 0.15); /* Greenish background for first place */
}
tr.qualified-second {
    background: rgba(212, 175, 55, 0.15); /* Gold background for best second */
}

td.points {
    font-weight: 900;
    color: var(--accent-gold);
    font-size: 1.1rem;
}

@media (max-width: 1200px) {
    .matches-section {
        max-height: unset;
        overflow-y: visible;
    }
}

/* OTTIMIZZAZIONE PER SMARTPHONE */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
        text-align: center;
    }
    .logo-container {
        height: 70px;
    }
    h1 {
        font-size: 1.8rem;
    }
    .dashboard-grid {
        padding: 1rem;
        gap: 2rem;
    }
    
    /* Tabelle scrollabili su mobile */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0.5rem;
    }
    table {
        min-width: 500px; /* Assicura che la tabella non si schiacci troppo, abilitando lo scroll */
    }
    th, td {
        font-size: 0.9rem;
        padding: 0.6rem 0.3rem;
    }
    
    /* Card delle Partite */
    .match-card {
        padding: 1rem;
    }
    .match-teams {
        gap: 0.5rem;
    }
    .team {
        justify-content: center; /* Centra il logo dato che il testo scompare */
    }
    .team-name {
        display: none; /* Nasconde i nomi delle squadre su telefono */
    }
    .team-logo {
        width: 55px; /* Loghi molto più grandi */
        height: 55px;
    }
    .score-inputs {
        font-size: 1.2rem;
    }
    .score-input {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }

    /* Sponsor */
    .sponsors-grid {
        gap: 1.5rem;
    }
    .sponsor-logo {
        max-width: 120px;
        max-height: 60px;
    }
}
