/**
 * SGADConfirm — modal de confirmacao reutilizavel.
 *
 * Camada compartilhada: nao depende do CSS de nenhum modulo nem do Bootstrap.
 * A marcacao e injetada no <body> por public/js/sgad-confirm.js.
 *
 * Ver "Dialogos e notificacoes (REGRA)" no CLAUDE.md.
 */

.sgad-confirm {
    position: fixed;
    inset: 0;
    /* Acima do modal do Bootstrap (1055) e dos toasts, para a confirmacao
       nunca nascer atras do que a disparou. */
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.55);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.sgad-confirm.is-visivel {
    opacity: 1;
}

.sgad-confirm[hidden] {
    display: none;
}

body.sgad-confirm-aberto {
    overflow: hidden;
}

.sgad-confirm-caixa {
    width: 100%;
    max-width: 420px;
    padding: 28px 24px 20px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
    text-align: center;
    transform: translateY(8px) scale(0.98);
    transition: transform 0.18s ease;
}

.sgad-confirm.is-visivel .sgad-confirm-caixa {
    transform: translateY(0) scale(1);
}

.sgad-confirm-icone {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
    font-size: 1.6rem;
}

.sgad-confirm-titulo {
    margin: 0 0 8px;
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
}

.sgad-confirm-mensagem {
    margin: 0 0 22px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #6b7280;
}

.sgad-confirm-acoes {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.sgad-confirm-btn {
    flex: 1 1 140px;
    min-height: 42px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s ease, background 0.15s ease;
}

.sgad-confirm-btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.sgad-confirm-btn.is-cancelar {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #374151;
}

.sgad-confirm-btn.is-cancelar:hover {
    background: #e5e7eb;
}

.sgad-confirm-btn.is-confirmar {
    color: #fff;
}

.sgad-confirm-btn.is-confirmar:hover {
    filter: brightness(0.93);
}

/* ------------------------------------------------------------------
   Variantes — cor do icone e do botao de confirmar
   ------------------------------------------------------------------ */

.is-perigo .sgad-confirm-icone   { background: #fee2e2; color: #dc2626; }
.is-sucesso .sgad-confirm-icone  { background: #dcfce7; color: #16a34a; }
.is-aviso .sgad-confirm-icone    { background: #fef3c7; color: #d97706; }
.is-primario .sgad-confirm-icone { background: #e0e7ff; color: #4f46e5; }

.is-perigo .sgad-confirm-btn.is-confirmar   { background: #dc2626; }
.is-sucesso .sgad-confirm-btn.is-confirmar  { background: #16a34a; }
.is-aviso .sgad-confirm-btn.is-confirmar    { background: #d97706; }
.is-primario .sgad-confirm-btn.is-confirmar { background: #4f46e5; }

/* ------------------------------------------------------------------
   Dark mode
   Tema explicito: `data-theme="dark"` no <html> (public/js/theme.js remove o
   atributo no tema claro). Nao usar prefers-color-scheme — ver sgad-form.css.
   ------------------------------------------------------------------ */

[data-theme="dark"] .sgad-confirm {
    background: rgba(2, 6, 23, 0.7);
}

[data-theme="dark"] .sgad-confirm-caixa {
    background: #1e2433;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .sgad-confirm-titulo {
    color: #f1f5f9;
}

[data-theme="dark"] .sgad-confirm-mensagem {
    color: #cbd5e1;
}

[data-theme="dark"] .sgad-confirm-btn.is-cancelar {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
}

[data-theme="dark"] .sgad-confirm-btn.is-cancelar:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* O circulo do icone perde o contraste no escuro: fundo translucido no lugar
   do pastel, e a cor do icone clareia. */
[data-theme="dark"] .is-perigo .sgad-confirm-icone   { background: rgba(220, 38, 38, 0.18);  color: #f87171; }
[data-theme="dark"] .is-sucesso .sgad-confirm-icone  { background: rgba(22, 163, 74, 0.18);  color: #4ade80; }
[data-theme="dark"] .is-aviso .sgad-confirm-icone    { background: rgba(217, 119, 6, 0.18);  color: #fbbf24; }
[data-theme="dark"] .is-primario .sgad-confirm-icone { background: rgba(99, 102, 241, 0.18); color: #a5b4fc; }

@media (max-width: 480px) {
    .sgad-confirm-acoes {
        flex-direction: column-reverse;
    }

    .sgad-confirm-btn {
        flex: 1 1 auto;
        width: 100%;
    }
}
