/* DASHBOARD ADMIN V2 - STRICTLY MATCHING TOURNAMENT V2 */

.main-content {
    position: relative;
    z-index: 10;
    padding-top: 120px;
    padding-bottom: 80px;
}

/* La navbar flottante cambia altezza al restringersi: 96px su desktop,
   114 intorno ai 1024, 132 sotto i 600 (logo + hamburger). */
@media (max-width: 1100px) { .main-content { padding-top: 140px; } }
@media (max-width: 600px)  { .main-content { padding-top: 155px; } }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
}

/* ============================================
   INTESTAZIONI
   ============================================ */
.page-header {
    text-align: center;
    margin-bottom: 48px;
}

.page-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 1rem;
    color: white;
    letter-spacing: -1px;
}

.page-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.6);
}

.section-title {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    margin: 40px 0 16px;
}

/* ============================================
   STATI: caricamento / accesso negato
   ============================================ */
.gate-loading {
    text-align: center;
    padding: 80px 20px;
    color: rgba(255, 255, 255, 0.4);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 3px solid rgba(255, 255, 255, 0.05);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.gate-denied {
    max-width: 520px;
    margin: 40px auto 0;
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 50px 30px;
}
.gate-denied .material-symbols-outlined {
    font-size: 3rem;
    color: rgba(139, 92, 246, 0.6);
    margin-bottom: 12px;
}
.gate-denied h1 {
    font-size: 1.8rem;
    font-weight: 900;
    color: white;
    margin-bottom: 10px;
}
.gate-denied p {
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 28px;
}

/* ============================================
   BOTTONI
   ============================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #8b5cf6;
    color: white;
    padding: 12px 24px;
    border-radius: 100px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-primary:hover {
    background: #7c3aed;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    padding: 10px 20px;
    border-radius: 100px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); }
.btn-secondary .material-symbols-outlined { font-size: 1.15rem; }
.btn-secondary.spinning .material-symbols-outlined { animation: spin 1s linear infinite; }

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.6);
    padding: 8px 0;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.3s ease;
}
.btn-back:hover { color: white; transform: translateX(-3px); }

/* ============================================
   HUB: schede strumento (come .tournament-card)
   ============================================ */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.tool-card {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 28px;
    text-decoration: none;
    transition: all 0.3s ease;
}
.tool-card:hover {
    transform: translateY(-5px);
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.tool-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

/* doppia classe: il foglio di Google Fonts viene caricato dopo e la sua
   .material-symbols-outlined { display: inline-block } vincerebbe */
.tool-card .tool-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #a78bfa;
    font-size: 1.6rem;
}

.tool-badge {
    padding: 4px 12px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.tool-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: white;
    margin-bottom: 8px;
}

.tool-desc {
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
    margin-bottom: 20px;
    flex: 1;
}

.tool-open {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #8b5cf6;
    font-weight: 600;
    font-size: 0.9rem;
}
.tool-open .material-symbols-outlined { font-size: 1.1rem; transition: transform 0.3s ease; }
.tool-card:hover .tool-open .material-symbols-outlined { transform: translateX(4px); }

/* ============================================
   PAGINA STRUMENTO
   ============================================ */
.tool-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.tool-header .page-title {
    font-size: clamp(2.2rem, 4vw, 3.2rem);
    margin-bottom: 6px;
}
.tool-header .page-subtitle { text-align: left; }

.tool-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.last-update {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* tessere statistiche: stesse .stat-card della home */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
.stats-row .stat-val.is-online  { color: #22c55e; }
.stats-row .stat-val.is-offline { color: #ef4444; }

/* ============================================
   TABELLA DATI (come .leaderboard-table)
   ============================================ */
.data-panel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 10px 20px 20px;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 15px 10px;
    text-align: left;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    color: white;
    font-weight: 600;
    vertical-align: middle;
}
.data-table tbody tr { transition: background 0.3s ease; }
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

.sortable { cursor: pointer; user-select: none; transition: color 0.3s ease; }
.sortable:hover, .sortable.active-sort { color: white; }
.sort-icon {
    font-size: 0.95rem;
    vertical-align: middle;
    color: #8b5cf6;
}

.col-rank { color: rgba(255, 255, 255, 0.35); width: 50px; }
.col-num  { white-space: nowrap; }
.col-date { color: rgba(255, 255, 255, 0.6); font-weight: 500; white-space: nowrap; }

.server-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}
.server-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.server-icon-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 800;
}
.server-name { font-weight: 700; }

.owner-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-weight: 600;
}
.owner-id {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.75rem;
    font-weight: 500;
    font-family: 'Courier New', monospace;
}

.table-message {
    text-align: center;
    padding: 50px 20px !important;
    color: rgba(255, 255, 255, 0.4) !important;
}
.table-message.is-error { color: #f87171 !important; }

/* ============================================
   MODALE LOGIN (auth.js)
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.modal.show, .modal.active { display: flex; }
.modal-content {
    position: relative;
    background: #0a0b10;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    padding: 40px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-header h3 { font-size: 1.5rem; font-weight: 800; color: white; }
.modal-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}
.modal-close:hover { color: white; }
.discord-login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}
.discord-login-text { color: rgba(255, 255, 255, 0.6); }
.btn-discord {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    background: #5865F2;
    color: white;
    padding: 14px 24px;
    border-radius: 100px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-discord:hover { background: #4752c4; }

.admin-only { display: none; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .stats-row { grid-template-columns: 1fr 1fr; gap: 12px; }
    .tool-header { align-items: flex-start; }
    .data-panel { padding: 6px 10px 14px; }
    .owner-id { display: none; }
    .modal-content { padding: 24px; }
}
