/*
 * /gest_pass/refactor_2/assets/css/app.css | Ultima modifica: 15/02/2026 | v3.0
 *
 * SCOPO:
 *   Stile UI SecurePass v3.0 — design premium SaaS dashboard.
 *   Dark mode nativo, micro-interazioni, glassmorphism, layout responsive.
 *
 * DIPENDENZE:
 *   - Nessun framework esterno
 *   - Font stack di sistema (nessun download)
 *
 * PALETTE DESIGN:
 *   - Light: sfondo grigio caldo, superfici bianche, accent indaco/blue
 *   - Dark: sfondo quasi-nero, superfici grigio scuro, accent blue luminoso
 *
 * VINCOLI:
 *   - NESSUN CSS INLINE nei file PHP (regola COMMENTA.md #2)
 *   - Compatibilita' browser: Chrome 90+, Firefox 88+, Safari 14+, Edge 90+
 *   - Nessuna dipendenza da CDN
 *
 * STORICO MODIFICHE:
 *   - 15/02/2026 v1.0: prima versione base
 *   - 15/02/2026 v2.0: glassmorphism, dark mode, toast, modal, stat cards
 *   - 15/02/2026 v3.0: redesign completo SaaS premium
 */

/* =============================================================================
   1. CUSTOM PROPERTIES — DESIGN TOKENS
   Scopo: centralizzare tutti i valori di design in un unico punto.
   Criticita': modificare qui impatta TUTTA la UI.
   ============================================================================= */
:root {
  /* — Accent / Brand — */
  --accent: #4f6ef7;
  --accent-hover: #3b5de5;
  --accent-glow: rgba(79, 110, 247, 0.18);
  --accent-subtle: rgba(79, 110, 247, 0.07);
  --accent-border: rgba(79, 110, 247, 0.22);
  --accent-gradient: linear-gradient(135deg, #4f6ef7 0%, #7c5bf5 100%);

  /* — Superfici — */
  --bg: #f4f6fa;
  --bg-pattern: radial-gradient(ellipse at 30% 0%, rgba(79, 110, 247, 0.04) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 100%, rgba(124, 91, 245, 0.03) 0%, transparent 50%);
  --surface: #ffffff;
  --surface-dim: #f8f9fc;
  --surface-hover: #f1f4fb;
  --surface-raised: #ffffff;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.88);

  /* — Bordi — */
  --border: rgba(0, 0, 0, 0.07);
  --border-strong: rgba(0, 0, 0, 0.12);
  --border-accent: rgba(79, 110, 247, 0.2);

  /* — Testo — */
  --text: #1a1d26;
  --text-secondary: #5b6178;
  --text-muted: #8e95a9;
  --text-on-accent: #ffffff;

  /* — Semantici — */
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.08);
  --success-border: rgba(16, 185, 129, 0.2);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.06);
  --danger-border: rgba(239, 68, 68, 0.18);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.08);
  --warning-border: rgba(245, 158, 11, 0.2);
  --info: #3b82f6;

  /* — Ombre — */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 16px 64px rgba(0, 0, 0, 0.10), 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-accent: 0 4px 16px rgba(79, 110, 247, 0.2);
  --shadow-focus: 0 0 0 3px rgba(79, 110, 247, 0.2);

  /* — Raggi / spaziatura — */
  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --topbar-h: 68px;

  /* — Transizioni — */
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --speed: 0.2s;
  --speed-slow: 0.35s;
}

/* -----------------------------------------------------------------------------
   1b. DARK MODE OVERRIDES
   Scopo: invertire palette mantenendo leggibilita' e contrasto WCAG AA.
   ----------------------------------------------------------------------------- */
[data-theme="dark"] {
  --bg: #0c0e14;
  --bg-pattern: radial-gradient(ellipse at 30% 0%, rgba(79, 110, 247, 0.06) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 100%, rgba(124, 91, 245, 0.04) 0%, transparent 50%);
  --surface: #181b25;
  --surface-dim: #141720;
  --surface-hover: #1e2230;
  --surface-raised: #1e2230;
  --glass: rgba(24, 27, 37, 0.80);
  --glass-strong: rgba(24, 27, 37, 0.92);

  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.10);

  --text: #e8eaf0;
  --text-secondary: #9ba1b5;
  --text-muted: #636b82;

  --accent-glow: rgba(79, 110, 247, 0.14);
  --accent-subtle: rgba(79, 110, 247, 0.10);

  --success-bg: rgba(16, 185, 129, 0.10);
  --danger-bg: rgba(239, 68, 68, 0.10);
  --warning-bg: rgba(245, 158, 11, 0.10);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 16px 64px rgba(0, 0, 0, 0.35);
  --shadow-accent: 0 4px 16px rgba(79, 110, 247, 0.15);
}

/* =============================================================================
   2. RESET E BASE
   Scopo: azzerare default browser e impostare tipografia di sistema.
   ============================================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  background-image: var(--bg-pattern);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--speed) var(--ease);
}
a:hover { color: var(--accent-hover); }

::selection {
  background: var(--accent);
  color: white;
}

/* =============================================================================
   3. LAYOUT SHELL
   Scopo: contenitore centrato con larghezza massima responsive.
   ============================================================================= */
.shell {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
}

main.shell {
  padding: 28px 0 56px;
}

/* =============================================================================
   4. TOPBAR — Navigazione principale
   Scopo: barra fissa in alto con glassmorphism e branding.
   Criticita': z-index alto per stare sopra contenuto scrollabile.
   ============================================================================= */
.topbar {
  background: var(--glass-strong);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
}

/* --- Brand --- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
  transition: opacity var(--speed) var(--ease);
}
.brand:hover { opacity: 0.85; color: var(--text); }

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  object-fit: contain;
}

.brand-text {
  font-size: 1.12rem;
  font-weight: 750;
  letter-spacing: -0.4px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Navigazione --- */
.nav {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  flex: 1;
  justify-content: center;
}

.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-xs);
  font-size: 0.86rem;
  font-weight: 530;
  transition: all var(--speed) var(--ease);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  letter-spacing: 0.1px;
}

.nav-link:hover {
  color: var(--accent);
  background: var(--accent-subtle);
}

.nav-link.is-active {
  color: var(--accent);
  background: var(--accent-glow);
  font-weight: 600;
}

.nav-link.is-active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.nav-icon {
  width: 16px;
  height: 16px;
  opacity: 0.65;
  transition: opacity var(--speed) var(--ease);
}
.nav-link:hover .nav-icon,
.nav-link.is-active .nav-icon { opacity: 1; }

/* --- Badge messaggi non letti --- */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: white;
  font-size: 0.66rem;
  font-weight: 700;
  margin-left: 3px;
  animation: badge-pulse 2s ease infinite;
}

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* --- Identity / Profilo --- */
.identity {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 530;
  transition: all var(--speed) var(--ease);
}
.user-chip:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* --- Theme Toggle --- */
.theme-toggle {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-xs);
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--speed) var(--ease);
  font-size: 1rem;
  padding: 0;
}
.theme-toggle:hover {
  background: var(--accent-subtle);
  border-color: var(--accent-border);
  color: var(--accent);
  transform: rotate(15deg);
}

/* =============================================================================
   5. PANELS / CARDS
   Scopo: contenitori principali con effetto vetro e ombra.
   ============================================================================= */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px;
  margin: 18px 0;
  transition: box-shadow var(--speed-slow) var(--ease), transform var(--speed-slow) var(--ease);
}

.panel:hover {
  box-shadow: var(--shadow-lg);
}

.panel-narrow {
  width: min(480px, 100%);
  margin: 48px auto;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* =============================================================================
   6. TIPOGRAFIA
   ============================================================================= */
h1, h2, h3 {
  color: var(--text);
  letter-spacing: -0.4px;
  line-height: 1.3;
}

h1 {
  font-size: 1.45rem;
  font-weight: 750;
  margin-bottom: 16px;
}

h2 {
  font-size: 1.08rem;
  font-weight: 650;
  margin: 24px 0 12px;
  color: var(--text-secondary);
}

.hint {
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* =============================================================================
   7. FORMS
   Scopo: griglia 12 colonne per layout form flessibile.
   ============================================================================= */
.form-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  grid-column: span 4;
}

.field > span {
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 580;
  letter-spacing: 0.2px;
}

.field-wide { grid-column: span 12; }

input, select, textarea {
  width: 100%;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  padding: 11px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  transition: all var(--speed) var(--ease);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
  background: var(--surface);
}

input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) {
  border-color: var(--text-muted);
}

input[readonly] {
  background: var(--accent-subtle);
  border-color: var(--accent-border);
  color: var(--text);
  cursor: default;
}

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

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.check {
  grid-column: span 12;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  cursor: pointer;
  padding: 4px 0;
}

.checks {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-dim);
  padding: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.check-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.82rem;
  color: var(--text-secondary);
  transition: all var(--speed) var(--ease);
  cursor: pointer;
}
.check-item:hover {
  border-color: var(--accent-border);
  background: var(--accent-subtle);
  color: var(--accent);
}

.search-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.search-form input {
  width: 220px;
}

/* =============================================================================
   8. BOTTONI
   Scopo: tre varianti (primario, soft, danger) + taglia sm.
   ============================================================================= */
.btn {
  appearance: none;
  border: 1.5px solid transparent;
  border-radius: var(--radius-xs);
  background: var(--accent);
  color: var(--text-on-accent);
  padding: 9px 18px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.86rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--speed) var(--ease);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-accent);
  transform: translateY(-1px);
  color: var(--text-on-accent);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-soft {
  background: var(--surface);
  color: var(--text-secondary);
  border-color: var(--border-strong);
}
.btn-soft:hover {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: var(--accent-border);
  box-shadow: var(--shadow-xs);
}

.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--danger-border);
}
.btn-danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
  border-radius: 7px;
}

/* Icona inline (entity HTML per compat no-emoji) */
.i {
  width: 16px;
  text-align: center;
  line-height: 1;
  font-style: normal;
  font-size: 0.88em;
  flex-shrink: 0;
}

/* =============================================================================
   9. FLASH / TOAST MESSAGES
   Scopo: feedback visuale per azioni utente (server-side e client-side).
   ============================================================================= */
.flash {
  border-radius: var(--radius-sm);
  padding: 13px 18px;
  font-size: 0.88rem;
  margin: 14px 0;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 520;
  animation: flash-in 0.4s var(--ease-out);
}

@keyframes flash-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.flash-ok {
  color: var(--success);
  background: var(--success-bg);
  border-color: var(--success-border);
}

.flash-error {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: var(--danger-border);
}

/* --- Toast (JS-driven) --- */
.toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  font-size: 0.86rem;
  font-weight: 530;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.35s var(--ease-out);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  pointer-events: auto;
}

.toast-ok { border-left: 3px solid var(--success); }
.toast-err { border-left: 3px solid var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(28px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(28px) scale(0.95); }
}

/* =============================================================================
   10. TABELLE
   Scopo: tabelle dati con header sticky e row hover.
   ============================================================================= */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

th, td {
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  vertical-align: top;
  text-align: left;
  font-size: 0.86rem;
}

th {
  background: var(--surface-dim);
  color: var(--text-secondary);
  font-weight: 620;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  position: sticky;
  top: 0;
  z-index: 2;
}

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

tbody tr {
  transition: background var(--speed) var(--ease);
}

tbody tr:hover {
  background: var(--accent-subtle);
}

/* =============================================================================
   11. UTILITY CLASSES
   ============================================================================= */
.actions-inline {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.inline {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.mini-input { width: 180px; }

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 620;
  letter-spacing: 0.3px;
}

.tag-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.mono {
  white-space: pre-wrap;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--surface-dim);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 2.8rem;
  margin-bottom: 14px;
  opacity: 0.35;
  filter: grayscale(0.4);
}

.empty-state p {
  font-size: 0.92rem;
  font-weight: 480;
}

/* =============================================================================
   12. STAT CARDS — Dashboard admin
   Scopo: griglia di card con metrica principale e label.
   ============================================================================= */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: all var(--speed-slow) var(--ease);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--speed-slow) var(--ease);
}

.stat-card:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 750;
  color: var(--accent);
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 530;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =============================================================================
   13. CREDENZIALI — Card display
   ============================================================================= */
.cred-card {
  display: grid;
  gap: 16px;
  max-width: 560px;
}

.cred-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cred-field .field {
  flex: 1;
  margin: 0;
}

.cred-field .btn { flex-shrink: 0; }

/* =============================================================================
   13b. UTILITY CLASSES (CSP-safe replacements per style="...")
   Scopo: sostituire attributi style inline rimasti in index.php cosi' da
   poter mantenere la CSP senza 'unsafe-inline' (SECURITY_REVIEW S5).
   ============================================================================= */

/* Nota informativa sulla pagina di login (avviso primo avvio).
   Aggiunge spazio sopra per separarla visivamente dal form. */
.login-bootstrap-note { margin-top: 14px; }

/* Etichetta "Non letto" nell'inbox: usa il colore accent del tema. */
.text-accent { color: var(--accent); }

/* Cella tabellare con font monospace senza background/padding (a differenza
   di .mono usata sui blocchi <pre>). Adatta a timestamp, IP, JSON payload. */
.tabular {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  word-break: break-word;
}

/* Riga paginazione (prev / info / next) in fondo alle tabelle filtrabili. */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* Pulsante disabilitato (es. paginazione al primo/ultimo pagina). */
.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Form filtri audit log: layout a colonne con allineamento del bottone Filtra. */
.audit-filter { align-items: end; }
.audit-filter .field > span { font-size: 0.78rem; }

/* =============================================================================
   14. LOGIN PAGE
   Scopo: layout centrato verticalmente con brand prominente.
   ============================================================================= */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--topbar-h) - 56px);
}

.login-page .panel {
  text-align: center;
}

.login-page h1 {
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 24px;
}

.login-page .form-grid {
  text-align: left;
}

.login-page .field {
  grid-column: span 12;
}

.login-page .btn[type="submit"] {
  grid-column: span 12;
  justify-content: center;
  padding: 13px;
  font-size: 0.94rem;
  background: var(--accent-gradient);
  border: none;
}
.login-page .btn[type="submit"]:hover {
  box-shadow: var(--shadow-accent);
  filter: brightness(1.05);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.login-brand .brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

/* =============================================================================
   15. MODAL CONFERMA
   Scopo: overlay modale per azioni distruttive con animazione.
   ============================================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.2s var(--ease);
}

.modal-box {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 28px;
  max-width: 420px;
  width: calc(100% - 40px);
  animation: modal-in 0.3s var(--ease-out);
}

.modal-box h3 {
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.modal-box p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 22px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* =============================================================================
   16. PASSWORD STRENGTH METER
   ============================================================================= */
.pw-meter {
  height: 4px;
  border-radius: 2px;
  background: var(--border-strong);
  overflow: hidden;
  margin-top: 6px;
}

.pw-meter-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.35s var(--ease), background 0.35s var(--ease);
  width: 0;
}

.pw-weak   { background: var(--danger);  width: 33%; }
.pw-medium { background: var(--warning); width: 66%; }
.pw-strong { background: var(--success); width: 100%; }

/* =============================================================================
   17. SCROLLBAR PERSONALIZZATA
   Scopo: scrollbar sottile coerente con il tema.
   ============================================================================= */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* =============================================================================
   18. RESPONSIVE
   ============================================================================= */
@media (max-width: 1024px) {
  .topbar-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 0;
    gap: 10px;
  }

  .nav { justify-content: flex-start; order: 3; width: 100%; }
  .identity { order: 2; }

  .field { grid-column: span 6; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  html { font-size: 14px; }
  .shell { width: calc(100% - 28px); }

  .panel {
    padding: 20px;
    border-radius: var(--radius);
  }

  .field { grid-column: span 12; }
  .stat-cards { grid-template-columns: 1fr; }
  table { min-width: 580px; }

  .search-form {
    width: 100%;
    flex-wrap: wrap;
  }
  .search-form input { width: 100%; flex: 1; }
}

/* =============================================================================
   19. STAMPA
   Scopo: nascondere elementi interattivi per output pulito.
   ============================================================================= */
@media print {
  .topbar, .btn, .search-form, .toast-container,
  .theme-toggle, .user-chip, .identity { display: none !important; }
  body { background: white !important; color: black !important; }
  .panel { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .table-wrap { overflow: visible; }
  table { min-width: auto; }
}
