/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* =============================================
   TYPOGRAPHY
   ============================================= */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  color: var(--text);
}

/* =============================================
   NAVBAR (solo per landing/login — usa classe specifica)
   ============================================= */
nav.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.nav-logo img {
  height: 36px;
  width: auto;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* =============================================
   TOGGLE TEMA
   ============================================= */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle-track {
  width: 44px;
  height: 24px;
  background: var(--toggle-bg);
  border-radius: 12px;
  position: relative;
  transition: background 0.3s ease;
  border: 1px solid var(--border);
}

.toggle-knob {
  width: 18px;
  height: 18px;
  background: var(--toggle-knob);
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.3s ease, background 0.3s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

[data-theme="dark"] .toggle-knob {
  transform: translateX(20px);
}

.toggle-icon { font-size: 14px; }

/* =============================================
   BUTTONS
   ============================================= */
.btn-primary {
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-body);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary:hover {
  background: var(--accent-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-secondary {
  padding: 10px 24px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-body);
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* =============================================
   CARDS
   ============================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: all 0.2s ease;
}

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

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

.card-body { padding: 20px; }

/* =============================================
   BADGES
   ============================================= */
.badge {
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-body);
}

.badge-success { background: rgba(63,185,80,0.12);  color: var(--success); border: 1px solid rgba(63,185,80,0.25); }
.badge-warning { background: rgba(210,153,34,0.12); color: var(--warning); border: 1px solid rgba(210,153,34,0.25); }
.badge-danger  { background: rgba(248,81,73,0.12);  color: var(--danger);  border: 1px solid rgba(248,81,73,0.25); }
.badge-accent  { background: var(--accent-soft);    color: var(--accent);  border: 1px solid var(--accent-glow); }
.badge-muted   { background: var(--bg-subtle);      color: var(--text-2);  border: 1px solid var(--border); }

/* =============================================
   SEMAFORI SCADENZE
   ============================================= */
.semaforo {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.semaforo-green  { background: var(--success); }
.semaforo-yellow { background: var(--warning); }
.semaforo-red    { background: var(--danger); }
.semaforo-pulse  {
  background: var(--danger);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(248,81,73,0.4); }
  50%       { opacity: 0.8; box-shadow: 0 0 0 6px rgba(248,81,73,0); }
}

/* =============================================
   UTILITY
   ============================================= */
.text-accent  { color: var(--accent); }
.text-muted   { color: var(--text-2); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

/* =============================================
   SCROLLBAR
   ============================================= */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg-subtle); border-radius: 5px; }
::-webkit-scrollbar-thumb {
  background: var(--text-3);
  border-radius: 5px;
  border: 2px solid var(--bg-subtle);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-2); }

/* Scrollbar globale webkit (Chrome) */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg-subtle); border-radius: 5px; }
::-webkit-scrollbar-thumb {
  background: var(--text-3);
  border-radius: 5px;
  border: 2px solid var(--bg-subtle);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-2); }

/* Scrollbar specifica page-content */
.page-content::-webkit-scrollbar { width: 10px; }
.page-content::-webkit-scrollbar-track { background: var(--bg-subtle); border-radius: 5px; }
.page-content::-webkit-scrollbar-thumb {
  background: var(--text-3);
  border-radius: 5px;
  border: 2px solid var(--bg-subtle);
}
.page-content::-webkit-scrollbar-thumb:hover { background: var(--text-2); }

/* Firefox — solo page-content, non su * per non interferire con webkit */
.page-content { scrollbar-width: auto; scrollbar-color: var(--text-3) var(--bg-subtle); }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 600px) {
  nav.topnav { padding: 0 16px; }
}
