/**
 * Modal System Styles - Estilos para sistema de modales personalizado
 * Compatible con todos los dispositivos y temas (light/dark)
 */

/* Overlay del modal */
.custom-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.custom-modal-overlay.show {
  opacity: 1;
}

.custom-modal-overlay.closing {
  opacity: 0;
}

/* Contenedor del modal */
.custom-modal {
  background: var(--card-bg, #ffffff);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 450px;
  width: 100%;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  animation: modalSlideUp 0.3s ease forwards;
}

.custom-modal-overlay.show .custom-modal {
  transform: scale(1);
}

.custom-modal-overlay.closing .custom-modal {
  transform: scale(0.9);
  opacity: 0;
}

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

/* Icono del modal */
.custom-modal-icon {
  text-align: center;
  padding: 24px 24px 0;
}

.custom-modal-icon span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-size: 32px;
  font-weight: bold;
  background: inherit;
}

/* Header */
.custom-modal-header {
  padding: 16px 24px 0;
  text-align: center;
}

.custom-modal-header h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
}

/* Body */
.custom-modal-body {
  padding: 16px 24px 24px;
  text-align: center;
}

.custom-modal-body p {
  margin: 0 0 16px 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary, #6b7280);
}

.custom-modal-body p:last-child {
  margin-bottom: 0;
}

/* Input en modal */
.custom-modal-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: var(--input-bg, #ffffff);
  color: var(--text-primary, #1f2937);
  transition: all 0.2s ease;
  margin-top: 8px;
}

.custom-modal-input:focus {
  outline: none;
  border-color: var(--primary-color, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Footer */
.custom-modal-footer {
  display: flex;
  gap: 12px;
  padding: 0 24px 24px;
  justify-content: center;
}

/* Botones del modal */
.btn-modal {
  flex: 1;
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  min-width: 100px;
}

.btn-modal:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.btn-modal:active {
  transform: scale(0.98);
}

.btn-modal-cancel {
  background: var(--secondary-bg, #f3f4f6);
  color: var(--text-primary, #1f2937);
}

.btn-modal-cancel:hover {
  background: var(--secondary-hover, #e5e7eb);
}

.btn-modal-confirm {
  background: var(--primary-color, #3b82f6);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-modal-confirm:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

/* Modo oscuro */
@media (prefers-color-scheme: dark) {
  .custom-modal {
    background: var(--card-bg, #1f2937);
  }

  .custom-modal-header h3 {
    color: var(--text-primary, #f9fafb);
  }

  .custom-modal-body p {
    color: var(--text-secondary, #d1d5db);
  }

  .custom-modal-input {
    background: var(--input-bg, #374151);
    border-color: var(--border-color, #4b5563);
    color: var(--text-primary, #f9fafb);
  }

  .btn-modal-cancel {
    background: var(--secondary-bg, #374151);
    color: var(--text-primary, #f9fafb);
  }

  .btn-modal-cancel:hover {
    background: var(--secondary-hover, #4b5563);
  }
}

/* Responsive - Móviles */
@media (max-width: 480px) {
  .custom-modal {
    max-width: 100%;
    margin: 0 16px;
  }

  .custom-modal-icon span {
    width: 56px;
    height: 56px;
    font-size: 28px;
  }

  .custom-modal-header h3 {
    font-size: 20px;
  }

  .custom-modal-body p {
    font-size: 14px;
  }

  .custom-modal-footer {
    flex-direction: column;
  }

  .btn-modal {
    width: 100%;
  }
}

/* Accesibilidad - Alto contraste */
@media (prefers-contrast: high) {
  .custom-modal {
    border: 2px solid var(--border-color, #000000);
  }

  .btn-modal {
    border: 2px solid currentColor;
  }
}

/* Reducir movimiento para usuarios con preferencia */
@media (prefers-reduced-motion: reduce) {
  .custom-modal-overlay,
  .custom-modal,
  .btn-modal {
    transition: none;
    animation: none;
  }

  .custom-modal-overlay.show .custom-modal {
    transform: none;
  }
}
