/*!
 * iFix Centri - stili custom
 * ═══════════════════════════════════════════════════════════════════
 * Copyright (c) 2026 Fix Solutions S.r.l.s. - Tutti i diritti riservati.
 * Nome commerciale: iFix - Sede: Via Merulana 257, 00185 Roma (RM)
 * Vedi LICENSE per i termini d'uso. Riproduzione vietata.
 * ═══════════════════════════════════════════════════════════════════
 */

/* ═══════════════════════════════════════════════════════════════════════
   DARK MODE FALLBACK
   Garantisce che il toggle scuro/chiaro sia sempre visibile anche se la
   CDN di Tailwind tarda a reprocessare le classi dark:.
   Queste regole hanno la stessa forza delle utility Tailwind
   e si attivano in base alla classe .dark su <html>.
   ═══════════════════════════════════════════════════════════════════════ */
html {
  color-scheme: light;
  background-color: rgb(249 250 251);
  color: rgb(17 24 39);
}
html.dark {
  color-scheme: dark;
  background-color: rgb(17 24 39);
  color: rgb(243 244 246);
}
html body {
  background-color: inherit;
  color: inherit;
}

/* Auto-capitalize: effetto visivo + text-transform per feedback immediato */
.input-capitalize {
  text-transform: capitalize;
}
/* Ma email, password e codici non vanno capitalizzati */
.input-capitalize[type="email"],
.input-capitalize[type="password"],
.input-nocap {
  text-transform: none;
}

/* Pattern lock */
.pattern-lock {
  display: inline-block;
  user-select: none;
  touch-action: none;
}
.pattern-svg {
  width: 240px;
  height: 240px;
  background: rgb(243 244 246);
  border-radius: 12px;
  border: 1px solid rgb(209 213 219);
}
.dark .pattern-svg {
  background: rgb(31 41 55);
  border-color: rgb(75 85 99);
}
.pattern-dot {
  fill: rgb(156 163 175);
  transition: all 0.15s;
}
.dark .pattern-dot {
  fill: rgb(107 114 128);
}
.pattern-dot.active {
  fill: rgb(255 90 31);
  r: 18;
}
.pattern-line {
  stroke: rgb(255 90 31);
  stroke-width: 6;
  stroke-linecap: round;
  opacity: 0.85;
  pointer-events: none;
}

/* Chat */
.chat-box {
  height: 420px;
  max-height: 55vh;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.chat-bubble {
  max-width: 75%;
  padding: 0.6rem 0.9rem;
  border-radius: 14px;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.chat-bubble-me {
  background: rgb(255 90 31);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-bubble-other {
  background: rgb(229 231 235);
  color: rgb(17 24 39);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.dark .chat-bubble-other {
  background: rgb(55 65 81);
  color: rgb(243 244 246);
}
.chat-bubble-img {
  padding: 4px !important;
  background: transparent !important;
}
.chat-bubble-img img {
  max-width: 220px;
  max-height: 220px;
  border-radius: 10px;
  cursor: zoom-in;
  display: block;
}

/* Drop zone chat per foto */
.chat-dropzone {
  position: relative;
}
.chat-dropzone.dragover::after {
  content: "Rilascia l'immagine per allegarla";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 90, 31, 0.85);
  color: white;
  font-weight: 700;
  border-radius: 12px;
  pointer-events: none;
  z-index: 10;
}

/* Stati pills */
.pill {
  display: inline-block;
  padding: 0.125rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.pill-bozza           { background: rgb(229 231 235); color: rgb(75 85 99); }
.pill-inviato_ifix    { background: rgb(254 215 170); color: rgb(154 52 18); }
.pill-ricevuto_ifix   { background: rgb(191 219 254); color: rgb(30 64 175); }
.pill-inviato_centro  { background: rgb(221 214 254); color: rgb(91 33 182); }
.pill-completato      { background: rgb(187 247 208); color: rgb(22 101 52); }

.dark .pill-bozza           { background: rgb(55 65 81);  color: rgb(209 213 219); }
.dark .pill-inviato_ifix    { background: rgb(124 45 18); color: rgb(254 215 170); }
.dark .pill-ricevuto_ifix   { background: rgb(30 58 138); color: rgb(191 219 254); }
.dark .pill-inviato_centro  { background: rgb(76 29 149); color: rgb(221 214 254); }
.dark .pill-completato      { background: rgb(20 83 45);  color: rgb(187 247 208); }

/* Tabella sortable */
.sort-icon::after { content: " ⇅"; opacity: 0.35; }
.sort-asc::after  { content: " ▲"; opacity: 1; color: rgb(255 90 31); }
.sort-desc::after { content: " ▼"; opacity: 1; color: rgb(255 90 31); }

/* Toast */
.toast {
  pointer-events: auto;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  font-size: 0.875rem;
  min-width: 240px;
  animation: slideIn 0.25s ease-out;
}
.toast-ok    { background: rgb(34 197 94); color: white; }
.toast-err   { background: rgb(239 68 68); color: white; }
.toast-info  { background: rgb(59 130 246); color: white; }
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* Google Places Autocomplete popup dark mode */
.dark .pac-container {
  background: rgb(31 41 55);
  border-color: rgb(75 85 99);
  color: rgb(243 244 246);
}
.dark .pac-item {
  color: rgb(209 213 219);
  border-top-color: rgb(75 85 99);
}
.dark .pac-item:hover,
.dark .pac-item-selected {
  background: rgb(55 65 81);
}
.dark .pac-item-query {
  color: rgb(255 255 255);
}
.dark .pac-matched {
  color: rgb(255 122 60);
}

/* Scrollbar discreto */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.4); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(128,128,128,0.6); }
