/* =============================================
   STATMIND - CSS Fedele a Statzone
   ============================================= */

:root {
    --bg-dark: #0a0e1a;
    --bg-card: #111827;
    --bg-card-hover: #1a2236;
    --bg-sidebar: #0f1525;
    --primary: #fbbf24;
    --primary-hover: #f59e0b;
    --text-main: #ffffff;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;
    --border-color: #1e293b;
    --bar-green: #22c55e;
    --bar-red: #ef4444;
    --bar-bg: #374151;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    /* Fix for empty space on scroll */
    background-attachment: fixed;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

/* =============================================
   HEADER
   ============================================= */
.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 60px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    /* Anchor for mobile menu */
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo {
    font-size: 28px;
}

.main-nav {
    display: flex;
    gap: 32px;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.5px;
    padding: 8px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: var(--bg-card-hover);
}

.lang-selector {
    font-size: 20px;
    cursor: pointer;
}

/* =============================================
   MAIN LAYOUT
   ============================================= */
.main-content {
    display: flex;
    min-height: calc(100vh - 60px);
}

/* =============================================
   SIDEBAR LEGHE
   ============================================= */
.leagues-sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    padding: 20px;
    border-right: 1px solid var(--border-color);
}

.sidebar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leagues-list {
    list-style: none;
}

.league-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--bg-card);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.league-item:hover {
    background: var(--bg-card-hover);
}

.league-item.active {
    border-color: var(--primary);
    background: rgba(251, 191, 36, 0.1);
}

.league-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.league-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.league-item-name {
    font-size: 14px;
    font-weight: 500;
}

.league-count {
    background: var(--primary);
    color: #000;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    min-width: 28px;
    text-align: center;
}

.league-count.zero {
    background: var(--bg-card-hover);
    color: var(--text-dim);
}

/* =============================================
   MATCHES SECTION
   ============================================= */
.matches-section {
    flex: 1;
    padding: 24px;
}

.date-selector {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    margin-bottom: 20px;
}

.date-arrow {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
}

.current-date {
    background: var(--bg-card);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
}

.league-header {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f1d30 100%);
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.league-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.league-name {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}

.league-arrow {
    font-size: 20px;
    color: var(--text-muted);
}

/* =============================================
   MATCHES TABLE
   ============================================= */
.matches-table-container {
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
}

.matches-table {
    width: 100%;
    border-collapse: collapse;
}

.matches-table th {
    text-align: left;
    padding: 14px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.matches-table th:nth-child(3),
.matches-table td:nth-child(3) {
    text-align: center;
}

.matches-table th:nth-child(4),
.matches-table td:nth-child(4) {
    text-align: center;
}

.matches-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.matches-table tr:last-child td {
    border-bottom: none;
}

.matches-table tbody tr {
    cursor: pointer;
    transition: all 0.2s ease;
}

.matches-table tbody tr:hover td {
    background: var(--bg-card-hover);
}

.matches-table tbody tr:active td {
    background: rgba(251, 191, 36, 0.15);
}

.match-teams-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.team-in-table {
    display: flex;
    align-items: center;
    gap: 8px;
}

.team-logo-small {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.vs-separator {
    color: var(--text-dim);
    font-size: 12px;
}

.btn-details {
    background: var(--primary);
    color: #000;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-details:hover {
    background: var(--primary-hover);
}

/* =============================================
   MODAL
   ============================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding: 40px;
    overflow-y: auto;
    z-index: 1000;
}

.modal-overlay.visible {
    display: flex;
}

.modal-content {
    background: var(--bg-dark);
    width: 100%;
    max-width: 900px;
    border-radius: 12px;
    overflow: hidden;
}

.modal-back {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 14px;
    padding: 16px 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-back:hover {
    color: var(--primary);
}

.modal-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f1d30 100%);
    padding: 24px;
    text-align: center;
}

.modal-league {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
}

.season-toggle,
.stats-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.season-toggle label,
.stats-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

/* Toggle Switch */
.switch {
    position: relative;
    width: 48px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-card);
    transition: 0.3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--primary);
    transition: 0.3s;
    border-radius: 50%;
}

input:checked+.slider:before {
    transform: translateX(24px);
}

/* Match Header in Modal */
/* Match Header in Modal (Refined) */
.match-header {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Centrato */
    gap: 30px;
    /* Distanza ravvicinata */
    padding: 20px 0 30px 0;
    width: 100%;
}

.match-header .team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 120px;
    /* Larghezza controllata */
    text-align: center;
}

.team-logo-large {
    width: 70px;
    height: 70px;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
    transition: transform 0.3s;
}

.team-logo-large:hover {
    transform: scale(1.1);
}

.match-header .team-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.match-info-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 100px;
}

.vs-text {
    font-size: 28px;
    font-weight: 900;
    color: var(--primary);
    /* Gold */
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
    margin: 4px 0;
}

.match-date {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.match-time {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.team-name {
    font-size: clamp(11px, 3vw, 16px);
    font-weight: 600;
    text-align: center;
    word-break: break-word;
}

.match-info-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(2px, 0.5vw, 4px);
    flex-shrink: 0;
}

.match-date {
    font-size: clamp(10px, 2.5vw, 14px);
    color: var(--text-muted);
}

.vs-text {
    font-size: clamp(16px, 4vw, 24px);
    font-weight: 700;
    color: var(--text-main);
}

.match-time {
    font-size: clamp(10px, 2.5vw, 14px);
    color: var(--text-muted);
}

/* Stats Tabs */
.stats-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 16px 24px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Stats Content */
.stats-content {
    padding: 24px;
    background: var(--bg-dark);
}

.stat-row {
    display: grid;
    grid-template-columns: 80px 1fr 80px;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
    padding-bottom: 2px;
    border-bottom: 2px solid transparent;
    /* Spazio riservato */
}

.stat-winner {
    border-bottom: 2px solid var(--bar-green);
    /* Sottolineatura verde */
}

.stat-draw {
    border-bottom: 2px solid var(--primary);
    /* Sottolineatura gialla */
}

.stat-value.home {
    text-align: left;
    color: var(--primary);
    justify-self: start;
    width: fit-content;
}

.stat-value.away {
    text-align: right;
    color: var(--primary);
    justify-self: end;
    width: fit-content;
}

.stat-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
}

.stat-bars {
    display: flex;
    width: 100%;
    height: 6px;
    background: var(--bar-bg);
    border-radius: 3px;
    overflow: hidden;
}

.bar-home {
    background: var(--bar-green);
    height: 100%;
}

.bar-away {
    background: var(--bar-red);
    height: 100%;
}

/* =============================================
   ADMIN GRID LAYOUT
   ============================================= */
.admin-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 768px) {
    .admin-grid-2col {
        grid-template-columns: 1fr;
    }
}

/* =============================================
   GLASSMORPHISM LOGIN MODAL
   ============================================= */
.login-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.login-modal.visible {
    display: flex;
    opacity: 1;
}

.login-box {
    background: rgba(30, 41, 59, 0.7);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: 24px;
    width: 400px;
    max-width: 90vw;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.login-modal.visible .login-box {
    transform: scale(1);
}

.login-box h2 {
    margin-bottom: 30px;
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.login-box input {
    width: 100%;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.6);
    color: #fff;
    font-size: 16px;
    transition: all 0.2s;
    outline: none;
}

.login-box input:focus {
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.1);
}

/* Specific selector for primary login button to avoid conflicts */
.login-box button.btn-login-submit {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    border: none;
    border-radius: 12px;
    color: #0d1117;
    font-weight: 700;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-box button.btn-login-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(251, 191, 36, 0.4);
}

.login-error {
    color: #ef4444;
    margin-bottom: 20px;
    font-size: 14px;
    min-height: 20px;
    font-weight: 500;
}

/* Close Button Position Update */
.login-close {
    position: absolute;
    bottom: -60px;
    /* Move below the modal */
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    /* Reset inherited styles if any */
    margin: 0;
    padding: 0;
    box-shadow: none;
}

.login-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-50%) scale(1.1);
    color: #fff;
    border-color: #fff;
}



/* =============================================
   RESPONSIVE
   ============================================= */
/* =============================================
   MOBILE MENU & RESPONSIVE
   ============================================= */

/* Mobile Menu Fullscreen Overlay */
.mobile-nav {
    display: block;
    /* Controllato da transform/opacity */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(10, 14, 26, 0.98);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    z-index: 999;
    padding-top: 80px;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s ease-in-out;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-20px);
}

.mobile-nav.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.mobile-nav a {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-main);
    padding: 20px;
    border-bottom: none;
    width: 100%;
    text-align: center;
    transition: color 0.2s;
}

.mobile-nav a:hover,
.mobile-nav a.active {
    color: var(--primary);
    background: transparent;
}

/* Hamburger Button Animation */
.mobile-menu-btn {
    z-index: 1000;
    display: none;
    /* Sovrascritto in media query */
    font-size: 28px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
}

.mobile-menu-btn.open {
    transform: rotate(90deg);
}

/* Login Modal Close Button */
.login-close {
    width: 36px;
    height: 36px;
    font-size: 24px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-radius: 50%;
    top: 10px;
    right: 10px;
}

.login-close:hover {
    background: var(--bar-red);
    color: #fff;
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column-reverse;
    }

    .leagues-sidebar {
        width: 100%;
        border-right: none;
        border-top: 1px solid var(--border-color);
        padding: 16px;
        order: 2;
        /* Fix empty space issues */
        background: var(--bg-sidebar);
    }

    /* LEAGUES GRID ON MOBILE */
    #leagues-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .league-item {
        background: rgba(255, 255, 255, 0.03);
        border-radius: 8px;
        margin-bottom: 0;
    }

    .matches-section {
        order: 1;
        padding: 16px;
    }

    .main-nav {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }

    /* MATCH HEADER MOBILE IMPROVED */
    .match-header {
        flex-direction: row;
        justify-content: center;
        /* Center everything */
        align-items: center;
        gap: 8px;
        /* Reduced gap */
        padding: 20px 10px;
        position: relative;
    }

    .team {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        /* Center items */
        justify-content: flex-end;
        /* Push logos down/up */
    }

    /* Override previous alignments to center everything close to VS */
    .home-team,
    .away-team {
        align-items: center;
    }

    .home-team .team-name,
    .away-team .team-name {
        text-align: center;
        font-size: 13px;
        margin-top: 8px;
        height: 32px;
        /* Fixed height for 2 lines */
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1.2;
    }

    .team-logo-large {
        width: 70px;
        /* Bigger logos */
        height: 70px;
        /* Move slightly towards center visually */
    }

    .home-team .team-logo-large {
        margin-right: -10px;
        /* Pull closer to VS */
    }

    .away-team .team-logo-large {
        margin-left: -10px;
        /* Pull closer to VS */
    }

    .match-info-center {
        z-index: 10;
        display: flex;
        flex-direction: column;
        align-items: center;
        margin: 0 -15px;
        /* Pull teams closer */
        background: rgba(17, 24, 39, 0.8);
        /* Semi-transparent bg for VS readability */
        padding: 5px;
        border-radius: 50%;
    }

    .vs-text {
        font-size: 24px;
        font-weight: 800;
        color: var(--primary);
    }

    .match-date,
    .match-time {
        font-size: 10px;
        opacity: 0.8;
    }

    /* Profile Badge Mobile */
    .profile-name {
        display: none;
    }

    .profile-badge {
        font-size: 9px;
        padding: 2px 6px;
    }
}

/* =============================================
   SMARTPHONE (max-width: 480px)
   ============================================= */
@media (max-width: 480px) {

    /* Header smartphone */
    .main-header {
        height: 50px;
        padding: 0 10px;
    }

    .logo {
        font-size: 22px;
    }

    .icon-btn {
        font-size: 16px;
        padding: 6px;
    }

    .header-right {
        gap: 6px;
    }

    .profile-btn {
        padding: 4px 8px;
    }

    .profile-avatar {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }

    /* Sidebar smartphone */
    .leagues-sidebar {
        padding: 12px 10px;
    }

    .sidebar-title {
        font-size: 12px;
        margin-bottom: 12px;
    }

    .league-item {
        padding: 10px 12px;
        margin-bottom: 6px;
    }

    .league-icon {
        width: 24px;
        height: 24px;
    }

    .league-item-name {
        font-size: 13px;
    }

    .league-count {
        font-size: 11px;
        padding: 3px 8px;
    }

    /* Matches section smartphone */
    .matches-section {
        padding: 12px 10px;
    }

    .date-selector {
        margin-bottom: 16px;
        gap: 12px;
    }

    .current-date {
        font-size: 13px;
        padding: 6px 12px;
    }

    .date-arrow {
        font-size: 18px;
    }

    .league-header {
        padding: 10px 12px;
        margin-bottom: 12px;
        border-radius: 6px;
    }

    .league-logo {
        width: 28px;
        height: 28px;
    }

    .league-name {
        font-size: 13px;
    }

    /* Tabella partite smartphone */
    .matches-table th,
    .matches-table td {
        padding: 10px 6px;
        font-size: 12px;
    }

    .team-logo-small {
        width: 20px;
        height: 20px;
    }

    .team-in-table {
        gap: 6px;
        font-size: 12px;
    }

    /* Nascondi anche colonne DATA e ORA su schermi molto piccoli */
    .matches-table th:nth-child(1),
    .matches-table td:nth-child(1),
    .matches-table th:nth-child(2),
    .matches-table td:nth-child(2) {
        display: none;
    }

    /* Modal smartphone */
    .modal-overlay {
        padding: 0;
    }

    .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }

    .modal-back {
        padding: 12px 16px;
        font-size: 13px;
    }

    .modal-header {
        padding: 16px;
    }

    .modal-league {
        font-size: 16px;
        margin-bottom: 12px;
    }

    /* Match header smartphone - Layout orizzontale */
    .match-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
        gap: 6px;
        padding: 16px 10px;
    }

    .team {
        flex: 1;
        min-width: 0;
        gap: 8px;
    }

    .home-team {
        align-items: flex-start;
    }

    .away-team {
        align-items: flex-end;
    }

    .team-logo-large {
        width: 45px;
        height: 45px;
    }

    .team-name {
        font-size: 11px;
        line-height: 1.2;
        max-width: 100%;
        word-wrap: break-word;
    }

    .home-team .team-name {
        text-align: left;
    }

    .away-team .team-name {
        text-align: right;
    }

    .match-info-center {
        flex-shrink: 0;
        padding: 8px 4px;
        min-width: 60px;
    }

    .match-date {
        font-size: 9px;
    }

    .vs-text {
        font-size: 16px;
    }

    .match-time {
        font-size: 9px;
    }

    /* Stats tabs smartphone */
    .stats-tabs {
        justify-content: stretch;
    }

    .tab-btn {
        flex: 1;
        padding: 10px 8px;
        font-size: 11px;
        text-align: center;
    }

    /* Stats content smartphone */
    .stats-content {
        padding: 16px 12px;
    }

    .stat-row {
        grid-template-columns: 50px 1fr 50px;
        gap: 6px;
        padding: 10px 0;
    }

    .stat-value {
        font-size: 13px;
    }

    .stat-label {
        font-size: 10px;
    }

    .stat-bars {
        height: 5px;
    }
}

/* TABLE RESPONSIVE WRAPPER */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Momentum scrolling on iOS */
    margin-bottom: 20px;
    border-radius: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--bg-dark);
}

.table-responsive table {
    width: 100%;
    min-width: 600px;
    /* Force minimum width to trigger scroll on small screens */
    border-collapse: collapse;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

.table-responsive::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 4px;
}

/* =============================================
   PRICING PAGE
   ============================================= */
.prices-page {
    background: var(--bg-dark);
    justify-content: center;
    padding: 40px 20px;
}

.prices-container {
    max-width: 1000px;
    width: 100%;
    text-align: center;
}

.prices-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 50px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.pricing-cards {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    flex-direction: row;
    /* Ensure row */
    align-items: stretch;
    /* Equal height */
    width: 100%;
}

.pricing-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 30px 30px 20px;
    /* width: 350px; Removed fixed width */
    flex: 1;
    min-width: 280px;
    max-width: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transition: transform 0.3s, border-color 0.3s;
}

.pricing-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.pricing-card.popular {
    border: 2px solid var(--primary);
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.1);
}

.popular-badge {
    position: absolute;
    top: -15px;
    right: 30px;
    background: var(--primary);
    color: #000;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}

.plan-title {
    font-size: 20px;
    font-weight: 500;
    color: #fff;
    margin-bottom: 20px;
}

.plan-price {
    font-size: 48px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 30px;
    position: relative;
    display: inline-flex;
    align-items: center;
}

.free-badge {
    position: absolute;
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    background: #22c55e;
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 8px;
    margin-left: 10px;
    white-space: nowrap;
    font-weight: 600;
}

.plan-features {
    list-style: none;
    text-align: left;
    width: 100%;
    margin-bottom: 30px;
}

.plan-features li {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.plan-features li::before {
    content: '✔';
    color: #22c55e;
    font-weight: bold;
    min-width: 20px;
    /* Ensure alignment */
}

.plan-features li.excluded::before {
    content: '❌';
    color: #ef4444;
}

.plan-features li.highlight::before {
    content: '✨';
    color: #FFD700;
}

.plan-features li.excluded {
    /* color: #ef4444; Removed red */
    /* text-decoration: line-through; Removed strikethrough */
    opacity: 0.7;
}

.plan-features li.highlight {
    color: #FFD700;
    font-weight: bold;
}

.plan-btn {
    width: 100%;
    padding: 14px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    margin-top: auto;
    /* Push button to bottom */
}

.plan-btn:hover {
    background: rgba(251, 191, 36, 0.1);
}

.plan-btn.btn-primary {
    background: var(--primary);
    color: #000;
    border: none;
}

.plan-btn.btn-primary:hover {
    background: var(--primary-hover);
    transform: scale(1.02);
}

@media (max-width: 768px) {
    .pricing-cards {
        flex-direction: column;
        align-items: center;
    }

    .pricing-card {
        width: 100%;
    }
}


/* =============================================
   FOOTER (ADM & COPYRIGHT)
   ============================================= */
.site-footer {
    background: linear-gradient(180deg, var(--bg-card) 0%, #050810 100%);
    padding: 40px 20px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    text-align: center;
}

.separator-border {
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.loading-message {
    color: #fff;
    text-align: center;
    width: 100%;
    padding: 40px;
}

.hidden-initially {
    display: none;
}

.stats-content-wrapper {
    position: relative;
}

.error-message {
    color: #ff4444;
    padding: 20px;
    text-align: center;
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
}

.footer-nav a {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.2s;
}

.footer-nav a:hover {
    color: var(--primary);
}

.footer-separator {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    width: 100%;
    max-width: 600px;
    margin: 0 auto 30px;
}

.copyright-text {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 10px;
}

.gamble-warning {
    color: #fff;
    font-size: 15px;
    margin-bottom: 30px;
}

/* Overrides when grouped */
.footer-text-group .copyright-text {
    margin-bottom: 4px;
}

.footer-text-group .gamble-warning {
    margin-bottom: 0;
}

.telegram-btn-large {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: transparent;
    border-radius: 50%;
    margin-bottom: 30px;
    transition: all 0.2s;
    text-decoration: none;
    padding: 0;
}

.telegram-btn-large img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.2s, filter 0.2s;
}

.telegram-btn-large:hover {
    transform: scale(1.1);
}

.telegram-btn-large:hover img {
    filter: brightness(1.1);
}

.footer-legal-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
}

.footer-legal-links a {
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
    position: relative;
}

.footer-legal-links a:not(:last-child)::after {
    content: '|';
    position: absolute;
    right: -14px;
    color: var(--border-color);
}

.footer-legal-links a:hover {
    text-decoration: underline;
}

.adm-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.adm-logos {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 10px;
}

.adm-logo-img {
    height: 50px;
    width: auto;
    object-fit: contain;
}

/* Footer Layout */
.footer-bottom-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.footer-text-group {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Overrides when grouped */
.footer-text-group .copyright-text {
    margin-bottom: 4px;
    text-align: center !important;
}

.footer-text-group .gamble-warning {
    margin-bottom: 0;
    text-align: center !important;
}

/* 18+ Circle Style */
.plus18-circle {
    width: 40px;
    height: 40px;
    border: 2px solid #ff0000;
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    white-space: nowrap;
}

.plus18-circle::after {
    content: '+';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 14px;
}

.gamble-danger-text {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    max-width: 500px;
    line-height: 1.5;
}

.carta-servizi {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
    margin-top: 10px;
}

.carta-servizi:hover {
    color: #fff;
}

/* =============================================
   LOGO FIX (Ultra Bug)
   ============================================= */
.site-logo {
    display: flex;
    align-items: center;
}

.site-logo img {
    height: 50px;
    /* Increased from 36px/default to fix visibility */
    width: auto;
    max-width: 150px;
    object-fit: contain;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .site-logo img {
        height: 40px;
    }

    .footer-nav {
        gap: 20px;
    }

    .footer-nav a {
        font-size: 12px;
    }
}


/* =============================================
   PROFILE DROPDOWN & HEADER ACTION STYLES
   (Migrated from index.html)
   ============================================= */

/* Pulsante Accedi Header */
.btn-accedi {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-accedi:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

@media (max-width: 480px) {
    .btn-accedi {
        padding: 6px 14px;
        font-size: 12px;
    }
}

/* Mobile Menu */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    margin-right: 8px;
}

.mobile-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1f2e;
    border: 1px solid #2d3548;
    border-top: none;
    z-index: 999;
    padding: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
}

.mobile-nav.visible {
    display: block;
}

.mobile-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    color: #e4e6eb;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    border-bottom: 1px solid #2d3548;
    background: #1a1f2e;
}

.mobile-nav a:last-child {
    border-bottom: none;
}

.mobile-nav a:hover,
.mobile-nav a.active {
    background: #252b3d;
    color: #FFD700;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }

    .mobile-nav {
        top: 50px;
    }
}

/* Profile Dropdown */
.profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-card-hover);
    border-radius: 25px;
    cursor: pointer;
    position: relative;
    border: 1px solid var(--border-color);
}

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #000;
    font-weight: bold;
}

.profile-name {
    font-size: 14px;
    font-weight: 500;
}

.profile-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
}

.profile-badge.premium {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
}

.profile-badge.free {
    background: var(--bar-bg);
    color: var(--text-muted);
}

.profile-badge.admin {
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: #fff;
}

.profile-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: #555555;
    /* Medium gray (not dark) */
    border-radius: 12px;
    padding: 15px;
    min-width: 250px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 100;
    border: 1px solid #777777;
    /* Lighter border */
}

.profile-dropdown.visible {
    display: block;
}

.profile-dropdown-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.profile-id {
    font-family: monospace;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.profile-expiry {
    font-size: 13px;
    color: var(--primary);
}

.profile-dropdown-item {
    display: block;
    padding: 10px;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
}

.profile-dropdown-item:hover {
    background: var(--bg-card-hover);
}

.profile-dropdown-item.logout {
    color: #ff4444;
}

/* Profile Dropdown (Desktop/Base) */
.profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--surface-light);
    border-radius: 25px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s;
}

.profile-btn:hover {
    background-color: var(--surface-hover, rgba(255, 255, 255, 0.1));
}

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.profile-name {
    font-size: 14px;
    font-weight: 500;
}

.profile-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
}

.profile-badge.premium {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
}

.profile-badge.free {
    background: var(--surface-dark);
    color: var(--text-muted);
}

.profile-badge.admin {
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: #fff;
}

.profile-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: #111827;
    /* Force solid background */
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    min-width: 250px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.profile-dropdown.visible {
    display: block;
}

.profile-dropdown-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.profile-id {
    font-family: monospace;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.profile-expiry {
    font-size: 13px;
    color: var(--accent-gold);
}

.profile-dropdown-item {
    display: block;
    padding: 10px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
}

.profile-dropdown-item:hover {
    background: var(--surface-light);
}

.profile-dropdown-item.logout {
    color: #ff4444;
}

/* Mobile Responsive Profile Dropdown */
@media (max-width: 768px) {
    .profile-btn {
        padding: 6px 10px;
        gap: 6px;
    }

    .profile-name {
        display: none;
    }

    .profile-badge {
        font-size: 9px;
        padding: 2px 6px;
    }

    /* Overlay scuro dietro il dropdown */
    .profile-dropdown::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.7);
        z-index: -1;
    }

    .profile-dropdown {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 320px;
        min-width: unset;
        z-index: 2000;
        background: linear-gradient(145deg, #1a1a2e, #16213e);
        border: 2px solid var(--primary);
        border-radius: 16px;
        padding: 20px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8),
            0 0 30px rgba(255, 215, 0, 0.15);
    }

    .profile-dropdown-header {
        display: flex;
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding-bottom: 15px;
        margin-bottom: 15px;
        border-bottom: 1px solid rgba(255, 215, 0, 0.3);
    }

    .profile-id {
        font-size: 13px;
        color: #888;
        word-break: break-all;
    }

    .profile-expiry {
        font-size: 14px;
        font-weight: 600;
        color: var(--primary);
    }

    .profile-dropdown-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 16px;
        font-size: 16px;
        border-radius: 10px;
        margin-bottom: 8px;
        background: rgba(255, 255, 255, 0.05);
        transition: all 0.2s ease;
    }

    .profile-dropdown-item:hover,
    .profile-dropdown-item:active {
        background: rgba(255, 215, 0, 0.15);
        transform: scale(1.02);
    }

    .profile-dropdown-item.logout {
        background: rgba(255, 68, 68, 0.15);
        color: #ff6b6b;
    }

    .profile-dropdown-item.logout:hover,
    .profile-dropdown-item.logout:active {
        background: rgba(255, 68, 68, 0.25);
    }
}

@media (max-width: 480px) {
    .profile-dropdown {
        width: 92%;
        padding: 18px;
    }

    .profile-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* Footer Mobile Optimizations */
@media (max-width: 480px) {
    .footer-bottom-info {
        flex-direction: row !important;
        /* Keep items side-by-side like Desktop */
        align-items: center;
        gap: 8px;
        /* Slightly tighter gap */
        margin-bottom: 10px !important;
        /* Reduced space before Telegram icon */
    }

    .footer-text-group {
        text-align: right;
        margin-right: 8px;
        /* Space between text and 18+ icon */
    }

    .copyright-text,
    .gamble-warning {
        font-size: 11px;
        /* Smaller text for mobile */
        white-space: nowrap;
        /* Prevent wrapping if possible, or handle gracefully */
    }

    .footer-text-group .gamble-warning {
        display: block;
        /* Ensure it's on its own line if needed, or keep standard layout */
    }

    .plus18-circle {
        width: 32px;
        height: 32px;
        font-size: 11px;
        border-width: 2px;
        flex-shrink: 0;
        /* Don't shrink the icon */
    }
}

.telegram-btn-large {
    width: 50px;
    height: 50px;
    margin-bottom: 20px;
}

/* =========================================
   LOGIN MODAL STYLES (PREMIUM)
   ========================================= */
body.login-open {
    overflow: hidden;
    /* Prevent scrolling when modal is open */
}

.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.login-modal.visible {
    display: flex !important;
    opacity: 1;
}

.login-box {
    background: rgba(26, 31, 46, 0.95);
    width: 90%;
    max-width: 400px;
    border-radius: 16px;
    padding: 40px 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    text-align: center;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.login-modal.visible .login-box {
    transform: scale(1);
}

.login-box h2 {
    color: #fff;
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: 700;
}

.login-box input {
    width: 100%;
    padding: 14px 16px;
    margin: 8px 0 16px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.login-box input:focus {
    border-color: #FFD700;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.1);
}

.btn-login-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border: none;
    border-radius: 12px;
    font-weight: 700;
    color: #1a1f2e;
    font-size: 16px;
    margin-top: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-login-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 215, 0, 0.2);
}

.btn-login-submit:active {
    transform: translateY(0);
}

.auth-toggle-text {
    margin-top: 25px;
    font-size: 14px;
    color: #b0b3b8;
}

.btn-toggle-auth {
    background: none;
    border: none;
    color: #FFD700;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    margin-left: 5px;
    transition: color 0.2s;
}

.btn-toggle-auth:hover {
    color: #fff;
}

.login-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    transition: color 0.2s;
}

.login-close:hover {
    color: #fff;
}

.login-error {
    color: #ff4757;
    margin-bottom: 15px;
    font-size: 14px;
    min-height: 20px;
}

/* Shake animation for error */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.login-box.shake {
    animation: shake 0.5s;
}