/* Stile generale */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    /* Colore accent dedicato per distinguere elementi non di gruppo */
    --accent-color: #6f42c1; /* purple */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f7f7f7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

footer {
    margin-top: auto;
}

/* Stile header */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

/* Hero section */
.hero-section {
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('../images/foosball.jpg') no-repeat center center;
    background-size: cover;
    color: white;
    padding: 5rem 0;
    text-align: center;
    margin-top: -1.5rem;
    margin-bottom: 2rem;
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
}

.hero-section p {
    font-size: 1.3rem;
    max-width: 800px;
    margin: 0 auto;
    margin-bottom: 2rem;
}

/* Card personalizzate */
.card {
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    margin-bottom: 20px;
}

.card:hover {
    transform: translateY(-5px);
}

.card-header {
    font-weight: bold;
    background-color: var(--primary-color);
    color: white;
    border-radius: 10px 10px 0 0 !important;
}

.card-body {
    padding: 1.5rem;
}

/* Pulsanti personalizzati */
.btn {
    border-radius: 5px;
    font-weight: 500;
    padding: 0.5rem 1.5rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

/* Accent custom theme (viola) */
.btn-accent {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

.btn-accent:hover {
    background-color: #5a32a3;
    border-color: #4f2b8f;
    color: #fff;
}

.btn-outline-accent {
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.btn-outline-accent:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

.text-accent {
    color: var(--accent-color) !important;
}

.bg-accent {
    background-color: var(--accent-color) !important;
    color: #fff !important;
}

/* Form personalizzati */
.form-control {
    border-radius: 5px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Tabelle */
.table {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.table thead {
    background-color: var(--primary-color);
    color: white;
}

.table th, .table td {
    padding: 1rem;
}

/* Badge per le fasi del torneo */
.badge-girone {
    background-color: var(--info-color);
    color: white;
}

.badge-quarti {
    background-color: var(--warning-color);
    color: dark;
}

.badge-semifinale {
    background-color: var(--secondary-color);
    color: white;
}

.badge-finale {
    background-color: var(--danger-color);
    color: white;
}

/* Classifica */
.classifica-1 {
    background-color: rgba(255, 215, 0, 0.2);
}

.classifica-2 {
    background-color: rgba(192, 192, 192, 0.2);
}

.classifica-3 {
    background-color: rgba(205, 127, 50, 0.2);
}

/* Classifiche Gironi */
.card-header.bg-primary {
    background-color: var(--primary-color) !important;
}

.card-header.bg-success {
    background-color: var(--success-color) !important;
}

.card-header.bg-danger {
    background-color: var(--danger-color) !important;
}

.card-header.bg-warning {
    background-color: var(--warning-color) !important;
    color: var(--dark-color) !important;
}

.card-header.bg-info {
    background-color: var(--info-color) !important;
}

/* Evidenziazione squadre qualificate */
.table-success {
    background-color: rgba(25, 135, 84, 0.1) !important;
}

.table-warning {
    background-color: rgba(255, 193, 7, 0.1) !important;
}

/* Calendario */
.calendario-card {
    margin-bottom: 15px;
}

.calendario-card .data {
    font-weight: bold;
    color: var(--primary-color);
}

.calendario-card .vs {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0 15px;
}

.calendario-card .risultato {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
    padding: 5px 15px;
    border-radius: 15px;
}

/* Stili tornei nella homepage */
.torneo-card {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.torneo-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.torneo-card .card-header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 1.5rem;
}

.torneo-card .card-header h3 {
    margin-bottom: 0;
    font-weight: 600;
}

.torneo-img {
    height: 100%;
    object-fit: cover;
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

.torneo-descrizione {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #555;
    margin-bottom: 0;
    max-height: 120px;
    overflow: hidden;
    position: relative;
}

.torneo-descrizione::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 20px;
    background: linear-gradient(transparent, white);
}

@media (max-width: 768px) {
    .torneo-img {
        height: 200px;
        border-top-left-radius: 10px;
        border-top-right-radius: 10px;
        border-bottom-left-radius: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .hero-section {
        padding: 3rem 0;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .hero-section p {
        font-size: 1rem;
    }
    
    /* Tabelle responsive su mobile */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Riduce dimensione dei bottoni nei gruppi su mobile */
    .btn-group .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Migliora la spaziatura nel footer su mobile */
    footer h5 {
        margin-top: 1.5rem;
    }
    
    /* Adatta le statistiche dashboard su mobile */
    .dashboard-stats {
        margin-bottom: 15px;
    }
    
    .dashboard-stats .icon {
        font-size: 2rem;
    }
    
    .dashboard-stats .count {
        font-size: 1.5rem;
    }
}

/* Ulteriori miglioramenti per schermi molto piccoli */
@media (max-width: 576px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    /* Adatta le card su mobile */
    .card-body {
        padding: 1rem;
    }
    
    /* Modifica layout tabelle per schermi molto piccoli */
    .table thead {
        font-size: 0.85rem;
    }
    
    .table td, .table th {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    /* Nasconde alcune colonne meno importanti su mobile */
    .hide-xs {
        display: none;
    }
}

/* Stile per il pulsante di scrolling verso l'alto */
.scroll-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.scroll-to-top.visible {
    opacity: 1;
}

.scroll-to-top:hover {
    background-color: #0b5ed7;
}

/* Migliora la visualizzazione delle tabelle su dispositivi mobili */
@media (max-width: 768px) {
    .table-mobile-stack thead {
        display: none;
    }
    
    .table-mobile-stack tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 5px;
    }
    
    .table-mobile-stack td {
        display: flex;
        justify-content: space-between;
        text-align: right;
        border-bottom: 1px solid #dee2e6;
    }
    
    .table-mobile-stack td:last-child {
        border-bottom: none;
    }
    
    .table-mobile-stack td::before {
        content: attr(data-label);
        font-weight: bold;
        text-align: left;
        padding-right: 0.5rem;
    }
}

/* Admin dashboard */
.dashboard-stats {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.dashboard-stats .icon {
    font-size: 2.5rem;
    margin-right: 15px;
    color: var(--primary-color);
}

.dashboard-stats .count {
    font-size: 2rem;
    font-weight: bold;
}

.dashboard-stats .label {
    color: var(--secondary-color);
    font-size: 1rem;
}

/* Correzione btn-close su sfondo scuro */
.btn-close-white {
    filter: invert(1);
}

/* Ottimizzazioni Mobile Avanzate */
@media (max-width: 576px) {
    /* Card tornei ottimizzate per mobile */
    .torneo-card .row {
        flex-direction: column;
    }
    
    .torneo-card .col-md-4,
    .torneo-card .col-md-8 {
        width: 100%;
    }
    
    .torneo-img {
        height: 200px;
        object-fit: cover;
        border-radius: 10px 10px 0 0;
        width: 100%;
    }
    
    /* Bottoni più facili da premere su touch */
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    /* Aumenta dimensione elementi interattivi */
    .form-control, 
    .form-select {
        height: 50px;
        font-size: 1.1rem;
    }
    
    .form-check-input {
        width: 1.5em;
        height: 1.5em;
    }
    
    /* Spazio extra tra elementi su mobile */
    .mb-3, .mb-4 {
        margin-bottom: 1.5rem !important;
    }
    
    /* Hero section più compatta */
    .hero-section {
        padding: 2.5rem 1rem;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .hero-section p {
        font-size: 1rem;
    }
    
    /* Menu più facile da toccare */
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        font-size: 1.1rem;
    }
    
    /* Spaziatura ottimizzata */
    .container {
        padding-left: 20px;
        padding-right: 20px;
    }
}

/* Pulsante scroll-to-top più grande su mobile */
@media (max-width: 768px) {
    .scroll-to-top {
        width: 50px;
        height: 50px;
        right: 20px;
        bottom: 20px;
        font-size: 1.25rem;
        line-height: 50px;
    }
}

/* Disabilita swipe laterale e navigazione touch sui dispositivi mobili */
html, body {
    /* Disabilita lo swipe laterale per la navigazione del browser */
    overscroll-behavior-x: none;
    overscroll-behavior-y: contain;
    /* Permette zoom e scroll verticale, blocca solo swipe laterale */
    touch-action: pan-y pinch-zoom;
    /* Abilita smooth scrolling su iOS */
    -webkit-overflow-scrolling: touch;
    /* Previene il bounce effect solo orizzontalmente */
    -webkit-overscroll-behavior-x: none;
    -webkit-overscroll-behavior-y: contain;
}

/* Disabilita specificamente lo swipe su elementi interattivi */
.container, 
.card, 
.table-responsive,
.navbar,
main {
    /* Permette solo scroll verticale e zoom */
    touch-action: pan-y pinch-zoom;
    /* Previene overscroll orizzontale */
    overscroll-behavior-x: none;
}

/* Disabilita swipe su tabelle responsive */
.table-responsive {
    /* Permette scroll orizzontale controllato ma non swipe di navigazione */
    touch-action: pan-x pan-y pinch-zoom;
    overscroll-behavior: none;
}

/* Disabilita swipe su elementi che potrebbero causare conflitti */
.carousel,
.modal,
.offcanvas {
    touch-action: pan-y pinch-zoom;
    overscroll-behavior-x: none;
}

/* Migliora l'esperienza touch sui bottoni */
.btn, 
.nav-link, 
.dropdown-item {
    /* Ottimizza per touch senza interferire con lo swipe */
    touch-action: manipulation;
}

/* Previene zoom accidentale su input */
input, 
select, 
textarea {
    touch-action: manipulation;
}

/* Media query specifica per dispositivi touch */
@media (hover: none) and (pointer: coarse) {
    /* Dispositivi touch puri (smartphone, tablet) */
    *, *::before, *::after {
        /* Disabilita completamente lo swipe laterale */
        overscroll-behavior-x: none !important;
        overscroll-behavior-y: contain !important;
        /* Permette zoom e scroll verticale, blocca solo swipe laterale */
        touch-action: pan-y pinch-zoom !important;
    }
    
    html, body {
        /* Previene il bounce effect su iOS */
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior-x: none !important;
        overscroll-behavior-y: contain !important;
        -webkit-overscroll-behavior-x: none !important;
        /* Permette zoom e scroll verticale */
        touch-action: pan-y pinch-zoom !important;
    }
    
    /* Eccezione per tabelle scrollabili */
    .table-responsive, .table-responsive * {
        touch-action: pan-x pan-y pinch-zoom !important;
    }
    
    /* Migliora la responsività dei tap */
    .btn, 
    .nav-link, 
    .card, 
    .list-group-item {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        tap-highlight-color: rgba(0, 0, 0, 0.1);
        touch-action: manipulation !important;
    }
}

/* Regola universale per tutti i browser mobili */
@media screen and (max-width: 768px) {
    * {
        overscroll-behavior-x: none !important;
        -webkit-overscroll-behavior-x: none !important;
    }
    
    body {
        position: relative;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain !important;
        -webkit-overscroll-behavior: contain !important;
    }
} 