/** Modal Bertaclean — mensajes de alerta / confirmación (marca propia).
 * Sobrepone cabeceras del sitio (z-index alto); sin estilos inline.
 */

:root {
  --bm-overlay-bg: rgba(12, 12, 13, 0.55);
  --bm-shell-bg: #fff;
  --bm-shell-bd: rgba(17, 116, 210, 0.25);
  --bm-accent: #1174d2;
  --bm-accent-strong: #0d5fba;
  --bm-accent-ok: #2e7d32;
  --bm-accent-danger: #c62828;
  --bm-text: #1a1d21;
}

.bertaclean-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483640;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(14px, 4vw, 28px);
  box-sizing: border-box;
}

.bertaclean-modal-overlay[hidden] {
  display: none;
}

body.bertaclean-modal-html-abierta {
  overflow: hidden;
}

.bertaclean-modal-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: var(--bm-overlay-bg);
  cursor: pointer;
}

.bertaclean-modal-shell {
  position: relative;
  width: min(100%, 28rem);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--bm-shell-bg);
  color: var(--bm-text);
  border-radius: 18px;
  border: 1px solid var(--bm-shell-bd);
  box-shadow:
    0 24px 64px rgba(12, 12, 13, 0.18),
    0 10px 18px rgba(17, 116, 210, 0.08);
  overflow: hidden;
  animation: bertaclean-modal-shell-in 0.22s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .bertaclean-modal-shell {
    animation: none;
  }
}

@keyframes bertaclean-modal-shell-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.bertaclean-modal-shell--info {
  box-shadow:
    0 24px 64px rgba(12, 12, 13, 0.16),
    0 10px 18px rgba(17, 116, 210, 0.12),
    inset 0 4px 0 0 var(--bm-accent);
}

.bertaclean-modal-shell--success {
  box-shadow:
    0 24px 64px rgba(12, 12, 13, 0.16),
    0 10px 18px rgba(46, 125, 50, 0.12),
    inset 0 4px 0 0 var(--bm-accent-ok);
}

.bertaclean-modal-shell--error {
  box-shadow:
    0 24px 64px rgba(12, 12, 13, 0.16),
    0 10px 18px rgba(198, 40, 40, 0.12),
    inset 0 4px 0 0 var(--bm-accent-danger);
}

.bertaclean-modal-shell--confirm {
  box-shadow:
    0 24px 64px rgba(12, 12, 13, 0.16),
    0 10px 18px rgba(17, 116, 210, 0.1),
    inset 0 4px 0 0 rgba(148, 202, 28, 0.85);
}

.bertaclean-modal-shell__cabecera {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px clamp(14px, 3vw, 22px);
  flex-shrink: 0;
}

.bertaclean-modal-shell__marca {
  flex-shrink: 0;
}

.bertaclean-modal-shell__logo {
  display: block;
  width: 56px;
  height: auto;
  max-height: 54px;
  object-fit: contain;
}

.bertaclean-modal-shell__nombre-marca {
  flex: 1;
  font-size: clamp(17px, 4vw, 20px);
  font-weight: 700;
  line-height: 1.23;
  color: var(--bm-text);
}

.bertaclean-modal-shell__titulo {
  margin: -4px 0 0;
  padding: 0 clamp(14px, 3vw, 22px);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  color: var(--bm-accent-strong);
}

.bertaclean-modal-shell__cuerpo {
  padding: 8px clamp(14px, 3vw, 22px) 22px;
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}

.bertaclean-modal-shell__cuerpo p {
  margin: 0 0 12px;
  font-size: 0.9625rem;
  line-height: 1.6;
}

.bertaclean-modal-shell__cuerpo p:last-child {
  margin-bottom: 0;
}

.bertaclean-modal-shell__acciones {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px clamp(14px, 3vw, 22px);
  border-top: 1px solid rgba(12, 12, 13, 0.09);
  background: rgba(240, 242, 237, 0.5);
}

.bertaclean-modal-shell__acciones--solo {
  justify-content: center;
}

.bertaclean-modal-bot {
  appearance: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.9286rem;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  border: none;
}

.bertaclean-modal-bot--primaria {
  background: linear-gradient(135deg, var(--bm-accent) 0%, var(--bm-accent-strong) 100%);
  color: #fff;
}

.bertaclean-modal-bot--primaria:hover,
.bertaclean-modal-bot--primaria:focus-visible {
  filter: brightness(1.06);
}

.bertaclean-modal-bot--fantasma {
  background: #fff;
  color: var(--bm-text);
  border: 1px solid rgba(12, 12, 13, 0.2);
}

.bertaclean-modal-bot--fantasma:hover,
.bertaclean-modal-bot--fantasma:focus-visible {
  border-color: var(--bm-accent);
  color: var(--bm-accent-strong);
}

.bertaclean-modal-bot:focus-visible {
  outline: 2px solid var(--bm-accent);
  outline-offset: 2px;
}

.bertaclean-modal-shell__cerrar {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(12, 12, 13, 0.5);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.bertaclean-modal-shell__cerrar:hover,
.bertaclean-modal-shell__cerrar:focus-visible {
  background: rgba(12, 12, 13, 0.07);
  color: var(--bm-text);
}

.bertaclean-modal-shell__cerrar:focus-visible {
  outline: 2px solid var(--bm-accent);
  outline-offset: 2px;
}

.bertaclean-modal-shell--confirm .bertaclean-modal-shell__cerrar {
  visibility: visible;
}

/* Menos ruido con un único mensaje cerrable por botón inferior */
.bertaclean-modal-overlay[data-bertaclean-modal-tipo='alert'] .bertaclean-modal-shell__cerrar {
  display: none;
}

@media (max-width: 420px) {
  .bertaclean-modal-shell__acciones .bertaclean-modal-bot {
    flex: 1 1 100%;
  }
}
