/* =========================================
   css/components/modal.css
   Modal genérico: backdrop, contenedor,
   header, body y footer.
========================================= */

/* --- Backdrop oscuro --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: modalFadeIn 0.2s ease forwards;
}

.modal-backdrop--hidden {
  display: none !important;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* --- Contenedor blanco del modal --- */
.modal-container {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  animation: modalSlideUp 0.25s ease forwards;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes modalSlideUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* --- Encabezado --- */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-slate-200);
  position: sticky;
  top: 0;
  background: var(--bg-white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-slate-900);
}

/* --- Botón de cierre (×) --- */
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-slate-400);
  cursor: pointer;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: background-color var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}

.modal-close:hover {
  background-color: var(--bg-slate-100);
  color: var(--text-slate-900);
}

/* --- Cuerpo (formulario) --- */
.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

/* --- Pie (botones) --- */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-slate-200);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .modal-container {
    max-width: 100%;
    border-radius: var(--radius-lg);
  }
}
