/**
 * Componente modal reutilizable: título, botón de cerrar, body libre.
 */

.modal {
  position: fixed;
  inset: 0;
  max-width: 100vw;
  max-height: 100dvh;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  visibility: hidden;
  pointer-events: none;
}

.modal.is-open {
  visibility: visible;
  pointer-events: auto;
}

.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal.is-open .modal__overlay {
  opacity: 1;
}

.modal__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.14);
  opacity: 0;
  transform: translateY(24px) scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.modal.is-open .modal__panel {
  opacity: 1;
  transform: none;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-bg-alt);
}

.modal__title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--color-text);
}

.modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: none;
  border: 0;
  color: var(--color-text);
  cursor: pointer;
}

.modal__close svg {
  width: 22px;
  height: 22px;
}

.modal__body {
  padding: 20px 24px 24px;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-wrap: break-word;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
}

.modal__body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.modal__body > *:first-child {
  margin-top: 0;
}

.modal__body > *:last-child {
  margin-bottom: 0;
}

.modal__body p {
  margin: 0 0 12px;
}

.modal__body ul,
.modal__body ol {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 12px;
  padding-left: 20px;
}

.modal__body strong {
  color: var(--color-text);
}

.modal__body a {
  color: var(--color-primary-dark);
}

.modal__body label {
  display: block;
  margin-bottom: 16px;
  font-weight: 600;
}

.modal__body input[type="text"],
.modal__body input[type="email"],
.modal__body input[type="tel"],
.modal__body textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 14px;
  font: inherit;
  color: var(--color-text);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-bg-alt);
  border-radius: var(--radius-sm);
}

.modal__body textarea {
  resize: vertical;
  min-height: 48px;
  height: 120px;
}

.modal__body input:focus,
.modal__body textarea:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.modal__body input[type="submit"] {
  display: inline-flex;
  margin-top: 4px;
  padding: 10px 24px;
  font: inherit;
  font-weight: 600;
  color: var(--color-text-inverse);
  background: var(--color-primary);
  border: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.modal__body input[type="submit"]:hover {
  background: var(--color-badge-dark);
}

@media (min-width: 768px) {
  .modal__panel {
    max-width: 768px;
  }

  .modal__header,
  .modal__body {
    padding-left: 32px;
    padding-right: 32px;
  }
}
