/* ============================================================
   HRSTE Notify — sistema unificato di notifiche
   Toast (auto-dismiss) + Modal (dettaglio errore con copia)
   Isolato: solo classi `.hrste-*`, zero interferenze
   ============================================================ */

/* === Contenitore stack toast === */
.hrste-toast-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 480px;
}

/* === Toast singolo === */
.hrste-toast {
  pointer-events: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15), 0 2px 6px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-left: 4px solid #64748b;
  padding: 12px 14px 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 300px;
  animation: hrsteToastIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  font-size: 13px;
  color: #0f172a;
  line-height: 1.4;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.hrste-toast.hrste-out { animation: hrsteToastOut 0.2s ease forwards; }

@keyframes hrsteToastIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes hrsteToastOut {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(20px); opacity: 0; }
}

.hrste-toast.success { border-left-color: #10b981; }
.hrste-toast.error   { border-left-color: #dc2626; }
.hrste-toast.warning { border-left-color: #f59e0b; }
.hrste-toast.info    { border-left-color: #2563eb; }

.hrste-toast .hrste-toast-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}
.hrste-toast.success .hrste-toast-icon::before { content: "✅"; }
.hrste-toast.error   .hrste-toast-icon::before { content: "❌"; }
.hrste-toast.warning .hrste-toast-icon::before { content: "⚠️"; }
.hrste-toast.info    .hrste-toast-icon::before { content: "ℹ️"; }

.hrste-toast .hrste-toast-body {
  flex: 1;
  min-width: 0;
}
.hrste-toast .hrste-toast-title {
  font-weight: 700;
  font-size: 13px;
  color: #0f172a;
  margin-bottom: 2px;
}
.hrste-toast .hrste-toast-msg {
  color: #334155;
  word-wrap: break-word;
}
.hrste-toast .hrste-toast-close {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
  border-radius: 4px;
  transition: background 120ms;
}
.hrste-toast .hrste-toast-close:hover { background: #f1f5f9; color: #0f172a; }

.hrste-toast .hrste-toast-details-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--brand-primary, #d10000);
  background: transparent;
  border: 1px solid rgba(15, 23, 42, 0.15);
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: background 120ms;
}
.hrste-toast .hrste-toast-details-btn:hover { background: #f8fafc; }

/* === Modal errore/dettaglio (per errori copiabili) === */
.hrste-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: hrsteFadeIn 0.15s ease;
}
@keyframes hrsteFadeIn { from { opacity: 0; } to { opacity: 1; } }

.hrste-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: hrsteModalIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@keyframes hrsteModalIn {
  from { transform: translateY(20px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.hrste-modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.hrste-modal-head .hrste-modal-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.hrste-modal.error   .hrste-modal-head .hrste-modal-icon { background: #fee2e2; }
.hrste-modal.warning .hrste-modal-head .hrste-modal-icon { background: #fef3c7; }
.hrste-modal.info    .hrste-modal-head .hrste-modal-icon { background: #dbeafe; }
.hrste-modal.success .hrste-modal-head .hrste-modal-icon { background: #d1fae5; }

.hrste-modal-title {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  min-width: 0;
}
.hrste-modal-subtitle {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
  font-weight: 400;
}

.hrste-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.hrste-modal-body p { margin: 0 0 10px; color: #334155; font-size: 14px; line-height: 1.5; }

.hrste-modal-detail {
  margin-top: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  max-height: 260px;
  overflow: auto;
  font-family: "SF Mono", Consolas, Monaco, monospace;
  font-size: 11px;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: all;
}

.hrste-modal-actions {
  padding: 12px 20px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
}
.hrste-modal-actions .hrste-spacer { flex: 1; }

.hrste-modal-btn {
  padding: 8px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms, color 120ms, border-color 120ms;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hrste-modal-btn:hover { background: #f1f5f9; color: #0f172a; }
.hrste-modal-btn.primary {
  background: var(--brand-primary, #d10000);
  color: #fff;
  border-color: var(--brand-primary, #d10000);
}
.hrste-modal-btn.primary:hover {
  background: var(--brand-primary-dark, #a30000);
  color: #fff;
}
.hrste-modal-btn.copied {
  background: #10b981;
  color: #fff;
  border-color: #10b981;
}

/* ============ HRSTE CHIP — Linear-style canonical (2026-08-20) ============
   Shape uniforme cross-progetto ecosistema HRSTE. Doc: DESIGN_SYSTEM.md
   sezione "Chip Linear-style (CANONICAL)".
   Regola: MAI reinventare pill/badge inline. Sempre queste classi. */

.hrste-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f8fafc;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    border-left: 3px solid var(--chip-accent, #64748b);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    line-height: 18px;
    height: 24px;
    box-sizing: border-box;
    vertical-align: middle;
}
.hrste-chip-ic { font-size: 11px; opacity: 0.85; line-height: 1; }

.hrste-chip-empty {
    background: #f1f5f9; color: #94a3b8;
    border: 1px dashed #cbd5e1; border-left: 1px dashed #cbd5e1;
    font-weight: 500;
}
.hrste-chip-more {
    background: #f1f5f9; color: #475569;
    border: 1px dashed #cbd5e1; border-left: 1px dashed #cbd5e1;
    font-weight: 700; padding: 3px 8px; cursor: help;
}
.hrste-chip-group {
    display: inline-flex; flex-wrap: wrap; gap: 3px; align-items: center;
}

/* Declinazioni semantiche */
.hrste-chip-success { --chip-accent: #16a34a; }
.hrste-chip-success.hrste-chip-solid {
    background: #16a34a; color: #fff; border-color: #15803d; border-left-color: #15803d;
}
.hrste-chip-warning { --chip-accent: #f59e0b; }
.hrste-chip-warning.hrste-chip-solid {
    background: #f59e0b; color: #fff; border-color: #d97706; border-left-color: #d97706;
}
.hrste-chip-danger { --chip-accent: #dc2626; }
.hrste-chip-danger.hrste-chip-solid {
    background: #dc2626; color: #fff; border-color: #b91c1c; border-left-color: #b91c1c;
    font-weight: 800; letter-spacing: 0.3px;
}
.hrste-chip-info { --chip-accent: #3b82f6; }
.hrste-chip-info.hrste-chip-solid {
    background: #3b82f6; color: #fff; border-color: #2563eb; border-left-color: #2563eb;
}
.hrste-chip-muted { --chip-accent: #64748b; }
.hrste-chip-muted.hrste-chip-solid {
    background: #64748b; color: #fff; border-color: #475569; border-left-color: #475569;
}

/* Modificatore small (h=20px per tabelle dense) */
.hrste-chip-sm {
    height: 20px; padding: 2px 8px 2px 6px;
    font-size: 10px; line-height: 14px; border-left-width: 2px;
}
