/* Stili generali */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

header {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 0.6rem 1rem 0.7rem 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.header-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.header-row-top {
    margin-bottom: 0.5rem;
}

.header-row-nav:empty {
    display: none;
}

.header-button {
    background-color: #e74c3c;
}

.header-button:hover {
    background-color: #c0392b;
}

.header-button.classifica-btn {
    background-color: #f39c12;
}

.header-button.classifica-btn:hover {
    background-color: #e67e22;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
    width: 100%;
    flex: 1 0 auto;
}

section {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

h2 {
    color: #2c3e50;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

h3 {
    color: #34495e;
    margin: 1rem 0;
}

/* Form styles */
.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

input[type="text"],
input[type="number"],
input[type="date"],
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #2980b9;
}

button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.buttons-group {
    display: flex;
    flex-wrap: wrap;           /* su schermi stretti vanno a capo invece di uscire dalla schermata */
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}
/* I bottoni nel buttons-group sono compatti e con larghezza uguale,
   così entrano tutti su una riga sui monitor da scuola (>=1366px). */
.buttons-group > button {
    flex: 1 1 0;
    min-width: 130px;          /* sotto questa soglia il flex-wrap manda a capo */
    max-width: 180px;
    padding: 0.6rem 0.5rem;
    font-size: 0.92rem;
    line-height: 1.15;
}

/* ──────────────────────────────────────────────────────────────
   Seconda riga di bottoni del tab Round: contiene i bottoni di
   "chiusura/transizione" (Certificates PDF, Add Rounds, End
   Tournament, e per il team anche New Tournament).
   Differenze rispetto a .buttons-group:
     - allineamento a SINISTRA (non centrato)
     - niente flex: 1 1 0 → i bottoni mantengono larghezza naturale
     - margin-top più piccolo, così le due righe restano vicine
   ────────────────────────────────────────────────────────────── */
.buttons-group-secondary {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.5rem;
    margin-top: 0.6rem;
}
.buttons-group-secondary > button {
    /* Larghezza FISSA uguale per tutti: così, indipendentemente dalla
       lunghezza del testo, tutti i bottoni hanno la stessa dimensione
       e l'allineamento a sinistra risulta visivamente ordinato.
       220px è abbastanza per il testo più lungo (es.
       "👤 Single Certificates...") e fa visivamente match con i bottoni
       del banner Tournament Completed (che usano la stessa classe).

       Padding e font-size uniformati ai bottoni "Import CSV / Excel /
       Download Template" (vedi stile globale `button` in questo file,
       riga 99 circa): padding verticale 0.75rem, font-size 1rem. Così
       i bottoni del tab Round hanno la stessa "altezza visiva" dei
       bottoni di importazione giocatori — coerenza UI in tutta l'app. */
    width: 220px;
    padding: 0.75rem 0.5rem;
    font-size: 1rem;
    line-height: 1.15;
    white-space: nowrap;       /* evita che testi al limite vadano a capo */
}

/* Table styles */
.lista-container,
.accoppiamenti-container,
.classifica-container {
    margin-top: 2rem;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

thead {
    background-color: #34495e;
    color: white;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

tbody tr:hover {
    background-color: #f1f1f1;
}

/* Info torneo styles */
.info-torneo {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #ecf0f1;
    border-radius: 4px;
}

.info-torneo p {
    font-weight: 500;
}

/* Accoppiamenti e risultati */
#lista-accoppiamenti .risultato-select {
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid #ddd;
    width: 100%;
}

/* Footer styles */
footer {
    text-align: center;
    padding: 1rem;
    background-color: #2c3e50;
    color: white;
    margin-top: 2rem;
}

footer a {
    color: white;
    text-decoration: underline;
    opacity: 0.8;
}

footer a:hover {
    opacity: 1;
}

/* Responsive design */
@media (max-width: 768px) {
    .info-torneo {
        grid-template-columns: 1fr;
    }

    th, td {
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    .buttons-group {
        flex-direction: column;
    }

    button {
        width: 100%;
    }

    .header-buttons {
        gap: 0.5rem;
    }
}
