/**
 * MODAL GLOBAL STYLES - Estilos compartidos para todos los modales
 * Usado por ModalManager.js
 */

/* ═══════ OVERLAY ═══════ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ═══════ MODAL CONTAINER ═══════ */
.modal {
  background: var(--bg-primary);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: scale(0.9) translateY(20px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Tamaños de modal */
.modal.modal-small {
  max-width: 400px;
}

.modal.modal-large {
  max-width: 900px;
}

/* ═══════ MODAL HEADER ═══════ */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 30px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 10;
  border-radius: 16px 16px 0 0;
}

.modal-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary, #1f2937);
  margin: 0;
}

.modal-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-secondary, #6b7280);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.modal-close-btn:hover {
  background: var(--bg-secondary, #f3f4f6);
  color: var(--text-primary, #1f2937);
  transform: rotate(90deg);
}

.modal-close-btn svg {
  width: 24px;
  height: 24px;
}

/* ═══════ MODAL BODY ═══════ */
.modal-body {
  padding: 30px;
}

/* ═══════ MODAL FOOTER ═══════ */
.modal-footer {
  padding: 20px 30px;
  border-top: 1px solid var(--border-color, #e5e7eb);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  align-items: center;
  position: sticky;
  bottom: 0;
  background: var(--card-bg, #ffffff);
  border-radius: 0 0 16px 16px;
}

/* ═══════ PREVENT SCROLL ═══════ */
body.modal-open {
  overflow: hidden;
}

/* ═══════ SCROLLBAR ═══════ */
.modal::-webkit-scrollbar {
  width: 8px;
}

.modal::-webkit-scrollbar-track {
  background: transparent;
}

.modal::-webkit-scrollbar-thumb {
  background: var(--border-color, #e5e7eb);
  border-radius: 4px;
}

.modal::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary, #9ca3af);
}

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 768px) {
  .modal {
    max-width: 100%;
    width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }

  .modal-header {
    padding: 20px;
    border-radius: 0;
  }

  .modal-title {
    font-size: 20px;
  }

  .modal-body {
    padding: 20px;
  }

  .modal-footer {
    padding: 16px 20px;
    border-radius: 0;
  }
}

/* ═══════ DARK MODE ═══════ */
@media (prefers-color-scheme: dark) {
  .modal-overlay {
    background: rgba(0, 0, 0, 0.7);
  }

  .modal {
    background: var(--card-bg-dark, #1f2937);
  }

  .modal-header {
    background: var(--card-bg-dark, #1f2937);
    border-bottom-color: var(--border-color-dark, #374151);
  }

  .modal-title {
    color: var(--text-primary-dark, #f9fafb);
  }

  .modal-close-btn:hover {
    background: var(--bg-secondary-dark, #111827);
    color: var(--text-primary-dark, #f9fafb);
  }

  .modal-footer {
    background: var(--card-bg-dark, #1f2937);
    border-top-color: var(--border-color-dark, #374151);
  }

  .modal::-webkit-scrollbar-thumb {
    background: var(--border-color-dark, #374151);
  }

  .modal::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary-dark, #6b7280);
  }
}

/* ═══════ REDUCED MOTION ═══════ */
@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal,
  .modal-close-btn {
    transition: none;
  }

  .modal {
    transform: none;
  }

  .modal-close-btn:hover {
    transform: none;
  }
}
