/**
 * Mensajes del sistema (alertas) de Clínica Palermo.
 *
 * El tema base bootstrap_barrio emite el markup de las alertas (wrapper
 * .alert, icono SVG, encabezado y botón .btn-close), pero el sitio no carga
 * Bootstrap CSS ni JS: sin este archivo las alertas se muestran sin estilo y
 * el botón de cierre no hace nada. Estas reglas dan ese comportamiento en
 * todo el sitio, con la misma paleta que las páginas de acceso.
 *
 * El cierre lo resuelve js/alerts-dismiss.js, que sustituye al JavaScript de
 * Bootstrap (data-bs-dismiss) que no está disponible.
 */

.alert {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  margin-bottom: 1.25rem;
  padding: 0.875rem 2.75rem 0.875rem 0.875rem;
  border: 1px solid transparent;
  border-radius: var(--cp-radius-md);
  font-size: 0.875rem;
  line-height: 1.5;
  opacity: 1;
  transition: opacity 200ms ease, transform 200ms ease;
}

.alert svg {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.125rem;
  fill: currentcolor;
}

.alert > div {
  flex: 1;
}

.alert .alert-heading {
  margin-bottom: 0.25rem;
  font-size: 0.8125rem;
  font-weight: 700;
}

.alert-success {
  color: #1e6b43;
  background: #e7f6ee;
  border-color: #bfe5cf;
}

.alert-danger {
  color: #8f1d1d;
  background: #fdeceb;
  border-color: #f6c8c4;
}

.alert-warning {
  color: #7a4d12;
  background: #fdf3e3;
  border-color: #f2ddb4;
}

.alert-info {
  color: #0e4eb8;
  background: #e8f1fb;
  border-color: #c3dcf5;
}

/* Botón de cierre: el glifo se dibuja aquí porque Bootstrap CSS (que
 * pinta la "x" como imagen de fondo) no está cargado. */
.alert .btn-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 0.25rem;
  background: none;
  cursor: pointer;
}

.alert .btn-close::before {
  content: "×";
  display: block;
  font-size: 1.25rem;
  line-height: 1.5;
  color: currentcolor;
}

.alert .btn-close:hover,
.alert .btn-close:focus-visible {
  background: rgb(0 0 0 / 6%);
}

.alert .btn-close:focus-visible {
  outline: 0.125rem solid var(--cp-blue-500);
  outline-offset: 0.125rem;
}

/* Estado de cierre (js/alerts-dismiss.js). */
.alert.is-dismissing {
  opacity: 0;
  transform: translateY(-0.375rem);
}

/* Errores de formulario en línea (setErrorByName): hasta ahora se mostraban
 * como texto plano, sin color ni separación. */
.form-item--error-message,
.invalid-feedback {
  display: block;
  margin-top: 0.25rem;
  color: #8f1d1d;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.js-form-item.has-error > .form-item--error-message {
  font-weight: 500;
}

.form-item.has-error input,
.form-item.has-error select,
.form-item.has-error textarea {
  border-color: #d02828;
  box-shadow: 0 0 0 0.25rem rgb(208 40 40 / 15%);
}

/* ==========================================================================
   Popup de mensajes de autenticación (login, registro, contraseña, establecer
   clave, radiología, cita, cotizaciones y edición de perfil).
   Se muestra en un modal centrado con botón de cerrar.
   ========================================================================== */

/* Overlay que cubre la ventana. */
.auth-popup__overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0 0 0 / 45%);
  padding: 1rem;
}

/* Estado cerrado: se aplica al overlay (lo usa el JS). */
.auth-popup__overlay.is-hidden,
.auth-popup.is-hidden {
  display: none;
}

/* Modal centrado. */
.auth-popup {
  position: relative;
  width: 100%;
  max-width: 36rem;
  border: 1px solid var(--cp-gray-300);
  border-radius: var(--cp-radius-xl);
  background: var(--cp-white);
  padding: 2.5rem 1.75rem 1.75rem;
  box-shadow:
    0 1.5rem 3.75rem rgb(35 31 32 / 24%),
    0 0 0 1px rgb(0 185 234 / 8%);
  overflow: hidden;
}

/* Borde superior degradado institucional (azul → cian → naranja). */
.auth-popup::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--cp-blue-royal) 0%,
    var(--cp-cyan-500) 55%,
    var(--cp-orange-500) 100%
  );
}

/* Botón de cerrar (esquina superior derecha). */
.auth-popup__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 0.375rem;
  background: var(--cp-gray-100);
  color: var(--cp-muted);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.auth-popup__close:hover,
.auth-popup__close:focus-visible {
  background: var(--cp-gray-200);
  color: var(--cp-blue-700);
  outline: 0.125rem solid var(--cp-blue-500);
  outline-offset: 0.125rem;
}

.auth-popup__close svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

/* Botón de cerrar inferior (texto, alineado a la izquierda). */
.auth-popup__close--bottom {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 1.25rem;
  padding: 0;
  background: transparent;
  color: var(--cp-blue-700);
  font-size: 0.875rem;
  font-weight: 600;
  border: 0;
  border-radius: var(--cp-radius-md);
  cursor: pointer;
  width: auto;
  height: auto;
  font-family: inherit;
  text-decoration: none;
}

.auth-popup__close--bottom:hover,
.auth-popup__close--bottom:focus-visible {
  color: var(--cp-blue-500);
  outline: 0.125rem solid var(--cp-blue-500);
  outline-offset: 0.125rem;
  background: transparent;
}

/* Título del popup. */
.auth-popup__title {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  text-align: center;
  color: var(--cp-black);
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Cuerpo del mensaje. */
.auth-popup__body {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--cp-text);
  text-align: center;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Divisor antes del pie. */
.auth-popup__divider {
  border: 0;
  border-top: 1px solid var(--cp-gray-200);
  margin: 1rem 0;
}

/* Pie institucional. */
.auth-popup__footer {
  margin: 0;
  font-size: 0.75rem;
  color: var(--cp-muted);
  text-align: center;
}

/* Colores según tipo de mensaje. */
.auth-popup--error .auth-popup__title { color: #8f1d1d; }
.auth-popup--warning .auth-popup__title { color: #b45309; }
