/* =========================================
   1. SETUP VARIABILI & RESET
   ========================================= */
:root {
    --bg-main: #121212;
    --bg-card: #1e1e1e;
    --bg-input: #2d2d2d;
    --accent: #00bcd4;
    --accent-hover: #00e5ff;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border: #333333;
    --radius: 12px;
    --shadow: 0 10px 30px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }

body {
    margin: 0; padding: 0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    padding-bottom: 50px;
}

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 15px; }

/* =========================================
   2. NAVIGAZIONE PRINCIPALE (TOPNAV)
   ========================================= */
.topnav {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
    margin-bottom: 20px; /* Ridotto margine per far spazio alla subnav */
    position: sticky; top: 0; z-index: 1000;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.topnav ul { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.topnav li { display: inline; }
.topnav a {
    display: block; color: var(--text-secondary); text-align: center;
    padding: 8px 16px; text-decoration: none; font-size: 14px; font-weight: 600;
    border-radius: 50px; transition: all 0.3s ease; border: 1px solid transparent;
}
.topnav a:hover { background-color: rgba(0, 188, 212, 0.1); color: var(--accent); }
.topnav a.active {
    color: var(--accent); background-color: rgba(0, 188, 212, 0.15); border-color: var(--accent);
    animation: neonPulse 2s infinite;
}

/* =========================================
   3. SOTTO-NAVIGAZIONE (TABS)
   ========================================= */
.subnav {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tab-btn {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 10px 24px;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
    width: auto; /* Sovrascrive il width 100% generico dei bottoni */
    margin-top: 0;
}

.tab-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.tab-btn.active-tab {
    background-color: var(--accent);
    color: #000;
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(0, 188, 212, 0.4);
}

/* =========================================
   4. LAYOUT & CARDS (Modificato)
   ========================================= */
/* Classe generica per le card invece di ID duplicati */
.card-panel {
    display: none; /* Nascosto di default */
    background-color: var(--bg-card);
    border-radius: var(--radius);
    padding: 30px;
    margin: 0 auto 30px auto;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    max-width: 600px;
    width: 95%;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Helper styles */
.col-md-15, .col-md-offset-2 { margin: 0 auto !important; padding: 0 !important; }

/* =========================================
   5. STILI GENERALI (INPUT, TYPO, ETC)
   ========================================= */
h3.h3single {
    margin-top: 0; color: var(--text-primary); text-transform: uppercase;
    letter-spacing: 1px; font-size: 1.5rem; border-bottom: 2px solid var(--accent);
    display: inline-block; padding-bottom: 10px; margin-bottom: 25px;
}
p.p, p.ptab, p.pread, p.pupdate {
    color: var(--accent); font-size: 0.9rem; font-weight: bold;
    text-transform: uppercase; margin-bottom: 8px; margin-top: 0;
}
.guidahide label { font-size: 0.8rem; color: #666; font-style: italic; font-weight: normal; }

input[type="text"], input[type="email"], input[type="password"], select {
    width: 100% !important; max-width: 100%;
    background-color: var(--bg-input); border: 1px solid var(--border);
    color: var(--text-primary); padding: 12px 15px; border-radius: 8px;
    font-size: 1rem; outline: none; transition: 0.3s; margin-bottom: 15px;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0, 188, 212, 0.2); background-color: #333; }

/* Select Arrow */
select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2300bcd4%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat; background-position: right 15px center; background-size: 12px; cursor: pointer;
}

/* Main Buttons (Action buttons inside forms) */
button[type="submit"], .btn-default {
    width: auto;            /* MODIFICA: Si adatta al testo invece di 100% */
    min-width: 200px;       /* MODIFICA: Larghezza minima per non essere troppo piccolo */
    display: block;         /* Necessario per il margin auto */
    margin: 20px auto;      /* MODIFICA: Centra il bottone orizzontalmente */
    
    background-color: var(--accent);
    color: #000;
    font-weight: 700;
    text-transform: uppercase;
    padding: 15px 40px;     /* Aumentato padding laterale per estetica */
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.2s, background-color 0.2s;
}

button:hover, .btn-default:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 188, 212, 0.4);
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

@keyframes neonPulse {
    0% { box-shadow: 0 0 5px rgba(0, 188, 212, 0.2); }
    50% { box-shadow: 0 0 15px rgba(0, 188, 212, 0.6); }
    100% { box-shadow: 0 0 5px rgba(0, 188, 212, 0.2); }
}
/* =========================================
   8. STILE TABELLA RISULTATI (Add-on)
   ========================================= */
.styled-table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    font-size: 1rem;
    font-family: 'Segoe UI', sans-serif;
    min-width: 400px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
}

.styled-table thead tr {
    background-color: #000; /* Testata nera */
    color: var(--accent);   /* Testo ciano */
    text-align: left;
    font-weight: bold;
    border-bottom: 2px solid var(--accent);
}

.styled-table th,
.styled-table td {
    padding: 15px 15px;
    border-bottom: 1px solid var(--border);
}

.styled-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s;
}

/* Effetto Hover sulla riga */
.styled-table tbody tr:hover {
    background-color: rgba(0, 188, 212, 0.15); /* Ciano trasparente */
}

/* Link dentro la tabella */
.styled-table a {
    color: var(--accent);
    text-decoration: none;
    font-weight: bold;
}
.styled-table a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Statistiche (Numero utenti) */
.stats {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
    display: block;
}
.stats span {
    color: var(--accent);
    font-weight: bold;
}