/* ============================================================
   AZZERARE SI PUÒ — Post Generator
   Brand: Union Energia · Navy #0D1B3E · Arancio #F5820A · Verde #2ECC71
   ============================================================ */

:root {
  --navy:       #0D1B3E;
  --navy-light: #1A2D5A;
  --navy-mid:   #162347;
  --orange:     #F5820A;
  --orange-dark:#D4700A;
  --orange-light:#FEF0E0;
  --green:      #2ECC71;
  --green-dark: #27AE60;
  --red:        #E74C3C;
  --blue-bio:   #3498DB;
  --white:      #FFFFFF;
  --gray-50:    #F8FAFC;
  --gray-100:   #F1F5F9;
  --gray-200:   #E2E8F0;
  --gray-300:   #CBD5E1;
  --gray-500:   #64748B;
  --gray-700:   #334155;
  --gray-900:   #0F172A;
  --bio-rosso:  #E74C3C;
  --bio-verde:  #27AE60;
  --bio-blu:    #2980B9;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.10);
  --shadow-md:  0 4px 12px rgba(0,0,0,.12);
  --shadow-lg:  0 8px 24px rgba(0,0,0,.15);
  --radius:     12px;
  --radius-sm:  8px;
}

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

html { font-size: 16px; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  min-height: 100vh;
  line-height: 1.5;
}

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

.sidebar {
  width: 240px;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.sidebar-logo .brand-icon {
  width: 48px; height: 48px;
  background: var(--orange);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: white;
  margin-bottom: 10px;
}
.sidebar-logo h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.2rem;
  color: var(--white);
  letter-spacing: .5px;
  line-height: 1.2;
}
.sidebar-logo p {
  font-size: .72rem;
  color: rgba(255,255,255,.55);
  margin-top: 2px;
}

.sidebar-nav { flex: 1; padding: 16px 0; }
.nav-section-label {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  padding: 12px 20px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .2s;
  cursor: pointer;
}
.nav-item:hover, .nav-item.active {
  background: rgba(255,255,255,.08);
  color: var(--white);
  border-left-color: var(--orange);
}
.nav-item i { width: 18px; text-align: center; font-size: .95rem; }
.nav-badge {
  margin-left: auto;
  background: var(--orange);
  color: white;
  font-size: .65rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.10);
  font-size: .75rem;
  color: rgba(255,255,255,.4);
}
.sidebar-footer strong { color: rgba(255,255,255,.75); display: block; margin-bottom: 2px; }

.main-content {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.content-area { padding: 28px; flex: 1; }

/* ── CARDS ─────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: 1rem; font-weight: 700; color: var(--navy); }
.card-body { padding: 22px; }

/* ── STATS GRID ─────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-card .stat-label { font-size: .75rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .5px; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 800; color: var(--navy); font-family: 'Barlow Condensed', sans-serif; }
.stat-card .stat-sub { font-size: .75rem; color: var(--gray-500); }
.stat-card.orange { border-left: 4px solid var(--orange); }
.stat-card.green  { border-left: 4px solid var(--green); }
.stat-card.blue   { border-left: 4px solid var(--blue-bio); }
.stat-card.red    { border-left: 4px solid var(--red); }

/* ── BIOTYPE PILLS & BADGES ──────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.badge-rosso { background: #FDEDED; color: var(--bio-rosso); }
.badge-verde { background: #EAFAF1; color: var(--bio-verde); }
.badge-blu   { background: #EBF5FB; color: var(--bio-blu); }
.badge-pending    { background: #FFF8E1; color: #E67E22; }
.badge-in_progress{ background: #E8F4FD; color: #2980B9; }
.badge-completed  { background: #EAFAF1; color: var(--green-dark); }
.badge-rejected   { background: #FDEDED; color: var(--red); }
.badge-new        { background: #EDE7F6; color: #6C3483; }
.badge-contacted  { background: #E3F2FD; color: #1565C0; }
.badge-qualified  { background: #E8F5E9; color: #2E7D32; }
.badge-webinar    { background: #FFF3E0; color: #E65100; }
.badge-consulenza { background: #FCE4EC; color: #C62828; }
.badge-converted  { background: #EAFAF1; color: var(--green-dark); }
.badge-lost       { background: #FAFAFA; color: var(--gray-500); }

/* ── FORM ELEMENTS ───────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color .2s;
  font-family: 'Inter', sans-serif;
}
.form-control:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(245,130,10,.12); }
textarea.form-control { resize: vertical; min-height: 100px; }

/* Biotype selector */
.biotype-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.biotype-option {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--white);
}
.biotype-option:hover { border-color: var(--gray-300); transform: translateY(-1px); }
.biotype-option.selected-rosso { border-color: var(--bio-rosso); background: #FDEDED; }
.biotype-option.selected-verde { border-color: var(--bio-verde); background: #EAFAF1; }
.biotype-option.selected-blu   { border-color: var(--bio-blu);   background: #EBF5FB; }
.biotype-option .bio-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  margin: 0 auto 8px;
}
.bio-dot-rosso { background: var(--bio-rosso); }
.bio-dot-verde { background: var(--bio-verde); }
.bio-dot-blu   { background: var(--bio-blu); }
.biotype-option .bio-name { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.biotype-option .bio-sub  { font-size: .7rem; color: var(--gray-500); }

/* ── BUTTONS ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  border: none;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary   { background: var(--orange); color: white; }
.btn-primary:hover { background: var(--orange-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(245,130,10,.3); }
.btn-navy      { background: var(--navy); color: white; }
.btn-navy:hover{ background: var(--navy-light); }
.btn-outline   { background: transparent; border: 1.5px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--orange); color: var(--orange); }
.btn-success   { background: var(--green); color: white; }
.btn-success:hover { background: var(--green-dark); }
.btn-danger    { background: var(--red); color: white; }
.btn-sm        { padding: 6px 12px; font-size: .8rem; }
.btn-lg        { padding: 12px 24px; font-size: 1rem; }
.btn-full      { width: 100%; }
.btn:disabled  { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── TABLE ───────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead th {
  background: var(--gray-50);
  padding: 10px 14px;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
tbody tr:hover { background: var(--gray-50); }

/* ── ALERT & TOAST ───────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-info    { background: #EBF5FB; color: #1A5276; border-left: 4px solid var(--blue-bio); }
.alert-success { background: #EAFAF1; color: #1E8449; border-left: 4px solid var(--green); }
.alert-warning { background: #FFF8E1; color: #7D6608; border-left: 4px solid #F39C12; }
.alert-error   { background: #FDEDED; color: #922B21; border-left: 4px solid var(--red); }

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  color: white;
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn .3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 260px;
  max-width: 380px;
}
.toast-success { background: var(--green-dark); }
.toast-error   { background: var(--red); }
.toast-info    { background: var(--navy); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── LOGIN PAGE ──────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(ellipse at 30% 40%, rgba(245,130,10,.15) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 60%, rgba(46,204,113,.08) 0%, transparent 50%);
  pointer-events: none;
}
.login-card {
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  position: relative;
  z-index: 1;
}
.login-icon {
  width: 72px; height: 72px;
  background: var(--orange);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: white;
  margin: 0 auto 20px;
  box-shadow: 0 0 40px rgba(245,130,10,.4);
}
.login-card h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2rem;
  color: var(--white);
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.login-card .subtitle {
  color: rgba(255,255,255,.55);
  font-size: .875rem;
  margin-bottom: 32px;
}
.login-card .form-control {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.15);
  color: white;
  text-align: center;
  font-size: 1rem;
  letter-spacing: 2px;
  padding: 14px;
}
.login-card .form-control::placeholder { color: rgba(255,255,255,.35); letter-spacing: 1px; }
.login-card .form-control:focus { border-color: var(--orange); background: rgba(255,255,255,.12); }
.login-footer {
  margin-top: 24px;
  font-size: .75rem;
  color: rgba(255,255,255,.35);
}

/* ── MODAL ───────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.2rem; color: var(--gray-500);
  padding: 4px; border-radius: 6px;
  transition: color .2s;
}
.modal-close:hover { color: var(--navy); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ── GENERA POST ─────────────────────────────────── */
.post-output {
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  font-size: .9rem;
  line-height: 1.7;
  white-space: pre-wrap;
  position: relative;
}
.copy-btn {
  position: absolute;
  top: 10px; right: 10px;
}
.hashtags-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.hashtag {
  background: var(--orange-light);
  color: var(--orange-dark);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
}

/* ── CALENDAR / PIANO EDITORIALE ─────────────────── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.cal-day-header {
  background: var(--navy);
  color: rgba(255,255,255,.8);
  padding: 8px;
  text-align: center;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
}
.cal-day {
  background: var(--white);
  min-height: 80px;
  padding: 6px;
  font-size: .78rem;
}
.cal-day .day-num { font-weight: 700; color: var(--gray-700); margin-bottom: 4px; }
.cal-day.today { background: var(--orange-light); }
.cal-day.today .day-num { color: var(--orange-dark); }
.cal-event {
  background: var(--navy);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .68rem;
  margin-bottom: 2px;
  cursor: pointer;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-event.rosso { background: var(--bio-rosso); }
.cal-event.verde { background: var(--bio-verde); }
.cal-event.blu   { background: var(--bio-blu); }

/* ── EMPTY STATE ─────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-500);
}
.empty-state i { font-size: 3rem; margin-bottom: 12px; opacity: .4; }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; color: var(--gray-700); }
.empty-state p { font-size: .875rem; }

/* ── DIVIDER ─────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 20px 0; }

/* ── GRID UTILS ──────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.flex   { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-sm { font-size: .8rem; }
.text-muted { color: var(--gray-500); }
.text-orange { color: var(--orange); }
.text-navy { color: var(--navy); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.hidden { display: none !important; }

/* ── SPINNER ─────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── PROGRESS BAR ────────────────────────────────── */
.progress { background: var(--gray-200); border-radius: 20px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--orange); border-radius: 20px; transition: width .4s; }
.progress-bar.green { background: var(--green); }

/* ── QUOTA CARD ──────────────────────────────────── */
.quota-card {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  border-radius: var(--radius);
  padding: 20px 24px;
  color: white;
  margin-bottom: 20px;
}
.quota-card .q-title { font-size: .75rem; text-transform: uppercase; letter-spacing: .8px; color: rgba(255,255,255,.55); margin-bottom: 4px; }
.quota-card .q-value { font-family: 'Barlow Condensed', sans-serif; font-size: 2.2rem; font-weight: 800; color: var(--orange); }
.quota-card .q-sub { font-size: .8rem; color: rgba(255,255,255,.65); margin-top: 2px; }

/* ── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .biotype-selector { grid-template-columns: 1fr; }
}

/* ── FUNNEL AARRR INDICATOR ──────────────────────── */
.funnel-phase {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.phase-acquisition { background: #FEF3E2; color: #E67E22; }
.phase-activation  { background: #E8F8F5; color: #1ABC9C; }
.phase-retention   { background: #EBF5FB; color: #2980B9; }
.phase-referral    { background: #F5EEF8; color: #8E44AD; }
.phase-revenue     { background: #FDEDEC; color: #E74C3C; }

/* ── MEMBER GRID (Richiedi Post) ─────────────────── */
.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}
.member-card {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 10px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--white);
}
.member-card:hover { border-color: var(--orange); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.member-card.selected { border-color: var(--orange); background: var(--orange-light); }
.member-card .member-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--navy);
  color: white;
  font-size: 1.1rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 8px;
}
.member-card .member-name { font-size: .78rem; font-weight: 600; color: var(--gray-700); }

/* ── ORANGE TOP STRIPE (brand) ───────────────────── */
.page-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: white;
  padding: 24px 28px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.page-header::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--orange);
}
.page-header h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.6rem;
  letter-spacing: .5px;
  margin-bottom: 4px;
}
.page-header p { color: rgba(255,255,255,.65); font-size: .875rem; }
