/* ==========================================
   🎨 PUBLIKAYA MODALS FRAMEWORK
   Framework de modales adaptado con la paleta oficial de PublikaYA
   ========================================== */

/* ====================================
   PALETA DE COLORES OFICIAL PUBLIKAYA
   ==================================== */

:root {
  /* Colores oficiales exactos de PublikaYA */
  --color-base-white: #FCFCFC;        /* RGB: 252, 252, 252 */
  --color-primary: #1EAA92;           /* RGB: 30, 170, 146 - Verde principal */
  --color-secondary: #E8941E;         /* RGB: 232, 148, 30 - Naranja acento */
  --color-accent: #74B2F8;            /* RGB: 116, 178, 248 - Azul claro */
  --color-soft-bg: #C9DEDD;           /* RGB: 201, 222, 221 - Gris verdoso suave */
  --color-secondary-green: #62C1AF;   /* RGB: 98, 193, 175 - Verde agua secundario */
  
  /* Variaciones automáticas para efectos */
  --primary-light: #2ECC71;
  --primary-dark: #16A085;
  --secondary-light: #F39C12;
  --secondary-dark: #D35400;
  --accent-light: #85C1F9;
  --accent-dark: #5A9BD4;
  --soft-bg-light: #E1F0EF;
  --soft-bg-dark: #A8C5C4;
  
  /* Neutrales aesthetic */
  --bg-primary: #FCFCFC;
  --bg-secondary: #F8FAFC;
  --text-primary: #1E293B;
  --text-secondary: #64748B;
  --text-light: #94A3B8;
  --border: #E2E8F0;
  --shadow-light: rgba(0, 0, 0, 0.05);
  --shadow-medium: rgba(0, 0, 0, 0.1);
  --shadow-strong: rgba(0, 0, 0, 0.15);
}

/* ====================================
   SISTEMA BASE DE MODALES AESTHETIC
   ====================================/* Modal overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Estados del modal */
.modal-overlay.active,
.modal-overlay[style*="block"],
.modal-overlay[style*="display: block"] {
  opacity: 1 !important;
  visibility: visible !important;
}

/* Clase para body cuando modal está activo */
body.modal-active,
body.modal-open {
  overflow: hidden;
}


.modal {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  position: relative;
  display: block;
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

/* ====================================
   VARIANTES POR COLOR PUBLIKAYA
   ==================================== */

/* PRIMARY - Verde principal PublikaYA */
.modal-primary {
  border-top: 4px solid var(--color-primary);
}

.modal-primary .modal-header {
  background: linear-gradient(135deg, var(--color-primary), var(--primary-light));
}

.modal-primary .btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--primary-light));
  box-shadow: 0 8px 32px rgba(30, 170, 146, 0.3);
}

.modal-primary .btn-primary:hover {
  box-shadow: 0 12px 48px rgba(30, 170, 146, 0.4);
  transform: translateY(-2px);
}

/* SECONDARY - Naranja acento PublikaYA */
.modal-secondary {
  border-top: 4px solid var(--color-secondary);
}

.modal-secondary .modal-header {
  background: linear-gradient(135deg, var(--color-secondary), var(--secondary-light));
}

.modal-secondary .btn-primary {
  background: linear-gradient(135deg, var(--color-secondary), var(--secondary-light));
  box-shadow: 0 8px 32px rgba(232, 148, 30, 0.3);
}

.modal-secondary .btn-primary:hover {
  box-shadow: 0 12px 48px rgba(232, 148, 30, 0.4);
  transform: translateY(-2px);
}

/* ACCENT - Azul claro PublikaYA */
.modal-accent {
  border-top: 4px solid var(--color-accent);
}

.modal-accent .modal-header {
  background: linear-gradient(135deg, var(--color-accent), var(--accent-light));
}

.modal-accent .btn-primary {
  background: linear-gradient(135deg, var(--color-accent), var(--accent-light));
  box-shadow: 0 8px 32px rgba(116, 178, 248, 0.3);
}

.modal-accent .btn-primary:hover {
  box-shadow: 0 12px 48px rgba(116, 178, 248, 0.4);
  transform: translateY(-2px);
}

/* SOFT - Gris verdoso suave PublikaYA */
.modal-soft {
  border-top: 4px solid var(--color-soft-bg);
}

.modal-soft .modal-header {
  background: linear-gradient(135deg, var(--color-soft-bg), var(--soft-bg-light));
}

.modal-soft .btn-primary {
  background: linear-gradient(135deg, var(--color-soft-bg), var(--soft-bg-light));
  box-shadow: 0 8px 32px rgba(201, 222, 221, 0.3);
  color: var(--text-primary);
}

.modal-soft .btn-primary:hover {
  box-shadow: 0 12px 48px rgba(201, 222, 221, 0.4);
  transform: translateY(-2px);
}

/* SECONDARY-GREEN - Verde agua PublikaYA */
.modal-secondary-green {
  border-top: 4px solid var(--color-secondary-green);
}

.modal-secondary-green .modal-header {
  background: linear-gradient(135deg, var(--color-secondary-green), var(--primary-light));
}

.modal-secondary-green .btn-primary {
  background: linear-gradient(135deg, var(--color-secondary-green), var(--primary-light));
  box-shadow: 0 8px 32px rgba(98, 193, 175, 0.3);
}

.modal-secondary-green .btn-primary:hover {
  box-shadow: 0 12px 48px rgba(98, 193, 175, 0.4);
  transform: translateY(-2px);
}

/* ====================================
   COMPONENTES DEL MODAL
   ==================================== */

.modal-header {
  padding: 24px 32px 20px 32px;
  background: linear-gradient(135deg, var(--color-primary), var(--primary-light));
  color: white;
  position: relative;
  overflow: hidden;
}

.modal-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.2) 0%, 
    transparent 50%, 
    rgba(0, 0, 0, 0.1) 100%);
  pointer-events: none;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Montserrat', sans-serif;
}

.modal-subtitle {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-top: 4px;
  font-weight: 400;
  position: relative;
  z-index: 1;
  font-family: 'Montserrat', sans-serif;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s ease;
  z-index: 2;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.modal-body {
  padding: 32px;
  background: rgba(252, 252, 252, 0.95);
}

.modal-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ====================================
   TAMAÑOS DE MODAL
   ==================================== */

.modal-small {
  max-width: 400px;
  text-align: center;
}

.modal-medium {
  max-width: 600px;
}

.modal-large {
  max-width: 800px;
}

.modal-large .modal-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.modal-fullscreen {
  max-width: 95vw;
  max-height: 95vh;
}

/* ====================================
   FORMULARIOS AESTHETIC
   ==================================== */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
  letter-spacing: 0.3px;
  font-family: 'Montserrat', sans-serif;
}

.form-input {
  padding: 16px 20px;
  border: 2px solid var(--border);
  border-radius: 16px;
  font-size: 16px;
  background: rgba(252, 252, 252, 0.8);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  color: var(--text-primary);
  font-family: 'Montserrat', sans-serif;
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: rgba(252, 252, 252, 0.95);
  box-shadow: 
    0 0 0 4px rgba(30, 170, 146, 0.1),
    0 8px 32px rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

.form-input::placeholder {
  color: var(--text-light);
}

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

.form-help {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-family: 'Montserrat', sans-serif;
}

/* ====================================
   BOTONES AESTHETIC
   ==================================== */

.modal-actions {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  margin-top: 8px;
}

.btn {
  padding: 14px 28px;
  border: none;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.3px;
  font-family: 'Montserrat', sans-serif;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--primary-light));
  color: white;
  box-shadow: 0 8px 32px rgba(30, 170, 146, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 48px rgba(30, 170, 146, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 4px 16px rgba(30, 170, 146, 0.3);
}

.btn-secondary {
  background: rgba(252, 252, 252, 0.8);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  border: 2px solid var(--border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
  background: rgba(252, 252, 252, 0.95);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* ====================================
   ICONOS Y ELEMENTOS DECORATIVOS
   ==================================== */

.modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 20px;
  position: relative;
  overflow: hidden;
}

.modal-icon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.3) 0%, 
    transparent 50%, 
    rgba(0, 0, 0, 0.1) 100%);
}

.modal-icon.primary {
  background: linear-gradient(135deg, var(--color-primary), var(--primary-light));
  color: white;
}

.modal-icon.secondary {
  background: linear-gradient(135deg, var(--color-secondary), var(--secondary-light));
  color: white;
}

.modal-icon.accent {
  background: linear-gradient(135deg, var(--color-accent), var(--accent-light));
  color: white;
}

.modal-icon.soft {
  background: linear-gradient(135deg, var(--color-soft-bg), var(--soft-bg-light));
  color: var(--text-primary);
}

.modal-icon.secondary-green {
  background: linear-gradient(135deg, var(--color-secondary-green), var(--primary-light));
  color: white;
}

.modal-message {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin: 20px 0 32px;
  line-height: 1.6;
  font-family: 'Montserrat', sans-serif;
}

/* ====================================
   EFECTOS Y ANIMACIONES
   ==================================== */

/* Animación de entrada personalizada */
.modal-slide-up {
  transform: translateY(100px) scale(0.9);
}

.modal-overlay.active .modal-slide-up {
  transform: translateY(0) scale(1);
}

/* Animaciones específicas para galería */
@keyframes gallery-image-fade {
  0% { opacity: 0; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}

.gallery-image {
  animation: gallery-image-fade 0.4s ease;
}

@keyframes gallery-thumb-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(30, 170, 146, 0.3); }
  50% { box-shadow: 0 12px 32px rgba(30, 170, 146, 0.5); }
}

.gallery-thumb.active {
  animation: gallery-thumb-pulse 2s ease-in-out infinite;
}

/* Pulso sutil */
@keyframes subtle-pulse {
  0%, 100% { box-shadow: 0 32px 64px rgba(0, 0, 0, 0.12); }
  50% { box-shadow: 0 36px 72px rgba(0, 0, 0, 0.15); }
}

.modal-pulse {
  animation: subtle-pulse 4s ease-in-out infinite;
}

/* Efecto de brillo */
@keyframes shine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.modal-shine::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(255, 255, 255, 0.1), 
    transparent);
  transform: translateX(-100%);
  animation: shine 3s ease-in-out infinite;
}

/* Fade in suave */
.modal-fade {
  opacity: 0;
  transform: scale(0.95);
}

.modal-overlay.active .modal-fade {
  opacity: 1;
  transform: scale(1);
}

/* Zoom dramático */
.modal-zoom {
  transform: scale(0.5);
}

.modal-overlay.active .modal-zoom {
  transform: scale(1);
}

/* ====================================
   RESPONSIVE DESIGN
   ==================================== */

@media (max-width: 768px) {
  .modal {
    max-width: 95vw;
    margin: 0 10px;
  }

  .modal-large .modal-content {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .modal-header {
    padding: 20px 24px 16px;
  }

  .modal-body {
    padding: 24px 20px;
  }

  .modal-title {
    font-size: 1.3rem;
  }

  .btn {
    padding: 12px 24px;
    font-size: 14px;
  }

  .modal-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .modal-overlay {
    padding: 10px;
  }
  
  .modal-header {
    padding: 16px 20px 12px;
  }
  
  .modal-body {
    padding: 20px 16px;
  }
  
  .modal-close {
    width: 36px;
    height: 36px;
    top: 16px;
    right: 16px;
    font-size: 16px;
  }
}

/* ====================================
   UTILIDADES ADICIONALES
   ==================================== */

/* Ocultar scroll del body cuando modal está activo */
.modal-active {
  overflow: hidden;
}

/* Estados de validación para formularios */
.form-input.error {
  border-color: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.form-input.success {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(30, 170, 146, 0.1);
}

/* Loader para modales */
.modal-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(30, 170, 146, 0.2);
  border-top: 3px solid var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ====================================
   MODO OSCURO (OPCIONAL)
   ==================================== */

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-light: #64748B;
    --border: #334155;
  }
  
  .modal {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .modal-body {
    background: rgba(15, 23, 42, 0.95);
  }
  
  .form-input {
    background: rgba(30, 41, 59, 0.8);
    color: var(--text-primary);
  }
  
  .btn-secondary {
    background: rgba(30, 41, 59, 0.8);
    color: var(--text-primary);
  }
}

/* ====================================
   CLASES DE UTILIDAD VITRINA PLUS
   ==================================== */

/* Modal específico para galería de imágenes */
.modal-gallery {
  z-index: 1050;
}

.modal-gallery .modal {
  max-width: 95vw;
  max-height: 95vh;
  width: auto;
}

.modal-gallery .modal-body {
  padding: 20px;
  background: rgba(252, 252, 252, 0.98);
}

/* Contenedor principal de la galería */
.image-gallery-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  max-height: 70vh;
  margin-bottom: 20px;
}

.gallery-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 100%;
  overflow: hidden;
}

.gallery-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

/* Botones de navegación */
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border: none;
  background: rgba(30, 170, 146, 0.9);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.3s ease;
  z-index: 10;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(30, 170, 146, 0.3);
}

.gallery-nav:hover {
  background: rgba(30, 170, 146, 1);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 12px 32px rgba(30, 170, 146, 0.4);
}

.gallery-nav--prev {
  left: 20px;
}

.gallery-nav--next {
  right: 20px;
}

/* Thumbnails */
.gallery-thumbnails {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 16px;
  background: rgba(201, 222, 221, 0.3);
  border-radius: 16px;
  backdrop-filter: blur(10px);
}

.gallery-thumb {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  object-fit: cover;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.3s ease;
  opacity: 0.7;
}

.gallery-thumb:hover {
  opacity: 1;
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.gallery-thumb.active {
  opacity: 1;
  border-color: var(--color-primary);
  transform: scale(1.1);
  box-shadow: 0 8px 24px rgba(30, 170, 146, 0.3);
}

/* Indicadores */
.gallery-indicators {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.gallery-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.5);
  cursor: pointer;
  transition: all 0.3s ease;
}

.gallery-indicator:hover {
  background: rgba(30, 170, 146, 0.7);
  transform: scale(1.2);
}

.gallery-indicator.active {
  background: var(--color-primary);
  transform: scale(1.3);
  box-shadow: 0 4px 12px rgba(30, 170, 146, 0.4);
}

/* Responsive para galería */
@media (max-width: 768px) {
  .modal-gallery .modal {
    max-width: 100vw;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
  }
  
  .gallery-nav {
    padding: 8px 12px;
    font-size: 18px;
  }
  
  .gallery-thumbnails {
    padding: 10px;
    gap: 8px;
  }
  
  .gallery-thumb {
    width: 50px;
    height: 50px;
  }
  
  .gallery-indicator {
    width: 10px;
    height: 10px;
  }
}

@media (max-width: 480px) {
  .image-gallery-container {
    min-height: 250px;
    max-height: 50vh;
  }
  
  .gallery-nav {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }
  
  .gallery-nav--prev {
    left: 5px;
  }
  
  .gallery-nav--next {
    right: 5px;
  }
  
  .gallery-thumbnails {
    gap: 6px;
    padding: 8px;
  }
  
  .gallery-thumb {
    width: 45px;
    height: 45px;
  }
}

/* ====================================
   TARJETAS DE IMAGEN EXISTENTES
   ==================================== */

/* Tarjetas de imagen existentes */
.img-card {
    position: relative;
    border-radius: 0.75rem;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.img-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.img-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.btn-delete-img {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2rem;
    height: 2rem;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
}

.img-card:hover .btn-delete-img {
    opacity: 1;
}

.btn-delete-img:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.btn-delete-img svg {
    width: 1rem;
    height: 1rem;
}
