/* ============================================================
   HIT Os — errors.css
   Estilos del sistema de visibilidad de errores (Fase 2 Paso 2)
   - Campanita en navbar (#errBellBtn)
   - Panel persistente (#errPanel)
   - Modal bloqueante (#errModalRoot)
   ============================================================ */

/* ── Ícono campanita en navbar ─────────────────────────────── */
.err-bell-wrap {
  position: relative;
  display: inline-block;
}
#errBellBtn {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: Outfit, sans-serif;
  font-size: 11px;
  font-weight: 600;
  opacity: .6;
  position: relative;
  transition: opacity .2s;
}
#errBellBtn:hover { opacity: 1; }
#errBellBtn.has-errors { opacity: 1; }
#errBellBadge {
  display: none;
  background: #dc2626;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: 2px;
  min-width: 14px;
  text-align: center;
}
#errBellBtn.has-errors #errBellBadge {
  animation: errBellPulse 1.4s ease-in-out infinite;
}
@keyframes errBellPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

/* ── Panel persistente ─────────────────────────────────────── */
.err-panel {
  position: fixed;
  top: 56px;
  right: 14px;
  width: 380px;
  max-width: calc(100vw - 28px);
  max-height: 70vh;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  font-family: Outfit, -apple-system, Segoe UI, Roboto, sans-serif;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}
.err-panel.hidden { display: none; }

.err-pan-head {
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f9fafb;
}
.err-pan-head h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}
.err-pan-clear {
  background: none;
  border: none;
  font-size: 11px;
  color: #2563eb;
  cursor: pointer;
  padding: 2px 6px;
  font-family: inherit;
}
.err-pan-clear:hover { text-decoration: underline; }

.err-pan-list {
  overflow-y: auto;
  flex: 1;
  padding: 4px 0;
}
.err-pan-empty {
  text-align: center;
  padding: 24px 12px;
  color: #6b7280;
  font-size: 12px;
}

.err-pan-item {
  padding: 10px 14px;
  border-bottom: 1px solid #f3f4f6;
  border-left: 3px solid transparent;
  font-size: 12px;
}
.err-pan-item:last-child { border-bottom: none; }
.err-pan-info     { border-left-color: #2563eb; background: #eff6ff; }
.err-pan-warning  { border-left-color: #d97706; background: #fffbeb; }
.err-pan-error    { border-left-color: #dc2626; background: #fef2f2; }
.err-pan-critical { border-left-color: #7f1d1d; background: #fee2e2; }

.err-pan-row1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  gap: 8px;
}
.err-pan-mod {
  font-weight: 600;
  color: #111827;
  text-transform: capitalize;
  font-size: 11px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.err-pan-time {
  color: #6b7280;
  font-size: 10px;
  flex-shrink: 0;
}
.err-pan-count {
  display: inline-block;
  background: #dc2626;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: 4px;
}
.err-pan-msg {
  color: #374151;
  margin-bottom: 8px;
  line-height: 1.4;
  font-size: 12px;
  word-wrap: break-word;
}
.err-pan-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.err-pan-btn {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  color: #374151;
  transition: background .15s, border-color .15s;
}
.err-pan-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}
.err-pan-btn[data-action="retry"] {
  background: #2563eb;
  color: #fff;
  border-color: #1d4ed8;
}
.err-pan-btn[data-action="retry"]:hover {
  background: #1d4ed8;
}
.err-pan-btn[data-action="discard"] {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}
.err-pan-btn[data-action="discard"]:hover {
  background: #fca5a5;
}

/* ── Modal bloqueante ──────────────────────────────────────── */
.err-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: errModalFadeIn .18s ease;
  font-family: Outfit, -apple-system, Segoe UI, Roboto, sans-serif;
}
@keyframes errModalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.err-modal-box {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: errModalSlideIn .22s ease;
}
@keyframes errModalSlideIn {
  from { transform: translateY(-12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.err-modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px 12px;
  border-bottom: 1px solid #fee2e2;
  background: #fef2f2;
}
.err-modal-icon {
  font-size: 26px;
  flex-shrink: 0;
}
.err-modal-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #991b1b;
}

.err-modal-body {
  padding: 18px 22px 6px;
  color: #374151;
  font-size: 13px;
  line-height: 1.55;
}
.err-modal-body p {
  margin: 0 0 8px;
}
.err-modal-body strong { color: #111827; }
.err-modal-explain {
  margin-top: 12px !important;
  padding: 10px 12px;
  background: #fffbeb;
  border-left: 3px solid #d97706;
  border-radius: 4px;
  font-size: 12px;
  color: #78350f;
}

.err-modal-spinner {
  text-align: center;
  padding: 8px 22px;
  font-size: 12px;
  color: #6b7280;
  font-style: italic;
}

.err-modal-actions {
  display: flex;
  gap: 8px;
  padding: 14px 22px 20px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.err-modal-btn {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 16px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
.err-modal-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.err-modal-btn-primary {
  background: #2563eb;
  color: #fff;
  border-color: #1d4ed8;
}
.err-modal-btn-primary:hover:not(:disabled) { background: #1d4ed8; }
.err-modal-btn-warn {
  background: #fff;
  color: #991b1b;
  border-color: #fca5a5;
}
.err-modal-btn-warn:hover:not(:disabled) {
  background: #fee2e2;
}
.err-modal-btn-ghost {
  background: #f9fafb;
  color: #4b5563;
  border-color: #d1d5db;
}
.err-modal-btn-ghost:hover:not(:disabled) {
  background: #f3f4f6;
}

/* Responsive: en móviles el panel se vuelve full-width */
@media (max-width: 600px) {
  .err-panel {
    right: 8px;
    left: 8px;
    width: auto;
    max-width: none;
  }
  .err-modal-actions {
    flex-direction: column-reverse;
  }
  .err-modal-btn {
    width: 100%;
  }
}
