﻿/* --- 1. Base Setup --- */
body {
    background-color: #f4f7f6;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
}

.text-center { text-align: center !important; }

/* --- 2. Navbar & Brand --- */
.navbar {
    border-bottom: 3px solid #ffc107;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    background-color: #1a1a2e !important;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    color: white !important;
}

.navbar-brand img {
    margin-right: 12px;
    filter: drop-shadow(2px 2px 2px #aaa);
}

/* Allineamento Menu a Destra */
.navbar-nav {
    margin-left: auto !important;
}

.nav-link {
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.9rem;
    transition: color 0.3s;
    color: #FFF !important;
}

.nav-link:hover {
    color: #ffc107 !important;
}

.nav-link.btn-outline-warning:hover {
    color: #fff !important;
}

.nav-link.btn-outline-warning {
    background: #ffc107 !important;
    font-weight: bold;
}

.menu-user { margin-top:18px !important}

.menu-utente { 
    background: #1A1A2E; 
    min-width: 230px; 
}
.menu-utente li { 
    background: #F8F9FA; 
}
.menu-utente li a { 
    color: #1A1A2E !important; 
    font-weight: bolder; 
}
.menu-utente li a:hover { 
    background: #ffc107; 
    color: #fff !important; 
}

select { border: 1px solid #ccc !important; }
.page-body { padding-top: 20px; }

/* --- 3. Card Girone (Moderno) --- */
.card-girone {
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    background: white;
    border: none;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 25px;
}

.card-girone:hover {
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}

.card-header {
    border: none !important;
    padding: 10px 20px !important;
    display: flex;
    align-items: center;
}

.card-header h5 {
    color: white;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 0 20px !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    font-size: 25px !important;
}

/* Colori intestazioni card personalizzate */
.card-header-classifica-over { background: linear-gradient(45deg, #11998e, #38ef7d); }
.card-header-classifica-under { background: linear-gradient(45deg, #f12711, #f5af19); }

/* --- 4. Tabella Classifica --- */
.table-classifica {
    width: 100%;
    margin-bottom: 0 !important;
}

.table-classifica thead th {
    background-color: #f8f9fa;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: #6c757d;
    padding: 12px 10px;
}

.table-classifica td {
    padding: 12px !important;
    font-size: 0.9rem;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: #f1f7ff;
}

/* Classi Punti Oro/Argento */
.fw-bold {
    font-weight: bold !important;
}

.pos-gold { 
    background-color: #d4af37 !important; 
    color: #000 !important; 
    font-weight: bold;
}
.pos-silver { 
    background-color: #c0c0c0 !important; 
    color: #000 !important; 
    font-weight: bold;
}

/* --- 5. Utilità e Footer --- */
.rounded-circle {
    border: 3px solid rgba(255,255,255,0.3);
    object-fit: cover;
}

.footer {
    background: #1a1a2e;
    color: #888;
    text-align: center;
    padding: 30px;
    margin-top: 50px;
    font-size: 0.8rem;
}

/* Sovrascrittura temi backoffice */
body[themebg-pattern="theme1"] { background: initial; }

@media (min-width: 1200px) {
  .container { max-width: 94%; }
}

@media (min-width: 1400px) {
  .container { max-width: 80%; }
}

/* --- Colonne fisse (Sticky) su Mobile per la Tabella Classifica --- */
@media (max-width: 992px) {
    .card-girone .table-responsive {
        width: 100%;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        position: relative;
    }

    .table-classifica {
        width: max-content !important;
        border-collapse: separate !important;
        border-spacing: 0 !important;
    }

    .table-classifica th,
    .table-classifica td {
        padding: 10px 6px !important;
        font-size: 0.85rem !important;
        white-space: nowrap;
    }

    /* 1. POS (Larghezza: 40px, parte da 0) */
    .table-classifica th:nth-child(1),
    .table-classifica td:nth-child(1) {
        position: sticky !important;
        left: 0px !important;
        z-index: 10 !important;
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        background-color: #ffffff !important;
    }

    /* 2. Giocatore (Larghezza: 150px, parte da 40px) */
    .table-classifica th:nth-child(2),
    .table-classifica td:nth-child(2) {
        position: sticky !important;
        left: 40px !important;
        z-index: 10 !important;
        width: 180px !important;
        min-width: 180px !important;
        max-width: 180px !important;
        background-color: #ffffff !important;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 3. PT (Larghezza: 45px, parte da 40 + 150 = 190px) */
    .table-classifica th:nth-child(3),
    .table-classifica td:nth-child(3) {
        position: sticky !important;
        left: 190px !important;
        z-index: 10 !important;
        width: 45px !important;
        min-width: 45px !important;
        max-width: 45px !important;
        background-color: #ffffff !important;
        border-right: 2px solid #dee2e6 !important;
    }

    /* Sfondo coerente in hover per le celle fisse */
    .table-hover tbody tr:hover td:nth-child(1),
    .table-hover tbody tr:hover td:nth-child(2),
    .table-hover tbody tr:hover td:nth-child(3) {
        background-color: #f1f7ff !important;
    }

    /* Gestione delle colonne successive (PG, SV, SP, ecc.) */
    .table-classifica th:nth-child(n+4),
    .table-classifica td:nth-child(n+4) {
        background-color: #ffffff !important;
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        text-align: center !important;
    }
}

.no-mobile { display: block; }    
.no-desktop { display: none; }

@media (max-width: 768px) {
    .no-desktop { display: block; }
    .no-mobile { display: none; }   

    .card-girone { margin-bottom: 20px; }

    .navbar { padding: .5rem .5rem; }
    .navbar-brand { font-size: 1rem; }
    .navbar-brand span { display: none; }
    .navbar-brand img { margin-right: 10px; height: 50px; }
    .navbar-toggler { padding: .25rem .5rem; }
    .navbar-nav li { text-align: center; margin-right: 0 !important; }
    .navbar-collapse { background: #2a2a40; }

    .li-utente { display: initial; align-items: center; }
    .imgLiv { margin-bottom: 5px; }

    /* Forza il sottomenu del profilo a rimanere già aperto nel mobile */
    .navbar-nav .dropdown-menu {
        display: block !important;
        position: static !important;
        float: none;
        background-color: transparent !important;
        border: none;
        box-shadow: none;
        padding-left: 1rem;
    }
    .navbar-nav .dropdown-toggle::after {
        display: none; 
    }
}

@media screen and (max-width: 768px) {
    .calendario .card-girone { box-shadow: none; }
    .calendario .card-header-partite { margin-bottom: 1rem; border-radius: 20px; }

    .table-calendario tr:first-child,
    .table-calendario th { 
        display: none !important; 
    }

    .table-calendario {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    .table-calendario tr {
        display: block;
        width: 100%;
        margin-bottom: 1rem;
        background: #fff;
        border-radius: 0.375rem;
        box-sizing: border-box;
        box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
        padding: 0.5rem 0;
    }

    .table-calendario tr.pari {
        border-left: 5px solid #1a1a2e !important;
    }

    .table-calendario tr.dispari {
        border-left: 5px solid #ffc107 !important;
    }

    /* Trasforma ogni cella in un contenitore flessibile */
    .table-calendario td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        text-align: right !important;
        padding: 0.5rem 0.8rem !important;
        border: none !important;
        white-space: normal !important;
        box-sizing: border-box;
        width: 100% !important;
    }

    .table-calendario td:last-child {
        border-bottom: none;
    }

    /* Etichetta fissa a sinistra */
    .table-calendario td::before {
        content: attr(data-label);
        font-weight: bold;
        text-align: left !important;
        color: #495057;
        flex-shrink: 0;
        margin-right: 1rem;
    }

    /* Forza il contenuto della cella a disporsi sulla destra indipendentemente dai tag interni */
    .table-calendario td > * {
        margin-left: auto;
        text-align: right;
    }

    .card-mobile { 
        background: transparent; 
        box-shadow: initial; 
        margin-bottom: 0;
    }

    .btn-reset { 
        display: none;
    }

    .slide { 
        display: none;
    }
}