/* ── IMPORT VARIABILI BASE ───────────────────────────────────────────────── */
/* Questo file estende home.css — le pagine interne caricano entrambi        */

/* ── LAYOUT PAGINA INTERNA ───────────────────────────────────────────────── */
.page-wrapper {
    min-height: 100vh;
    padding-top: 80px; /* offset navbar fissa */
    background: var(--bg-dark);
}

.page-header {
    padding: 3rem 0 2rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(168,85,247,.04) 0%, transparent 100%);
}
.page-header h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: .4rem;
}
.page-header p { color: var(--text-muted); font-size: .95rem; }

/* ── FILTRI ──────────────────────────────────────────────────────────────── */
.filters {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: 2.5rem;
    padding-top: 2rem;
}
.filter-btn {
    padding: .4rem 1.1rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}
.filter-btn:hover,
.filter-btn.active {
    background: rgba(168,85,247,.15);
    border-color: var(--neon-purple);
    color: var(--neon-purple);
}

/* ── GRIGLIA TORNEI ──────────────────────────────────────────────────────── */
.tournaments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding-bottom: 4rem;
}

/* ── TOURNAMENT CARD ─────────────────────────────────────────────────────── */
.tournament-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    transform-style: preserve-3d;
}
.tournament-card:hover {
    transform: translateY(-6px);
    border-color: var(--neon-purple);
    box-shadow: var(--glow-purple);
}
.tournament-card .card-shine {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s;
    z-index: 2;
}
.tournament-card:hover .card-shine { opacity: 1; }

.tc-image {
    width: 100%;
    aspect-ratio: 16/7;
    object-fit: cover;
    display: block;
    filter: brightness(.75);
    transition: filter var(--transition);
}
.tournament-card:hover .tc-image { filter: brightness(.9); }

.tc-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.tc-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.tc-game {
    font-size: .78rem;
    color: var(--neon-green);
    font-weight: 600;
    letter-spacing: .5px;
}

.tc-type {
    padding: .2rem .65rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-blue));
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.tc-name {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
}

.tc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: .75rem;
    border-top: 1px solid var(--border);
}

.tc-slots {
    font-size: .82rem;
    color: var(--text-muted);
}
.tc-slots span { color: var(--text); font-weight: 600; }

/* Badge stato */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .7rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
}
.status-badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
}
.status-open    { background: rgba(34,211,238,.1); color: var(--neon-green); }
.status-open::before    { background: var(--neon-green); box-shadow: 0 0 6px var(--neon-green); animation: pulse 2s infinite; }
.status-ongoing { background: rgba(59,130,246,.1); color: var(--neon-blue); }
.status-ongoing::before { background: var(--neon-blue); }
.status-closed  { background: rgba(148,163,184,.1); color: var(--text-muted); }
.status-closed::before  { background: var(--text-muted); }

/* Barra progresso posti */
.slots-bar {
    height: 3px;
    background: rgba(255,255,255,.07);
    border-radius: 2px;
    overflow: hidden;
    margin-top: .3rem;
}
.slots-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--neon-purple), var(--neon-blue));
    transition: width .6s ease;
}

/* ── EMPTY STATE ─────────────────────────────────────────────────────────── */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 5rem 1rem;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state p { font-size: 1rem; }

/* ── PAGINA DETTAGLIO TORNEO ─────────────────────────────────────────────── */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2rem;
    padding: 2.5rem 0 4rem;
    align-items: start;
}

.detail-main {}

.detail-cover {
    width: 100%;
    aspect-ratio: 16/6;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    filter: brightness(.8);
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.detail-title {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 700;
    margin-bottom: 1.25rem;
    letter-spacing: .5px;
}

.detail-description {
    color: var(--text-muted);
    line-height: 1.75;
    font-size: .95rem;
    margin-bottom: 2rem;
}

/* Lista giocatori iscritti */
.players-section h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: .8rem;
}
.players-list {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}
.player-chip {
    padding: .3rem .85rem;
    border-radius: 999px;
    background: var(--bg-card2);
    border: 1px solid var(--border);
    font-size: .82rem;
    color: var(--text);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: .1rem;
}
.player-chip.is-me {
    border-color: var(--neon-green);
}
.player-name { font-weight: 600; }
.player-name .is-me { color: var(--neon-green); }
.player-tag  { font-size: .72rem; color: var(--text-muted); }

/* Dati in-game utente corrente */
.ingame-info {
    background: rgba(168,85,247,.06);
    border: 1px solid rgba(168,85,247,.2);
    border-radius: var(--radius);
    padding: .75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.ingame-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .82rem;
}
.ingame-row span  { color: var(--text-muted); }
.ingame-row strong { color: var(--neon-purple); font-weight: 700; }

/* Sidebar iscrizione */
.detail-sidebar {
    position: sticky;
    top: 100px;
}
.sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.sidebar-card h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .5px;
}
.sidebar-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .88rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border);
}
.sidebar-info-row:last-of-type { border-bottom: none; }
.sidebar-info-row .label { color: var(--text-muted); }
.sidebar-info-row .value { font-weight: 600; }

.btn-join {
    width: 100%;
    justify-content: center;
    padding: .9rem;
    font-size: 1rem;
}
.btn-leave {
    width: 100%;
    justify-content: center;
    padding: .9rem;
    font-size: 1rem;
    background: transparent;
    border: 1px solid rgba(239,68,68,.4);
    color: #ef4444;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}
.btn-leave:hover { background: rgba(239,68,68,.1); }

.sidebar-note {
    font-size: .78rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}

/* Toast notifica */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: .75rem 1.75rem;
    border-radius: 999px;
    font-size: .9rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity .3s ease, transform .3s ease;
    z-index: 999;
    pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: rgba(34,211,238,.15); border: 1px solid var(--neon-green); color: var(--neon-green); }
.toast.error   { background: rgba(239,68,68,.15);  border: 1px solid #ef4444; color: #ef4444; }

/* ── BACK LINK ──────────────────────────────────────────────────────────── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: var(--text-muted);
    font-size: .88rem;
    padding: 1.5rem 0 0;
    transition: var(--transition);
}
.back-link:hover { color: var(--neon-purple); }

/* ── RESPONSIVE ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .detail-layout { grid-template-columns: 1fr; }
    .detail-sidebar { position: static; }
}
@media (max-width: 600px) {
    .tournaments-grid { grid-template-columns: 1fr; }
}

/* ── MODAL ISCRIZIONE ────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}
.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 2rem;
    width: 100%;
    max-width: 480px;
    transform: translateY(16px);
    transition: transform .25s ease;
    box-shadow: 0 0 40px rgba(168,85,247,.12), 0 24px 60px rgba(0,0,0,.5);
}
.modal-overlay.open .modal {
    transform: translateY(0);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    padding: .25rem .4rem;
    border-radius: 6px;
    transition: color var(--transition), background var(--transition);
}
.modal-close:hover { color: var(--text); background: rgba(255,255,255,.06); }
