/* public/assets/css/theme.css | 2026-04-07 10:00 | V.2.0 */
/* Tema dark mode professionale — Hub Formativo */
/* Palette: sfondo nero/grigio scuro, accenti azzurro/verde/rosso/giallo, testo bianco */

/* =============================================================================
   VARIABILI CSS — DARK MODE
   ============================================================================= */
:root {
    /* Sfondi */
    --color-bg:           #0f172a;   /* slate-900 */
    --color-surface:      #1e293b;   /* slate-800 */
    --color-surface-alt:  #334155;   /* slate-700 */
    --color-surface-hover:#475569;   /* slate-600 */
    --color-border:       #64748b;   /* slate-500 */
    --color-border-light: #94a3b8;   /* slate-400 */

    /* Testo */
    --color-text:         #e8ecf4;
    --color-text-light:   #94a3b8;   /* slate-400 */
    --color-text-muted:   #4a5166;

    /* Accenti */
    --color-blue:         #3b9eff;
    --color-blue-dark:    #7dc4ff;
    --color-blue-bg:      #1a2d4a;
    --color-success:      #22c55e;
    --color-success-bg:   #14291e;
    --color-warning:      #f59e0b;
    --color-warning-bg:   #2d2008;
    --color-danger:       #ef4444;
    --color-danger-bg:    #2d1212;
    --color-info:         #60a5fa;
    --color-info-bg:      #192040;

    /* Sidebar */
    --sidebar-width:      240px;
    --sidebar-bg:         #0f172a;   /* slate-900 */
    --sidebar-border:     #1e2233;
    --sidebar-text:       #8891a4;
    --sidebar-active-bg:  #1a2d4a;
    --sidebar-active-text:#3b9eff;

    /* Topbar */
    --topbar-height:      56px;
    --topbar-bg:          #1e293b;   /* slate-800 */
    --topbar-border:      #1e2233;

    /* Interattivi */
    --focus-ring:         0 0 0 3px rgba(59, 158, 255, 0.35);
    --radius:             6px;
    --radius-lg:          10px;
    --transition:         0.18s ease;

    /* Ombre */
    --shadow-sm:          0 1px 3px rgba(0,0,0,0.6);
    --shadow-md:          0 4px 12px rgba(0,0,0,0.5);
    --shadow-lg:          0 8px 24px rgba(0,0,0,0.6);
}

/* =============================================================================
   RESET & BASE
   ============================================================================= */
html {
    color-scheme: dark;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4, h5, h6 {
    color: var(--color-text);
    font-weight: 600;
    line-height: 1.3;
}

hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 1.5rem 0;
}

/* =============================================================================
   SCROLLBAR
   ============================================================================= */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--color-bg);
}
::-webkit-scrollbar-thumb {
    background: var(--color-border-light);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* =============================================================================
   LAYOUT — APP WRAPPER
   ============================================================================= */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* =============================================================================
   SIDEBAR
   ============================================================================= */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    overflow-y: auto;
    transition: transform var(--transition);
}

.sidebar-logo {
    padding: 20px 20px 16px;
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.2px;
    border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-logo span {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: var(--color-text-muted);
    margin-top: 2px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.sidebar-section {
    padding: 14px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-text-muted);
}

.sidebar-nav a {
    display: block;
    padding: 8px 16px;
    font-size: 13.5px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius);
    margin: 1px 8px;
    transition: background var(--transition), color var(--transition);
}
.sidebar-nav a:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
    text-decoration: none;
}
.sidebar-nav a.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
}

/* =============================================================================
   AREA PRINCIPALE
   ============================================================================= */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

/* =============================================================================
   SIDEBAR — STATO COLLAPSED (toggle topbar "Nascondi/Mostra menu")
   ============================================================================= */
html.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}
html.sidebar-collapsed .main-area {
    margin-left: 0;
}

/* =============================================================================
   TOPBAR
   ============================================================================= */
.topbar {
    height: var(--topbar-height);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-user {
    font-size: 13px;
    color: var(--color-text-light);
}

/* =============================================================================
   CONTENUTO PAGINA
   ============================================================================= */
.page-content {
    padding: 28px 28px 40px;
    flex: 1;
}

.page-header {
    margin-bottom: 24px;
}
.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text);
}
.page-subtitle {
    font-size: 13px;
    color: var(--color-text-light);
    margin-top: 4px;
}

/* =============================================================================
   CARD
   ============================================================================= */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--color-border);
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-alt);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* =============================================================================
   KPI / STAT CARDS
   ============================================================================= */
.card-stat {
    padding: 20px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.1;
}

.stat-label {
    font-size: 12px;
    color: var(--color-text-light);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 500;
}

/* =============================================================================
   TABELLE
   ============================================================================= */
.table-wrapper {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

thead {
    background: var(--color-surface-alt);
}

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

td {
    padding: 11px 14px;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--color-surface-hover);
}

/* =============================================================================
   FORM
   ============================================================================= */
.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-text-light);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
input[type="url"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    color: var(--color-text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: var(--focus-ring);
}

input::placeholder,
textarea::placeholder {
    color: var(--color-text-muted);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238891a4' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.form-help {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

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

/* =============================================================================
   PULSANTI
   ============================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition),
                color var(--transition), box-shadow var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Primario — Azzurro */
.btn-primary {
    background: var(--color-blue);
    border-color: var(--color-blue);
    color: #fff;
}
.btn-primary:hover {
    background: #2b8ef5;
    border-color: #2b8ef5;
    color: #fff;
    text-decoration: none;
}

/* Successo — Verde */
.btn-success {
    background: var(--color-success);
    border-color: var(--color-success);
    color: #fff;
}
.btn-success:hover {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
    text-decoration: none;
}

/* Attenzione — Giallo/Ambra */
.btn-warning {
    background: var(--color-warning);
    border-color: var(--color-warning);
    color: #0d0f14;
}
.btn-warning:hover {
    background: #d97706;
    border-color: #d97706;
    color: #0d0f14;
    text-decoration: none;
}

/* Pericolo — Rosso */
.btn-danger {
    background: var(--color-danger);
    border-color: var(--color-danger);
    color: #fff;
}
.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
    text-decoration: none;
}

/* Secondario — Grigio scuro */
.btn-secondary {
    background: var(--color-surface-alt);
    border-color: var(--color-border-light);
    color: var(--color-text);
}
.btn-secondary:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
    text-decoration: none;
}

/* Outline */
.btn-outline {
    background: transparent;
    border-color: var(--color-border-light);
    color: var(--color-text-light);
}
.btn-outline:hover {
    background: var(--color-surface-alt);
    border-color: var(--color-blue);
    color: var(--color-blue);
    text-decoration: none;
}

/* Ghost */
.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--color-blue);
}
.btn-ghost:hover {
    background: var(--color-blue-bg);
    color: var(--color-blue-dark);
    text-decoration: none;
}

/* Dimensioni */
.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}
.btn-lg {
    padding: 11px 22px;
    font-size: 15px;
}

/* Disabilitato */
.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* =============================================================================
   BADGE
   ============================================================================= */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    border: 1px solid transparent;
}

.badge-success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border-color: rgba(34,197,94,0.25);
}
.badge-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border-color: rgba(245,158,11,0.25);
}
.badge-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border-color: rgba(239,68,68,0.25);
}
.badge-info {
    background: var(--color-info-bg);
    color: var(--color-info);
    border-color: rgba(96,165,250,0.25);
}
.badge-secondary {
    background: var(--color-surface-alt);
    color: var(--color-text-light);
    border-color: var(--color-border);
}

/* Ruoli */
.badge-superadmin {
    background: rgba(245,158,11,0.15);
    color: var(--color-warning);
    border-color: rgba(245,158,11,0.3);
}
.badge-admin {
    background: var(--color-blue-bg);
    color: var(--color-blue);
    border-color: rgba(59,158,255,0.3);
}
.badge-user {
    background: var(--color-surface-alt);
    color: var(--color-text-light);
    border-color: var(--color-border);
}

/* =============================================================================
   ALERT
   ============================================================================= */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13.5px;
    border: 1px solid transparent;
    margin-bottom: 16px;
}
.alert a {
    font-weight: 600;
    text-decoration: underline;
}

.alert-success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border-color: rgba(34,197,94,0.25);
}
.alert-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border-color: rgba(245,158,11,0.25);
}
.alert-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border-color: rgba(239,68,68,0.25);
}
.alert-info {
    background: var(--color-info-bg);
    color: var(--color-info);
    border-color: rgba(96,165,250,0.25);
}

/* =============================================================================
   FLASH MESSAGES (da partials/flash.php)
   ============================================================================= */
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13.5px;
    border: 1px solid transparent;
    margin-bottom: 16px;
}
.flash-success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border-color: rgba(34,197,94,0.25);
}
.flash-error {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border-color: rgba(239,68,68,0.25);
}
.flash-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border-color: rgba(245,158,11,0.25);
}
.flash-info {
    background: var(--color-info-bg);
    color: var(--color-info);
    border-color: rgba(96,165,250,0.25);
}

/* =============================================================================
   LOGIN PAGE
   ============================================================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
}
.login-logo p {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* =============================================================================
   PAGINE DI ERRORE
   ============================================================================= */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    padding: 24px;
}

.error-card {
    text-align: center;
    max-width: 480px;
}

.error-code {
    font-size: 88px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 16px;
    letter-spacing: -3px;
}

.error-code-403 { color: var(--color-warning); }
.error-code-404 { color: var(--color-blue); }
.error-code-500 { color: var(--color-danger); }

.error-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 8px;
}

.error-message {
    font-size: 14px;
    color: var(--color-text-light);
    margin-bottom: 28px;
    line-height: 1.6;
}

/* =============================================================================
   UTILITY
   ============================================================================= */
.mb-0  { margin-bottom: 0 !important; }
.mb-1  { margin-bottom: 8px !important; }
.mb-2  { margin-bottom: 16px !important; }
.mb-3  { margin-bottom: 24px !important; }
.mb-4  { margin-bottom: 32px !important; }
.mt-0  { margin-top: 0 !important; }
.mt-1  { margin-top: 8px !important; }
.mt-2  { margin-top: 16px !important; }
.mt-3  { margin-top: 24px !important; }
.mt-4  { margin-top: 32px !important; }
.gap-1 { gap: 8px !important; }
.gap-2 { gap: 16px !important; }

.text-muted   { color: var(--color-text-muted) !important; }
.text-light   { color: var(--color-text-light) !important; }
.text-success { color: var(--color-success) !important; }
.text-danger  { color: var(--color-danger) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-blue    { color: var(--color-blue) !important; }

.text-right   { text-align: right !important; }
.text-center  { text-align: center !important; }
.text-small   { font-size: 12px !important; }

.d-flex       { display: flex !important; }
.align-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.flex-gap-2   { display: flex; gap: 16px; }
.flex-gap-1   { display: flex; gap: 8px; }

.w-100        { width: 100% !important; }

.font-mono {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12.5px;
}

/* =============================================================================
   PAGINAZIONE
   ============================================================================= */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 0;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid var(--color-border);
    color: var(--color-text-light);
    background: var(--color-surface);
    transition: all var(--transition);
}
.pagination a:hover {
    background: var(--color-surface-alt);
    color: var(--color-blue);
    border-color: var(--color-blue);
    text-decoration: none;
}
.pagination .active {
    background: var(--color-blue);
    border-color: var(--color-blue);
    color: #fff;
}
.pagination .disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* =============================================================================
   RESPONSIVE — MOBILE
   ============================================================================= */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-area {
        margin-left: 0;
    }
    .page-content {
        padding: 20px 16px 32px;
    }
    .card-grid {
        grid-template-columns: 1fr 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
    .topbar {
        padding: 0 16px;
    }
}
