/* ═════════════════════════════════════════════════════════════════ */
/* MODALES - VERSIÓN MEJORADA                                       */
/* ═════════════════════════════════════════════════════════════════ */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    transform: translateY(30px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    transform: translateY(-30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: var(--zModal);
  animation: fadeIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active::before {
  content: '';
  position: fixed;
  inset: 0;
  animation: fadeIn 0.3s ease;
}

.modal {
  background: linear-gradient(135deg, var(--panel) 0%, rgba(14, 165, 233, 0.03) 100%);
  border: 1px solid var(--rim);
  border-radius: var(--rL);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 1px rgba(14, 165, 233, 0.2) inset;
  max-height: 90vh;
  overflow-y: auto;
  max-width: 600px;
  width: 90%;
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  z-index: 10;
}

.modal.modal-lg {
  max-width: 720px;
}

.modal.modal-xl {
  max-width: 920px;
}

.modal-header {
  padding: var(--lg) var(--xl);
  border-bottom: 1px solid var(--rim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.08) 0%, rgba(16, 217, 160, 0.04) 100%);
  position: sticky;
  top: 0;
  z-index: 5;
}

.modal-title {
  font-family: var(--fd);
  font-size: 18px;
  font-weight: 700;
  color: var(--txt);
  background: linear-gradient(135deg, var(--orbit) 0%, var(--pulse) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-close {
  background-color: transparent;
  border: none;
  color: var(--txtM);
  font-size: 24px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r);
  position: relative;
  flex-shrink: 0;
}

.modal-close:hover {
  background-color: var(--hover);
  color: var(--txt);
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

.modal-close:active {
  transform: rotate(90deg) scale(0.95);
}

.modal-body {
  padding: var(--xl);
  max-height: calc(90vh - 200px);
  overflow-y: auto;
}

.modal-body > *:first-child {
  animation: fadeInUp 0.5s ease-out 0.1s both;
}

.modal-body > *:nth-child(2) {
  animation: fadeInUp 0.5s ease-out 0.15s both;
}

.modal-body > *:nth-child(3) {
  animation: fadeInUp 0.5s ease-out 0.2s both;
}

.modal-footer {
  padding: var(--lg) var(--xl);
  border-top: 1px solid var(--rim);
  display: flex;
  justify-content: flex-end;
  gap: var(--md);
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.02) 0%, rgba(0, 0, 0, 0.1) 100%);
  position: sticky;
  bottom: 0;
  z-index: 5;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ══════════════════════════════════════════════════════════════════ */
