/* GALLERY MODULE */
.gallery-section {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100vh;
  height: 100dvh;
  background: linear-gradient(
    180deg,
    #f8f4ff 0%,
    #f5f8f5 25%,
    #f0f8f0 40%,
    #fff0f5 60%,
    #f5f0f7 100%
  );
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2rem;
  animation: fadeIn 0.3s ease-out;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  /* GPU acceleration optimizations */
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  perspective: 1000px;
  -webkit-perspective: 1000px;
}

.gallery-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(3px);
  color: var(--text-purple);
  z-index: 1002; /* Por encima del panel de comentarios para que el botón de cerrar sea siempre visible */
  box-shadow: 
    0 12px 40px rgba(147, 112, 219, 0.15),
    0 4px 16px rgba(147, 112, 219, 0.1);
  border-bottom: 2px solid rgba(147, 112, 219, 0.15);
  transition: right 0.3s ease; /* Transición suave cuando se ajusta */
}

/* Ajustar header cuando los comentarios están abiertos */
body.comments-open .gallery-header {
  right: 400px; /* Dejar espacio para el panel de comentarios */
}

@media (max-width: 768px) {
  body.comments-open .gallery-header {
    right: 0; /* En móvil, el header puede quedar tapado */
  }
}

.gallery-header h2 {
  font-size: 2rem;
  color: var(--primary-purple);
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(147, 112, 219, 0.1);
}

.close-btn {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  color: var(--primary-purple);
  border: 2px solid rgba(255, 182, 193, 0.3);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 2rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  line-height: 1;
  box-shadow: 
    0 4px 15px rgba(255, 182, 193, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.close-btn:hover {
  transform: rotate(90deg) scale(1.1);
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(221, 160, 221, 0.4);
  box-shadow: 
    0 6px 20px rgba(255, 182, 193, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  color: var(--accent-violet);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  padding-top: 80px;
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}

.gallery-item {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(177, 156, 217, 0.25);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease-out;
  position: relative;
  min-height: 200px;
  border: 1px solid rgba(218, 112, 214, 0.1);
  /* GPU acceleration */
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* Reduce repaints for offscreen items */
  content-visibility: auto;
  contain-intrinsic-size: 200px;
  contain: layout style paint;
}

/* Estilos de botones admin están en admin.css - no duplicar aquí */

/* 📅 Date Picker Modal - Modern Design */
.date-picker-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(147, 112, 219, 0.25) !important;
  backdrop-filter: blur(8px) !important;
  z-index: 999999 !important; /* 🔥 MÁXIMO z-index con !important para forzar */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 15px; /* Padding para móviles */
  overflow-y: auto; /* Permitir scroll en móvil */
}

.date-picker-modal:not(.hidden) {
  opacity: 1 !important;
  pointer-events: all !important;
}

.date-picker-content {
  position: relative !important;
  background: rgba(255, 255, 255, 0.55) !important;
  backdrop-filter: blur(3px) !important;
  border: 2px solid rgba(147, 112, 219, 0.15) !important;
  border-radius: 20px !important;
  padding: 0 !important;
  max-width: 420px !important;
  width: calc(100% - 30px) !important; /* Más espacio en los lados en móvil */
  max-height: 85vh !important; /* Limitar altura en pantallas pequeñas */
  overflow-y: auto !important; /* Scroll si el contenido es muy alto */
  z-index: 1000000 !important; /* 🔥 SUPER z-index para estar arriba de TODO */
  box-shadow: 
    0 12px 40px rgba(147, 112, 219, 0.15),
    0 4px 16px rgba(147, 112, 219, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.5) !important;
  transform: scale(0.85) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  margin: auto; /* Centrar */
}

.date-picker-modal:not(.hidden) .date-picker-content {
  transform: scale(1) translateY(0);
}

.date-picker-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
}

.date-picker-content .modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 182, 193, 0.3);
  color: var(--primary-purple);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
  box-shadow: 
    0 4px 15px rgba(255, 182, 193, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.date-picker-content .modal-close:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(221, 160, 221, 0.4);
  transform: rotate(90deg);
  box-shadow: 
    0 6px 20px rgba(255, 182, 193, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.date-picker-header {
  padding: 30px 20px 15px;
  text-align: center;
  color: var(--primary-purple);
  position: relative;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
}

.date-picker-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 10px;
  filter: drop-shadow(0 2px 4px rgba(147, 112, 219, 0.2));
  animation: float 3s ease-in-out infinite;
  line-height: 1;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

.date-picker-header h2 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary-purple);
  text-shadow: 0 2px 4px rgba(147, 112, 219, 0.1);
  letter-spacing: -0.5px;
}

.date-picker-description {
  color: var(--accent-violet);
  margin: 0 20px 15px;
  font-size: 0.95rem;
  text-align: center;
  opacity: 0.9;
}

.date-picker-current {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
  margin: 0 15px 20px;
  padding: 12px 15px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(147, 112, 219, 0.15);
}

.date-label {
  color: var(--primary-purple);
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.8;
}

.date-display {
  color: var(--primary-purple);
  font-weight: 600;
  font-size: 1.1rem;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.date-input {
  width: calc(100% - 30px);
  margin: 0 15px 20px;
  padding: 14px 16px;
  border: 2px solid rgba(147, 112, 219, 0.3);
  border-radius: 14px;
  font-size: 1.05rem;
  font-family: inherit;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary-purple);
  transition: all 0.3s ease;
  cursor: pointer;
  text-align: center;
}

.date-input:hover {
  background: white;
  border-color: rgba(147, 112, 219, 0.5);
}

.date-input:focus {
  outline: none;
  border-color: var(--primary-purple);
  box-shadow: 0 0 0 4px rgba(147, 112, 219, 0.1);
  background: white;
}

.date-picker-actions {
  display: flex;
  gap: 10px;
  padding: 0 15px 28px;
}

.date-picker-actions button {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  letter-spacing: 0.3px;
}

.btn-cancel {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  color: var(--primary-purple);
  border: 2px solid rgba(255, 182, 193, 0.3);
  box-shadow: 
    0 4px 15px rgba(255, 182, 193, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(221, 160, 221, 0.4);
  transform: translateY(-2px);
  box-shadow: 
    0 6px 20px rgba(255, 182, 193, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.btn-confirm {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  color: var(--primary-purple);
  font-weight: 700;
  border: 2px solid rgba(255, 182, 193, 0.3);
  box-shadow: 
    0 4px 15px rgba(255, 182, 193, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.btn-confirm:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(221, 160, 221, 0.4);
  transform: translateY(-2px);
  box-shadow: 
    0 6px 20px rgba(255, 182, 193, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  color: var(--accent-violet);
}

.btn-confirm:active,
.btn-cancel:active {
  transform: translateY(0);
}

/* Loading state for confirm button */
.btn-confirm:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-confirm:disabled::after {
  content: ' ⏳';
}

/* 📱 Responsive para móviles */
@media (max-width: 768px) {
  .date-picker-content {
    max-width: 95%;
    border-radius: 20px;
  }

  .date-picker-header {
    padding: 35px 25px 15px;
  }

  .date-picker-icon {
    font-size: 3.5rem;
  }

  .date-picker-header h2 {
    font-size: 1.75rem;
  }

  .date-picker-description {
    font-size: 0.9rem;
    margin: 0 25px 15px;
  }

  .date-picker-current {
    margin: 0 15px 20px;
    padding: 12px 15px;
  }

  .date-input {
    width: calc(100% - 30px);
    margin: 0 15px 20px;
    padding: 14px 16px;
    font-size: 1rem;
  }

  .date-picker-actions {
    padding: 0 15px 30px;
    gap: 10px;
  }

  .date-picker-actions button {
    padding: 14px 18px;
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .date-picker-content {
    max-width: 98%;
    border-radius: 18px;
  }

  .date-picker-header {
    padding: 30px 20px 12px;
  }

  .date-picker-icon {
    font-size: 3rem;
    margin-bottom: 10px;
  }

  .date-picker-header h2 {
    font-size: 1.5rem;
  }

  .date-picker-description {
    font-size: 0.85rem;
    margin: 0 20px 12px;
  }

  .date-picker-current {
    margin: 0 12px 18px;
    padding: 10px 12px;
    flex-direction: column;
    gap: 5px;
    text-align: center;
  }

  .date-input {
    width: calc(100% - 24px);
    margin: 0 12px 18px;
    padding: 12px 14px;
    font-size: 0.95rem;
  }

  .date-picker-actions {
    padding: 0 12px 25px;
    gap: 8px;
  }

  .date-picker-actions button {
    padding: 12px 16px;
    font-size: 0.95rem;
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}

.gallery-item:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 6px 20px rgba(177, 156, 217, 0.35);
}

/* Desactivar hover en móvil para mejor rendimiento */
@media (hover: none) {
  .gallery-item:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(177, 156, 217, 0.25);
  }
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Estilos de loading están en loading.css - no duplicar aquí */

/* Media Modal */
