/* BCM Registration Portal - Stili Essenziali */
/* Font: Inter from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ====== KEYFRAMES PER ANIMAZIONI ====== */
/* Queste animazioni sono usate da Tailwind tramite tailwind.config.js */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes bounceSoft {
    0%, 100% { transform: translateY(-5%); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
    50% { transform: translateY(0); animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes basketballBounce {
    0%, 100% {
        transform: translateY(0) scale(1, 1);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(-20px) scale(1.1, 0.9);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}


/* ====== CLASSI DI COMPONENTI NON-TAILWIND ====== */

/* Animazione per il logo */
.logo-animation {
    animation: bounceSoft 3s ease-in-out infinite;
}

/* Stile per il loader piccolo */
.loader-small {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f4f6; /* grigio chiaro */
    border-top: 3px solid #0A4A28; /* bcm-green */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* Loader palla da basket rimbalzante */
.basketball-loader {
    display: inline-block;
    animation: basketballBounce 0.8s ease-in-out infinite;
}

.basketball-loader svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Stile per il contenitore di Google Places Autocomplete */
.pac-container {
    z-index: 1050 !important;
    border-radius: 12px;
    border: none;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

/* Righe della tabella Admin con effetto hover (più semplice gestirlo qui) */
#admin-table-body .table-row {
    transition: all 0.2s ease;
}
#admin-table-body .table-row:hover {
    background-color: rgba(10, 74, 40, 0.05); /* Sfumatura di bcm-green */
    transform: scale(1.01);
    cursor: pointer;
}

/* Stili moderni per i filtri admin */
.admin-filter-container {
    @apply relative;
}

.admin-filter-container select:focus + i {
    @apply text-bcm-green;
}

.admin-filter-container i.fa-chevron-down {
    transition: color 0.2s ease;
}

/* Stili per i tab dell'admin con icone */
.admin-tab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.admin-tab-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(10, 74, 40, 0.15);
}

.admin-tab-btn.bg-bcm-green {
    background: linear-gradient(135deg, #0A4A28 0%, #7CB518 100%);
    box-shadow: 0 4px 15px rgba(10, 74, 40, 0.3);
}

.admin-tab-btn i {
    transition: transform 0.2s ease;
}

.admin-tab-btn:hover i {
    transform: scale(1.1);
}

/* Responsive tweaks per tablet */
@media (max-width: 1024px) {
    .admin-tab-btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
}

/* Mobile responsivity */
@media (max-width: 640px) {
    .admin-tab-btn {
        padding: 0.5rem 0.25rem;
        font-size: 0.65rem;
        min-width: 50px;
    }
    
    .admin-tab-btn i {
        font-size: 0.875rem;
        margin-right: 0.125rem !important;
    }
}

/* Admin containers mobile padding */
@media (max-width: 640px) {
    #admin-gruppi-container,
    #admin-allenatori-container,
    #admin-palestre-container,
    #admin-comunicazioni-container,
    #admin-documenti-container {
        padding: 0.3rem !important;
    }

    /* Documents dashboard cards - padding ridotto */
    .documents-stat-card {
        padding: 0.3rem !important;
    }
}

/* Stili per il menu animato admin (ispirato al design moderno) */
.admin-animated-menu {
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 10;
}

.admin-menu-list {
    width: 100%;
    padding: 0;
    margin: 0;
    list-style: none;
}

.admin-menu-item {
    position: relative;
    text-align: center;
}

/* Stile del link principale (titolo che cambia) */
.admin-menu-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    color: #0A4A28;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    background: white;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

@media (min-width: 768px) {
    .admin-menu-link {
        padding: 1rem 3rem;
        font-size: 1.25rem;
        border-radius: 16px;
    }
}

.admin-menu-link:hover {
    background: rgba(10, 74, 40, 0.02);
    border-color: #78BE20;
    box-shadow: 0 4px 12px rgba(120, 190, 32, 0.15);
}

/* Sottomenu (nascosto di default) */
.admin-sub-menu {
    position: absolute;
    top: 100%;
    width: 100%;
    left: 0;
    padding-top: 10px;
    padding-bottom: 20px;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform: translateY(20px);
    transition: all 0.3s ease-in-out;
    list-style: none;
    margin: 0;
    padding: 0;
    z-index: 9999;
}

/* Su mobile, rendi il dropdown più largo e centrato nello schermo */
@media (max-width: 768px) {
    .admin-sub-menu {
        position: fixed;
        width: auto;
        min-width: 280px;
        max-width: 90vw;
        left: 50%;
        top: 80px;
        transform: translateX(-50%) translateY(20px);
    }

    /* Quando NON ha menu-open, nascondi il menu - DEVE venire PRIMA */
    .admin-menu-item:not(.menu-open) .admin-sub-menu {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transform: translateX(-50%) translateY(20px) !important;
    }

    /* Su mobile SOLO .menu-open apre il menu - DEVE venire DOPO con !important */
    .admin-menu-item.menu-open .admin-sub-menu {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: translateX(-50%) translateY(0) !important;
    }
}

/* Al passaggio del mouse (desktop) o click (mobile), il sottomenu appare */
.admin-menu-item:hover .admin-sub-menu,
.admin-menu-item.menu-open .admin-sub-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    animation: slideUp 0.3s ease-out;
}

/* Desktop: solo translateY */
@media (min-width: 769px) {
    .admin-menu-item:hover .admin-sub-menu,
    .admin-menu-item.menu-open .admin-sub-menu {
        transform: translateY(0);
    }
}

/* Voci del sottomenu */
.admin-sub-menu li {
    display: block;
    margin: 8px 0;
    transition: all 400ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 8px;
    overflow: hidden;
}

/* Animazione per raddrizzare le voci quando il menu è aperto */
.admin-menu-item:hover .admin-sub-menu li {
    transform: none;
    margin: 0;
}

/* Stile dei link nel sottomenu con icone */
.admin-sub-menu a {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 20px;
    color: #ffffff;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.admin-sub-menu a i {
    margin-right: 12px;
    font-size: 18px;
    width: 20px;
}

/* Voci pari e dispari con rotazione iniziale (animazione "bella") */
.admin-sub-menu li:nth-of-type(even) {
    transform: rotate(5deg);
}
.admin-sub-menu li:nth-of-type(odd) {
    transform: rotate(-5deg);
}

/* Colori gradient BCM (simili ai pulsanti "Nuovo Gruppo") con ritardi specifici */
.admin-sub-menu li:nth-of-type(1) {
    transition-delay: 0.05s;
    background: linear-gradient(135deg, #0A4A28 0%, #5a9e2b 100%);
}
.admin-sub-menu li:nth-of-type(2) {
    transition-delay: 0.1s;
    background: linear-gradient(135deg, #0d5632 0%, #60a830 100%);
}
.admin-sub-menu li:nth-of-type(3) {
    transition-delay: 0.15s;
    background: linear-gradient(135deg, #10633c 0%, #66b235 100%);
}
.admin-sub-menu li:nth-of-type(4) {
    transition-delay: 0.2s;
    background: linear-gradient(135deg, #137046 0%, #6cbc3a 100%);
}
.admin-sub-menu li:nth-of-type(5) {
    transition-delay: 0.25s;
    background: linear-gradient(135deg, #167d50 0%, #72c63f 100%);
}
.admin-sub-menu li:nth-of-type(6) {
    transition-delay: 0.3s;
    background: linear-gradient(135deg, #198a5a 0%, #78d044 100%);
}
.admin-sub-menu li:nth-of-type(7) {
    transition-delay: 0.35s;
    background: linear-gradient(135deg, #1c9764 0%, #78d044 100%);
}
.admin-sub-menu li:nth-of-type(8) {
    transition-delay: 0.4s;
    background: linear-gradient(135deg, #1f9f68 0%, #78BE20 100%);
}
.admin-sub-menu li:nth-of-type(9) {
    transition-delay: 0.45s;
    background: linear-gradient(135deg, #22a56c 0%, #7ed649 100%);
}
.admin-sub-menu li:nth-of-type(10) {
    transition-delay: 0.5s;
    background: linear-gradient(135deg, #28ab70 0%, #84dc4e 100%);
}
.admin-sub-menu li:nth-of-type(11) {
    transition-delay: 0.55s;
    /* Il logout ha già uno style inline con gradient rosso */
}

/* Effetto hover: gradient più brillante con BCM Lime */
.admin-sub-menu li:hover {
    background: linear-gradient(135deg, #5a9e2b 0%, #A1CF6B 100%);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(120, 190, 32, 0.3);
}

/* Stile per pulsante chiusura modale con cerchio rosso */
.swal-close-button-red {
    background-color: #dc2626 !important;
    color: white !important;
    border-radius: 50% !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    transition: all 0.2s ease !important;
}

.swal-close-button-red:hover {
    background-color: #b91c1c !important;
    transform: scale(1.1) !important;
}

@media (max-width: 768px) {
    .table-row {
        /* ... existing code ... */
    }
}

/* ====== TABS MANAGEMENT (Gruppi / Allenamenti) ====== */
.tab-management-btn {
    opacity: 0.7;
    background-color: transparent;
    color: #374151; /* gray-700 */
}

.tab-management-btn.active {
    opacity: 1;
    background-color: rgba(120, 190, 32, 0.1); /* bcm-lime with opacity */
    border-bottom-color: #78BE20 !important; /* bcm-lime */
    color: #0A4A28; /* bcm-green */
}
