/* Palette Colori e Variabili */
:root {
    --bg-dark: #000000;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --neon-purple: #bc13fe;
    --electric-cyan: #13feff;
    --gradient-cta: linear-gradient(90deg, #13feff 0%, #bc13fe 100%);
}

/* Stili Globali e Gestione Layout Unificato */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* Previene scroll orizzontali accidentali */
}

body {
    font-family: 'Manrope', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-secondary);
    -webkit-font-smoothing: antialiased;
    
    /* Configurazione Flexbox per ancorare il footer al fondo dello schermo */
    display: flex;
    flex-direction: column;
    min-height: 100vh; 
}

h1, h2, h3 { color: var(--text-primary); font-weight: 700; text-align: center; margin-top: 0; }
h1 { font-size: 2.5rem; margin-bottom: 0.5rem; } 
h2 { font-size: 2rem; margin-bottom: 1.5rem; }
p { margin-top: 0; }

/* Contenitore Principale Flessibile */
.container {
    max-width: 1100px;
    margin: 70px auto 20px; 
    padding: 0 20px;
    position: relative;
    z-index: 10;
    
    flex: 1; /* Riempe lo spazio disponibile spingendo il footer in fondo */
    width: 100%;
    box-sizing: border-box;
}

/* RESET ELEMENTI IN CIMA */
.container > *:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Bagliore di Sfondo Fisso su tutto il Viewport */
.glow-background {
    position: fixed; 
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 50% 25%, rgba(19, 254, 255, 0.07) 0%, rgba(0, 0, 0, 0) 55%),
                radial-gradient(circle at 50% 65%, rgba(188, 19, 254, 0.06) 0%, rgba(0, 0, 0, 0) 60%);
    pointer-events: none;
    z-index: 1;
}

/* Modulo Header */
header {
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    color: var(--text-primary);
    padding: 1rem 0; 
    position: fixed; 
    width: 100%; 
    top: 0; 
    z-index: 1000;
}

header .header-inner {
    max-width: 1100px; margin: 0 auto; padding: 0 20px;
    display: flex; justify-content: space-between; align-items: center;
}

header .logo {
    font-size: 1.5rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-primary); text-decoration: none; display: flex; align-items: center; gap: 10px;
}
header .logo span {
    width: 15px; height: 15px; border-radius: 50%;
    background: var(--gradient-cta); display: inline-block;
}

header nav { display: flex; gap: 30px; }
header nav a {
    color: var(--text-secondary); text-decoration: none; font-weight: 600; font-size: 0.95rem;
    transition: 0.2s ease;
}
header nav a:hover, header nav a.active { color: var(--text-primary); }

/* Pulsante CTA Header */
.header-cta {
    background: none; border: 2px solid var(--electric-cyan); border-radius: 50px;
    padding: 10px 25px; color: var(--text-primary); text-decoration: none; font-weight: 700;
    font-size: 0.9rem; transition: 0.3s ease;
}
.header-cta:hover {
    box-shadow: 0 0 15px var(--electric-cyan); background-color: var(--electric-cyan); color: var(--bg-dark);
}

/* Struttura del pulsante Hamburger (Nascosto di base su PC) */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1010;
}
.menu-toggle span {
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    transition: 0.3s ease;
}
/* Trasformazione in "X" quando il menu si apre */
.menu-toggle.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* Modulo Footer Ottimizzato */
footer {
    background-color: #050505; 
    color: var(--text-secondary); 
    padding: 1rem 0; 
    border-top: 1px solid #111; 
    text-align: center; 
    font-size: 0.85rem;
    width: 100%;
    margin-top: auto; 
    position: relative;
    z-index: 10;
}

/* Stili Card Griglia (Artisti, Eventi) */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 30px; margin-top: 40px; }
.card {
    background-color: #080808; border-radius: 15px; padding: 30px;
    transition: 0.3s ease; cursor: pointer; text-align: left;
    display: flex; flex-direction: column; gap: 15px;
    position: relative; overflow: hidden;
}
.card:hover { transform: translateY(-5px); box-shadow: 0 10px 40px -10px rgba(188, 19, 254, 0.4); }

.card-icon {
    width: 45px; height: 45px; border-radius: 50%; border: 1.5px solid #222;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); font-size: 1.2rem;
}

.card h3 { color: var(--text-primary); font-size: 1.4rem; font-weight: 700; text-align: left; margin: 0; }
.card p { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; margin: 0; }

/* Modale (Popup) */
.modal {
    display: none; position: fixed; z-index: 1000; left: 0; top: 0;
    width: 100%; height: 100%; background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
}

.modal-content {
    background-color: #080808; margin: 8% auto; padding: 40px;
    border-radius: 20px; width: 70%; max-width: 900px;
    box-shadow: 0 0 50px -10px rgba(188, 19, 254, 0.6), 0 0 50px -10px rgba(19, 254, 255, 0.6);
    position: relative; color: var(--text-primary);
    display: flex; gap: 40px;
}

.close { color: #555; position: absolute; right: 25px; top: 15px; font-size: 30px; font-weight: 700; cursor: pointer; transition: 0.2s; }
.close:hover { color: var(--text-primary); }

.modal-left { flex: 2; display: flex; flex-direction: column; gap: 20px; }
.modal-right { flex: 1; text-align: center; padding-left: 40px; border-left: 1px solid #1a1a1a; display: flex; flex-direction: column; justify-content: space-between; align-items: center; }

.modal h2 { color: var(--text-primary); text-align: left; font-size: 2.2rem; }

/* Lista Canzoni / Dettagli Evento */
.song-list { display: flex; flex-direction: column; gap: 15px; }
.song-item, .event-detail-item {
    display: flex; align-items: center; gap: 15px;
}
.song-icon {
    width: 35px; height: 35px; border-radius: 50%; background-color: #111;
    display: flex; align-items: center; justify-content: center; color: var(--text-secondary); font-size: 1rem;
}
.song-info { flex: 1; }
.song-title { color: var(--text-primary); font-weight: 600; display: block; font-size: 1.05rem; text-decoration: none; }
.song-title:hover { text-decoration: underline; color: var(--electric-cyan); }
.song-type { color: var(--text-secondary); font-size: 0.85rem; }

.event-detail-item strong { color: var(--text-primary); }

/* Pulsanti CTA */
.btn-cta {
    background: var(--gradient-cta); border: none; border-radius: 50px;
    padding: 15px 40px; color: var(--bg-dark); font-weight: 800; font-size: 1.1rem;
    text-transform: uppercase; text-decoration: none; transition: 0.3s ease;
    cursor: pointer; width: 100%; display: inline-block; margin-top: 20px;
    text-align: center; box-sizing: border-box;
}
.btn-cta:hover { transform: scale(1.02); box-shadow: 0 5px 25px rgba(19, 254, 255, 0.4); }

.price-text { font-size: 3rem; font-weight: 800; color: var(--text-primary); }
.guarantee-text { font-size: 0.85rem; color: var(--text-secondary); margin-top: 10px; }

/* Stili Form (Login / Admin) */
.form-card {
    background-color: #080808; border-radius: 20px; padding: 40px;
    max-width: 450px; margin: 0 auto;
    box-shadow: 0 0 50px -10px rgba(188, 19, 254, 0.3); border: 1px solid #111;
}
.form-group { text-align: left; margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; color: var(--text-primary); font-size: 0.9rem; font-weight: 600; letter-spacing: 0.5px; }
.form-control { width: 100%; padding: 14px; background-color: #111; border: 1px solid #222; border-radius: 8px; color: var(--text-primary); font-family: inherit; font-size: 1rem; box-sizing: border-box; transition: 0.3s ease; }
.form-control:focus { outline: none; border-color: var(--electric-cyan); box-shadow: 0 0 15px rgba(19, 254, 255, 0.2); }
.error-msg { color: #ff3333; background: rgba(255, 51, 51, 0.1); border: 1px solid rgba(255, 51, 51, 0.3); padding: 12px; border-radius: 8px; margin-bottom: 20px; font-size: 0.9rem; text-align: center; }

/* Dashboard Admin */
.welcome-box { text-align: left; margin-bottom: 40px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #111; padding-bottom: 20px; }
.role-badge { padding: 6px 16px; border-radius: 50px; font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; display: inline-block; }
.role-admin { color: var(--neon-purple); border: 1px solid var(--neon-purple); box-shadow: 0 0 10px rgba(188, 19, 254, 0.2); }
.role-artist { color: var(--electric-cyan); border: 1px solid var(--electric-cyan); box-shadow: 0 0 10px rgba(19, 254, 255, 0.2); }
.card-action-btn { margin-top: auto; background: #111; border: 1px solid #222; color: var(--text-primary); padding: 10px 15px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 0.85rem; text-align: center; transition: 0.2s ease; }
.card:hover .card-action-btn { border-color: var(--text-primary); background: #151515; }

/* Tabelle Gestionali */
table { width: 100%; border-collapse: collapse; margin-top: 30px; background: #080808; border-radius: 12px; overflow: hidden; border: 1px solid #111; }
th, td { padding: 16px; text-align: left; border-bottom: 1px solid #111; }
th { background-color: #111; color: var(--text-primary); font-weight: 700; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px; }
tr:hover { background-color: #0c0c0c; }
.btn-delete { color: #ff3333; text-decoration: none; font-weight: 700; transition: 0.2s; }
.btn-delete:hover { text-shadow: 0 0 10px #ff3333; }
.empty-message { color: var(--text-secondary); font-size: 1rem; text-align: center; font-style: italic; padding: 30px 20px; background-color: #111; border-radius: 12px; border: 1px dashed #333; margin-top: 10px; box-shadow: inset 0 0 10px rgba(0,0,0,0.5); }


/* ==========================================
   SISTEMAZIONE COMPLETA RESPONSIVE (MOBILE)
   ========================================== */
@media (max-width: 768px) {
    /* 1. Gestione Fluidità dei Font Globali */
    h1 { font-size: 1.85rem; }
    h2 { font-size: 1.5rem; margin-bottom: 1rem; }
    .price-text { font-size: 2.2rem; }

    /* 2. Ottimizzazione Spazi Generali */
    .container { 
        margin-top: 85px; /* Evita sovrapposizioni con l'header fisso */
        padding: 0 16px; 
    }
    .form-card { padding: 25px 20px; }
    .card { padding: 22px; gap: 12px; }

    /* 3. Rivoluzione Mobile dell'Header (Hamburger Menu) */
    .menu-toggle { display: flex; } /* Mostra l'hamburger */
    
    header { padding: 0.8rem 0; }
    header .header-inner { flex-wrap: wrap; } /* Permette ai menu di scivolare sotto */

    header nav {
        display: none; /* Nasconde i link standard */
        flex-direction: column;
        width: 100%;
        gap: 0;
        padding-top: 15px;
        text-align: center;
    }
    header nav a {
        display: block;
        padding: 12px 0;
        font-size: 1.05rem;
        border-bottom: 1px solid rgba(255,255,255,0.03);
    }
    header nav a:last-child { border-bottom: none; }

    header .header-actions {
        display: none !important; /* Resetta lo stile inline su mobile */
        flex-direction: column;
        width: 100%;
        gap: 10px;
        padding: 15px 0 5px;
    }
    .header-cta {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
        padding: 12px;
    }

    /* Classi di attivazione al click (gestite dallo Script in navbar) */
    header.menu-open nav { display: flex; }
    header.menu-open .header-actions { display: flex !important; }

    /* 4. Fix delle Finestre Modali (Popup Artisti/Eventi) */
    .modal-content {
        width: 92%;
        max-height: 85vh; /* Evita che esca dallo schermo in altezza */
        overflow-y: auto; /* Attiva lo scroll interno alla finestra */
        flex-direction: column;
        padding: 25px 20px;
        margin: 15% auto;
        gap: 25px;
    }
    .modal-right {
        padding-left: 0;
        border-left: none;
        border-top: 1px solid #1a1a1a;
        padding-top: 25px;
        gap: 20px;
    }
    .modal h2 { font-size: 1.6rem; }

    /* 5. Fix per la Dashboard Amministrativa */
    .welcome-box {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    /* FIX SALVA-VITA: Rende le tabelle scorrevoli orizzontalmente ed evita lo scompaginamento */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    th, td { padding: 12px 10px; font-size: 0.85rem; }
}