/* Shared UI Alert component (isolated styles, no dependency on app variables) */
.ui-alert-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.ui-alert-overlay.show { display: flex; }

.ui-alert {
  background: #0f172a; /* slate-900 */
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  width: 360px;
  max-width: 95vw;
  padding: 20px;
  color: #e5e7eb; /* slate-200 */
}

.ui-alert-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ui-alert-title {
  font-size: 16px;
  font-weight: 800;
  color: #f8fafc; /* slate-50 */
}

.ui-alert-close {
  background: transparent;
  border: 0;
  color: #94a3b8; /* slate-400 */
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ui-alert-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0; /* slate-200 */
}

.ui-alert-body {
  font-size: 14px;
  color: #cbd5e1; /* slate-300 */
  margin: 6px 0 14px;
}

/* Rich body com ícone/badge contextual */
.ui-alert-rich { display:flex; align-items:flex-start; gap:10px; }
.ui-alert-icon { width:28px; height:28px; border-radius: 8px; display:inline-flex; align-items:center; justify-content:center; font-size:14px; }
.ui-alert-text { line-height: 1.35; }
.tone-info  .ui-alert-icon { background:#0b2540; color:#93c5fd; border:1px solid rgba(59,130,246,.35); }
.tone-warning .ui-alert-icon { background:#3a2a05; color:#fcd34d; border:1px solid rgba(245,158,11,.45); }
.tone-danger .ui-alert-icon { background:#3a0d0d; color:#fca5a5; border:1px solid rgba(239,68,68,.45); }

.ui-alert-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.ui-alert-btn {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  color: #e2e8f0;
  background: #1e293b;
  transition: .2s ease;
  line-height: 1; /* evita “dançar” do texto em hover */
}

.ui-alert-btn.primary {
  background: linear-gradient(90deg, #fcd34d, #fbbf24);
  border-color: rgba(245, 158, 11, 0.6);
  color: #111827; /* mantém alto contraste */
  box-shadow: 0 4px 14px -4px rgba(245, 158, 11, 0.35);
}

.ui-alert-btn.primary:hover {
  /* Evita perda de contraste do texto no hover */
  background: linear-gradient(90deg, #fde68a, #fcd34d);
  border-color: rgba(245, 158, 11, 0.8);
  color: #111827;
  box-shadow: 0 6px 16px -4px rgba(245, 158, 11, 0.45);
}

.ui-alert-btn.ghost {
  background: transparent;
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.2);
}

.ui-alert-btn:hover {
  background: #25344c; /* hover base para botões neutros */
  color: #e2e8f0;
}

/* Loading state para botões do alerta */
.ui-alert-btn.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.9;
  color: transparent !important; /* oculta texto via cor */
  font-size: 0; /* garante ocultação do texto em todos navegadores */
}
.ui-alert-btn.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  /* usa cor fixa para o spinner, independente do color do botão */
  border: 2px solid #111827; /* near-black para bom contraste sobre amarelo */
  border-top-color: transparent;
  border-right-color: transparent;
  animation: ui-alert-spin .8s linear infinite;
}

@keyframes ui-alert-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.ui-alert-btn[disabled], .ui-alert-close[disabled] {
  pointer-events: none;
  opacity: 0.6;
  filter: grayscale(0.2);
}

/* Acessibilidade: foco visível nos botões do alerta */
.ui-alert-btn:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

@media (max-width: 420px) {
  .ui-alert { width: 320px; padding: 18px; }
}
