/* ============================================
   HANDO — Design System
   Reset + Root + Componenti condivisi
   ============================================ */

/* 1. RESET */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { font-size: 16px; }

body {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; display: block; }

/* 2. ROOT — Design tokens */
:root {
  /* Palette */
  --bg:        #EDE5D8;
  --surface:   rgba(255, 252, 248, 0.92);
  --surface-solid: #FFFCF8;
  --ink:       #2A1018;
  --ink-light: #9A806A;
  --border:    rgba(139, 60, 40, 0.1);

  /* Colori brand */
  --violet:    #7A3060;
  --violet-light: rgba(122, 48, 96, 0.1);
  --violet-dark: #5A1E48;
  --brick:     #8B3C28;
  --brick-light: rgba(139, 60, 40, 0.1);
  --amber:     #C4872A;
  --amber-light: rgba(196, 135, 42, 0.1);

  /* Typography */
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  /* Spacing */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 40px;

  /* Radii */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-pill: 100px;
}

/* 3. FONT IMPORT */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@700;800&family=DM+Sans:wght@300;400;500&display=swap');

/* 4. TEXTURE SFONDO */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(139,60,40,0.1) 1px, transparent 1px);
  background-size: 18px 18px;
  pointer-events: none;
  z-index: 0;
}

/* Banda verticale sinistra */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 5px; height: 100%;
  background: linear-gradient(180deg, var(--violet) 0%, var(--brick) 50%, var(--amber) 100%);
  z-index: 100;
  pointer-events: none;
}

/* Tutto il contenuto sopra la texture */
.page-wrapper { position: relative; }

/* 5. TOPBAR */
.topbar {
  background: rgba(237, 229, 216, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--sp-xl);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-logo {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.04em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

.topbar-user {
  font-size: 13px;
  color: var(--ink-light);
  padding: 0 var(--sp-md);
}

/* 6. BOTTONI */
.btn {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  padding: 11px 22px;
  border-radius: var(--r-pill);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--violet);
  color: #fff;
}
.btn-primary:hover { background: var(--violet-dark); transform: translateY(-1px); }

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-solid); }

.btn-ghost {
  background: transparent;
  color: var(--ink-light);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-light); }

.btn-danger {
  background: transparent;
  color: var(--brick);
  border: 1px solid var(--brick-light);
}
.btn-danger:hover { background: var(--brick-light); }

/* 7. CARD */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  border: 1px solid var(--border);
}

.card-violet {
  background: var(--violet);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  color: #fff;
}

.card-brick {
  background: var(--brick);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  color: #fff;
}

/* 8. BENTO GRID */
.bento {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.bento-span2 { grid-column: span 2; }
.bento-span3 { grid-column: span 3; }

/* 9. FORM */
.form-group { margin-bottom: var(--sp-lg); }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-light);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--sp-sm);
}

.form-input {
  width: 100%;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.form-input:focus { border-color: var(--violet); }
.form-input:focus { outline: none; box-shadow: none; }
.form-input::placeholder { color: var(--ink-light); opacity: 0.6; }

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

/* 10. BADGE */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  letter-spacing: 0.04em;
}

.badge-violet { background: var(--violet-light); color: var(--violet); }
.badge-brick  { background: var(--brick-light); color: var(--brick); }
.badge-amber  { background: var(--amber-light); color: var(--amber); }
.badge-muted  { background: rgba(154,128,106,0.1); color: var(--ink-light); }

/* 11. ALERT */
.alert {
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: var(--sp-lg);
}
.alert-error {
  background: rgba(139,60,40,0.08);
  border: 1px solid rgba(139,60,40,0.2);
  color: var(--brick);
}
.alert-success {
  background: rgba(122,48,96,0.08);
  border: 1px solid rgba(122,48,96,0.2);
  color: var(--violet);
}

/* 12. LAYOUT CENTRATO (login, register) */
.page-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-lg);
}

.page-center .card {
  max-width: 420px;
  width: 100%;
  background: rgba(255, 252, 248, 0.94);
  backdrop-filter: blur(8px);
}

/* 13. TITOLI */
.h1 {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1.0;
  color: var(--ink);
}

.h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-light);
}

/* 14. LOGO SVG */
.logo-mark {
  width: 38px;
  height: 38px;
  background: var(--violet);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* 15. SEPARATORE */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--sp-md) 0;
}

/* 16. LINK TESTO */
.link {
  color: var(--violet);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 17. CONTENT WRAPPER */
.content {
  max-width: 860px;
  margin: 0 auto;
  padding: var(--sp-xl) var(--sp-lg) 80px;
}

/* 18. TOPBAR — sotto-elementi condivisi tra tutte le pagine
   (ogni CSS di pagina può sovrascrivere con valori specifici) */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Nome "hando" nella topbar */
.topbar-name,
.topbar-logo-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.04em;
}

/* Brand cliccabile (es. pricing): logo + testo in un <a> */
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.04em;
  text-decoration: none;
}

/* Separator e breadcrumb (es. "› Nome Progetto") */
.topbar-sep  { color: var(--ink-light); font-size: 16px; }
.topbar-proj {
  font-size: 14px;
  color: var(--ink-light);
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Logo-mark nella topbar: 32×32 px fissi (evita style inline) */
.topbar .logo-mark {
  width: 32px;
  height: 32px;
}

/* 19. UTILITY — Card brand header (login, register)
   Sostituisce div con style="display:flex; flex-direction:column…" inline */
.card-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 28px;
}

/* Logo grande nelle card centrate (login, register) */
.logo-mark-lg { width: 56px; height: 56px; }

/* Titolo "hando" nelle card centrate */
.card-brand-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.05em;
  line-height: 1;
}

/* Sottotitolo nelle card centrate */
.card-brand-subtitle { font-size: 13px; color: var(--ink-light); }

/* Bottone full-width con testo centrato */
.btn-full { width: 100%; justify-content: center; }

/* Nota footer nelle card centrate (es. "Non hai un account?") */
.card-footer-note {
  text-align: center;
  font-size: 13px;
  color: var(--ink-light);
  margin-top: 20px;
}

/* 20. UTILITY — Testo colorato inline */
.text-violet { color: var(--violet); }

/* ============================================
   SIDEBAR — Navigazione dashboard
   Da aggiungere in fondo a style.css
   ============================================ */

/* Layout principale con sidebar */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ─── SIDEBAR DESKTOP ─── */
.sidebar {
  position: fixed;
  top: 64px; /* altezza topbar */
  left: 5px; /* dopo la banda verticale */
  bottom: 0;
  width: 56px; /* collassata: solo icone */
  background: rgba(237,229,216,0.97);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: width 0.2s ease;
  overflow: hidden;
}

/* Espansa al hover */
.sidebar:hover {
  width: 180px;
  box-shadow: 4px 0 24px rgba(42,16,24,0.08);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 6px;
  flex: 1;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--r-md);
  color: var(--ink-light);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  position: relative;
  min-height: 40px;
}

.sidebar-item:hover {
  background: rgba(122,48,96,0.08);
  color: var(--violet);
}

.sidebar-item.active {
  background: rgba(122,48,96,0.1);
  color: var(--violet);
}

.sidebar-item.locked {
  opacity: 0.5;
}

.sidebar-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-label {
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

/* Mostra il testo quando la sidebar è espansa */
.sidebar:hover .sidebar-label { opacity: 1; }

.sidebar-lock {
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.sidebar:hover .sidebar-lock { opacity: 1; }

/* ─── CONTENT CON SIDEBAR ─── */
/* Classe da aggiungere al .content nelle pagine dashboard */
.content-with-sidebar {
  margin-left: calc(56px + 5px); /* sidebar collassata + banda */
  max-width: 860px;
  padding: var(--sp-xl) var(--sp-lg) 80px;
}


/* ─── BOTTOM NAV MOBILE ─── */
.bottom-nav {
  display: none; /* nascosta su desktop */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(237,229,216,0.97);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  z-index: 50;
  flex-direction: row;
  align-items: stretch;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-light);
  text-decoration: none;
  transition: color 0.15s;
  padding: 6px 0;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--violet);
}

.bottom-nav-item.locked { opacity: 0.5; }

.bottom-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-nav-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  /* Nasconde sidebar su mobile */
  .sidebar { display: none; }

  /* Mostra bottom nav su mobile */
  .bottom-nav { display: flex; }

  /* Rimuove margine sidebar su mobile */
  .content-with-sidebar {
    margin-left: 0;
    padding-bottom: 80px;
  }
}