/* =========================================================
   LEVIAHUB DESIGN SYSTEM
   Applicazione Lead Generation - Fiere
   ========================================================= */

:root {
  /* Palette Brand Leviahub */
  --levia-orange: #FF7415;
  --levia-orange-dark: #B84B00;
  --levia-orange-light: #FFE8D8;
  --levia-orange-mid: #F88D37;

  --levia-dark: #253137;
  --levia-dark-2: #374952;
  --levia-dark-3: #46515A;
  --levia-grey: #DAE2E6;
  --levia-grey-light: #F4F6F8;

  --levia-white: #FFFFFF;

  --border-radius: 16px;
  --border-radius-sm: 10px;
  --shadow-soft: 0 4px 24px rgba(37, 49, 55, 0.08);
  --shadow-card: 0 8px 32px rgba(37, 49, 55, 0.10);
  --shadow-strong: 0 12px 48px rgba(37, 49, 55, 0.18);
}

/* =========================================================
   RESET + BASE TYPOGRAPHY
   ========================================================= */
* {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

html, body {
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif !important;
  color: var(--levia-dark);
  background-color: var(--levia-grey-light);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--levia-dark);
}

/* =========================================================
   LOGO + BRAND ELEMENTS
   ========================================================= */
.levia-logo {
  display: inline-flex;
  align-items: center;
  height: 32px;
}
.levia-logo img { height: 100%; width: auto; }

.levia-logo-light img { filter: brightness(0) invert(1); /* logo bianco su sfondo scuro */ }

/* Sparkle iconico arancione */
.levia-sparkle {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  vertical-align: -0.15em;
}

/* =========================================================
   BUTTONS - stile Levia (rettangolari, arancioni)
   ========================================================= */
.btn-levia {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  transition: all 0.25s ease;
  cursor: pointer;
  border: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn-levia-primary {
  background: var(--levia-orange);
  color: white;
}
.btn-levia-primary:hover {
  background: var(--levia-orange-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 116, 21, 0.35);
}
.btn-levia-primary:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-levia-dark {
  background: var(--levia-dark);
  color: white;
}
.btn-levia-dark:hover {
  background: var(--levia-dark-2);
  transform: translateY(-1px);
}

.btn-levia-ghost {
  background: var(--levia-orange-light);
  color: var(--levia-orange-dark);
}
.btn-levia-ghost:hover {
  background: var(--levia-orange);
  color: white;
}

.btn-levia-outline {
  background: transparent;
  color: var(--levia-dark);
  border: 1.5px solid var(--levia-dark);
}
.btn-levia-outline:hover {
  background: var(--levia-dark);
  color: white;
}

/* Icona freccia con cerchio (signature Levia) */
.circled-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 24px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  transition: all 0.25s ease;
}

/* =========================================================
   CARDS
   ========================================================= */
.levia-card {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(37, 49, 55, 0.06);
  overflow: hidden;
  transition: all 0.3s ease;
}
.levia-card:hover { box-shadow: var(--shadow-card); }

.levia-card-section {
  background: white;
  border-radius: var(--border-radius);
  border: 1px solid rgba(37, 49, 55, 0.08);
  padding: 1.5rem;
  transition: box-shadow 0.3s ease;
}
.levia-card-section:hover {
  box-shadow: var(--shadow-soft);
}

/* Headers di sezione con accento arancione */
.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--levia-orange-light);
}
.section-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--levia-orange-light);
  color: var(--levia-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.section-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--levia-dark);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* =========================================================
   FORM ELEMENTS
   ========================================================= */
.levia-input,
.levia-select,
.levia-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--border-radius-sm);
  background: white;
  color: var(--levia-dark);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}
.levia-input:focus,
.levia-select:focus,
.levia-textarea:focus {
  outline: none;
  border-color: var(--levia-orange);
  box-shadow: 0 0 0 4px rgba(255, 116, 21, 0.12);
}
.levia-input::placeholder,
.levia-textarea::placeholder {
  color: #94A3B8;
}

label.levia-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--levia-dark-3);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
label.levia-label .required {
  color: var(--levia-orange);
  font-weight: 700;
}

/* Checkbox custom Levia */
.levia-check {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  background: white;
  border: 1.5px solid #E2E8F0;
  border-radius: var(--border-radius-sm);
  padding: 0.625rem 0.875rem;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--levia-dark-2);
}
.levia-check:hover {
  border-color: var(--levia-orange);
  background: #FFFBF6;
}
.levia-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 1.5px solid #CBD5E1;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.levia-check input[type="checkbox"]:checked {
  background: var(--levia-orange);
  border-color: var(--levia-orange);
}
.levia-check input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.levia-check:has(input:checked) {
  background: var(--levia-orange-light);
  border-color: var(--levia-orange);
  color: var(--levia-orange-dark);
  font-weight: 600;
}
.levia-check:has(input:checked) i { color: var(--levia-orange-dark); }

/* Radio Levia */
.levia-radio {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 500;
  color: var(--levia-dark-2);
}
.levia-radio input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #CBD5E1;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}
.levia-radio input[type="radio"]:checked {
  border-color: var(--levia-orange);
}
.levia-radio input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  inset: 3px;
  background: var(--levia-orange);
  border-radius: 50%;
}

/* =========================================================
   BADGES - stato / tipo lead
   ========================================================= */
.badge-stato {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-INSERITO   { background: #DBEAFE; color: #1E40AF; }
.badge-ASSEGNATO  { background: var(--levia-orange-light); color: var(--levia-orange-dark); }
.badge-IN         { background: #EDE9FE; color: #5B21B6; }
.badge-SQUALIFICATO { background: #FEE2E2; color: #991B1B; }
.badge-NURTURING  { background: #D1FAE5; color: #065F46; }
.badge-ELIMINATO  { background: #E2E8F0; color: #475569; }

.badge-tipo {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-GREZZO   { background: #FFEDD5; color: #9A3412; }
.badge-COMPLETO { background: #DCFCE7; color: #166534; }

/* =========================================================
   TABELLE
   ========================================================= */
.levia-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.levia-table thead {
  background: var(--levia-dark);
}
.levia-table thead th {
  color: white;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.85rem 0.75rem;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 10;
}
.levia-table tbody tr {
  border-bottom: 1px solid #F1F5F9;
  transition: background 0.15s ease;
}
.levia-table tbody tr:hover { background: #FFFBF6; }
.levia-table tbody td {
  padding: 0.75rem;
  font-size: 0.875rem;
  color: var(--levia-dark);
  vertical-align: middle;
}

/* =========================================================
   TABS (admin)
   ========================================================= */
.levia-tabs {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  border-bottom: 2px solid rgba(255,255,255,0.1);
}
.levia-tab-btn {
  padding: 0.85rem 1.25rem;
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
  color: rgba(255,255,255,0.7);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.25s ease;
  background: transparent;
  border-top: none;
  border-left: none;
  border-right: none;
  cursor: pointer;
  font-family: inherit;
}
.levia-tab-btn:hover { color: white; }
.levia-tab-btn.active {
  color: var(--levia-orange);
  border-bottom-color: var(--levia-orange);
}

/* =========================================================
   ANIMATIONS
   ========================================================= */
.fade-in { animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes sparkle-pulse {
  0%, 100% { opacity: 1; transform: scale(1) rotate(0deg); }
  50% { opacity: 0.7; transform: scale(1.1) rotate(15deg); }
}
.sparkle-anim { animation: sparkle-pulse 3s ease-in-out infinite; }

/* =========================================================
   STAT CARDS (dashboard admin)
   ========================================================= */
.stat-card {
  background: white;
  border-radius: var(--border-radius);
  padding: 1.25rem;
  border: 1px solid rgba(37,49,55,0.08);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--levia-orange);
}
.stat-card.dark::before { background: var(--levia-dark); }
.stat-card .stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--levia-dark-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-card .stat-value {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--levia-dark);
  line-height: 1;
  margin-top: 0.5rem;
}
.stat-card .stat-icon {
  position: absolute;
  right: 1rem;
  top: 1rem;
  font-size: 1.75rem;
  color: var(--levia-orange);
  opacity: 0.35;
}

/* =========================================================
   SCROLLBAR
   ========================================================= */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #F1F5F9; }
::-webkit-scrollbar-thumb {
  background: var(--levia-dark-3);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--levia-orange); }

/* =========================================================
   UTILITY
   ========================================================= */
.text-levia-orange { color: var(--levia-orange) !important; }
.bg-levia-orange { background-color: var(--levia-orange) !important; }
.bg-levia-orange-light { background-color: var(--levia-orange-light) !important; }
.bg-levia-dark { background-color: var(--levia-dark) !important; }
.text-levia-dark { color: var(--levia-dark) !important; }
.border-levia-orange { border-color: var(--levia-orange) !important; }

/* Hero gradient (login page) */
.levia-hero-bg {
  background: linear-gradient(135deg, #253137 0%, #374952 50%, #253137 100%);
  position: relative;
  overflow: hidden;
}
.levia-hero-bg::before,
.levia-hero-bg::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
}
.levia-hero-bg::before {
  width: 400px; height: 400px;
  background: var(--levia-orange);
  opacity: 0.3;
  top: -100px;
  right: -100px;
}
.levia-hero-bg::after {
  width: 350px; height: 350px;
  background: var(--levia-orange-mid);
  opacity: 0.2;
  bottom: -100px;
  left: -100px;
}

/* Responsive helpers */
@media (max-width: 640px) {
  .section-header h3 { font-size: 0.95rem; }
  .stat-card .stat-value { font-size: 1.75rem; }
}

/* =========================================================
   FASE D/E - Stili per le nuove feature (20+1)
   ========================================================= */

/* Toast notifications */
#levia-toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.levia-toast { padding: 12px 18px; border-radius: 12px; color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 10px 25px rgba(0,0,0,0.2); animation: slideIn .25s ease-out; max-width: 360px; }
.levia-toast-success { background: #10b981; }
.levia-toast-error { background: #ef4444; }
.levia-toast-warning { background: #f59e0b; }
.levia-toast-info { background: var(--levia-orange); }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0 } to { transform: translateX(0); opacity: 1 } }

/* Notif panel */
#notif-panel .notif-item { padding: 10px 14px; cursor: pointer; transition: background .15s; }
#notif-panel .notif-item:hover { background: #fff7ed; }
#notif-panel .notif-item.unread { border-left: 3px solid var(--levia-orange); background: #fff7ed; }

/* Score live badge */
#score-live { transition: transform .2s, box-shadow .2s; }
#score-live.show { transform: scale(1); }
#score-live:hover { transform: scale(1.05); }
#score-live.tier-HOT { background: linear-gradient(135deg,#fef2f2,#fff); border-color: #ef4444 !important; }
#score-live.tier-WARM { background: linear-gradient(135deg,#fffbeb,#fff); border-color: #f59e0b !important; }
#score-live.tier-COLD { background: linear-gradient(135deg,#eff6ff,#fff); border-color: #3b82f6 !important; }

/* Anti-dup warning */
#dup-warning { animation: pulse-warn 2s ease-in-out infinite; }
@keyframes pulse-warn { 0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); } 50% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); } }

/* Attachments grid */
#attachments-list .attachment-item { position: relative; aspect-ratio: 1; border: 1px solid #e5e7eb; border-radius: 12px; overflow: hidden; background: #f9fafb; }
#attachments-list .attachment-item img { width: 100%; height: 100%; object-fit: cover; }
#attachments-list .attachment-remove { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.6); color: #fff; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 12px; }

/* Signature canvas */
#signature-canvas { background: #fff !important; cursor: crosshair; }
#signature-canvas.signed { border-style: solid !important; border-color: #10b981 !important; }

/* Offline banner */
#offline-banner.online-recovered { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }

/* Voice button active */
#voice-btn.recording { background: #fee2e2; color: #dc2626; animation: pulse-rec 1s ease-in-out infinite; }
@keyframes pulse-rec { 0%, 100% { opacity: 1 } 50% { opacity: 0.5 } }

/* Kiosk */
.kiosk-input { font-size: 1.2rem !important; padding: 14px !important; }
.kiosk-btn { font-size: 1.2rem !important; padding: 16px 24px !important; }

/* ============ DARK MODE ============ */
html.dark { color-scheme: dark; }
html.dark body { background: #0f1518; color: #e5e7eb; }
html.dark .bg-white { background-color: #1f2a30 !important; }
html.dark .bg-gray-50 { background-color: #18222780 !important; }
html.dark .bg-gray-100 { background-color: #243036 !important; }
html.dark .text-levia-dark { color: #f3f4f6 !important; }
html.dark .text-gray-500, html.dark .text-gray-600, html.dark .text-gray-700 { color: #cbd5e1 !important; }
html.dark .text-gray-400 { color: #9ca3af !important; }
html.dark .border, html.dark .border-gray-100, html.dark .border-gray-200, html.dark .border-gray-300 { border-color: #334048 !important; }
html.dark .levia-input, html.dark .levia-select, html.dark .levia-textarea { background-color: #18222780 !important; color: #f3f4f6 !important; border-color: #334048 !important; }
html.dark .levia-card-section { background-color: #1f2a30 !important; border-color: #334048 !important; }
html.dark .hover\:bg-gray-50:hover { background-color: #243036 !important; }
html.dark thead { background-color: #18222780 !important; }
html.dark #signature-canvas { background: #1f2a30 !important; }

