/* ============================================================
   SiteScope Pro Icaro — Stile completo
   ============================================================ */

:root {
    --bg:        #0d0d14;
    --surface:   #13131e;
    --surface2:  #1a1a2a;
    --border:    #2a2a40;
    --accent:    #4f8ef7;
    --accent2:   #f97316;
    --success:   #10b981;
    --warning:   #f59e0b;
    --danger:    #ef4444;
    --purple:    #7c3aed;
    --text:      #e8e8f2;
    --text2:     #8888aa;
    --radius:    10px;
    --shadow:    0 4px 24px rgba(0,0,0,0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── LAYOUT ── */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
    width: 230px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.sidebar-logo {
    padding: 20px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 800; color: #fff;
    flex-shrink: 0;
}

.logo-name { font-size: 13px; font-weight: 700; line-height: 1.3; }
.logo-name span { color: var(--accent); }
.logo-sub { font-size: 10px; color: var(--text2); }

.sidebar-nav {
    flex: 1;
    padding: 14px 10px;
    overflow-y: auto;
}

.nav-group { margin-bottom: 20px; }

.nav-group-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 0 8px;
    margin-bottom: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border-radius: 7px;
    color: var(--text2);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    margin-bottom: 2px;
    text-decoration: none;
}
.nav-link:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.nav-link.active { background: rgba(79,142,247,0.12); color: var(--accent); font-weight: 600; }
.nav-link .icon { width: 18px; text-align: center; font-size: 15px; }

.sidebar-footer {
    padding: 14px;
    border-top: 1px solid var(--border);
}

.user-card {
    background: var(--surface2);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--purple), var(--accent));
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--text2); }

.btn-logout {
    background: none; border: none;
    color: var(--text2); cursor: pointer;
    font-size: 15px; padding: 4px;
    transition: color 0.15s;
}
.btn-logout:hover { color: var(--danger); }

/* ── MAIN ── */
.main {
    margin-left: 230px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky; top: 0;
    background: rgba(13,13,20,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 0 28px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 50;
}

.topbar-title { font-size: 16px; font-weight: 700; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

.content { padding: 26px 28px; flex: 1; }

/* ── BOTTONI ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: #3a7de0; border-color: #3a7de0; color: #fff; }

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.btn-success:hover { background: #059669; border-color: #059669; color: #fff; }

.btn-danger {
    background: transparent;
    border-color: var(--danger);
    color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }

/* ── CARDS ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
}

.card-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 16px;
}

/* ── GRID ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }

/* ── STAT CARDS ── */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}
.stat-card.blue::before   { background: var(--accent); }
.stat-card.orange::before { background: var(--accent2); }
.stat-card.red::before    { background: var(--danger); }
.stat-card.green::before  { background: var(--success); }

.stat-value { font-size: 32px; font-weight: 800; line-height: 1; margin-bottom: 6px; }
.stat-label { font-size: 12px; color: var(--text2); font-weight: 500; }
.stat-note  { font-size: 11px; color: var(--text2); margin-top: 8px; font-family: monospace; }

/* ── FORM ── */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 9px 13px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    outline: none;
    -webkit-appearance: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,142,247,0.12); }
.form-control::placeholder { color: var(--text2); }

textarea.form-control { resize: vertical; min-height: 100px; }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-row-4 { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 14px; align-items: end; }

/* ── TABELLA ── */
.table-wrap { overflow-x: auto; }

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

table.table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table.table td {
    padding: 12px 14px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: middle;
}

table.table tr:last-child td { border-bottom: none; }
table.table tbody tr:hover td { background: var(--surface2); }

/* ── BADGE ── */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.badge-red    { background: rgba(239,68,68,0.15);  color: #fca5a5; }
.badge-orange { background: rgba(249,115,22,0.15); color: #fdba74; }
.badge-yellow { background: rgba(245,158,11,0.15); color: #fcd34d; }
.badge-blue   { background: rgba(79,142,247,0.15); color: #93c5fd; }
.badge-green  { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.badge-purple { background: rgba(124,58,237,0.15); color: #c4b5fd; }
.badge-gray   { background: rgba(136,136,170,0.15); color: var(--text2); }

/* ── ALERT ── */
.alert {
    padding: 12px 16px;
    border-radius: 7px;
    margin-bottom: 16px;
    font-size: 13px;
    border-left: 3px solid;
}
.alert-danger  { background: rgba(239,68,68,0.1);  border-color: var(--danger);  color: #fca5a5; }
.alert-success { background: rgba(16,185,129,0.1); border-color: var(--success); color: #6ee7b7; }
.alert-info    { background: rgba(79,142,247,0.1); border-color: var(--accent);  color: #93c5fd; }

/* ── SCORE BAR ── */
.score-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}
.score-track {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}
.score-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.6s ease;
}
.score-val { font-size: 12px; font-weight: 700; width: 36px; text-align: right; }

/* ── LOGIN ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(79,142,247,0.08) 0%, transparent 70%);
}

.login-box {
    width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 40px;
    box-shadow: var(--shadow);
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.login-title { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.login-sub   { font-size: 12px; color: var(--text2); margin-bottom: 28px; font-family: monospace; }
.login-hint  { margin-top: 16px; font-size: 11px; color: var(--text2); text-align: center; font-family: monospace; }
.login-hint b { color: var(--accent); }

/* ── UTILITY ── */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 18px; }
.mb-4 { margin-bottom: 24px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.mt-4 { margin-top: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.text-muted { color: var(--text2); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.fw-bold { font-weight: 700; }
.mono { font-family: monospace; }
.text-accent  { color: var(--accent); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

/* ── SPINNER ── */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── NOTIFICA TOAST ── */
.toast {
    position: fixed;
    bottom: 24px; right: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 13px;
    z-index: 9999;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    max-width: 300px;
    box-shadow: var(--shadow);
}
.toast.show { transform: translateX(0); }
.toast-title { font-weight: 700; margin-bottom: 3px; }
.toast.success { border-color: var(--success); }
.toast.success .toast-title { color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.error .toast-title { color: var(--danger); }
