/* Ocultar modal por defecto */
#modal-quick-view {
  display: none;
}

/* Modal de vista rápida */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(3px);
}

.modal-content {
  position: relative;
  max-width: 960px;
  width: 100%;
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* 2 columnas: galería (izquierda) + info (derecha) */
.modal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: stretch;
  padding: 1.75rem;
}

/* Galería de imágenes */
.modal-gallery {
  position: relative;
  border-radius: 0.75rem;
  overflow: hidden;
  background-color: #e5e7eb;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Flechas del carrusel */
.modal-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background-color: rgba(15, 23, 42, 0.7);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal-arrow-left {
  left: 0.75rem;
}

.modal-arrow-right {
  right: 0.75rem;
}

.modal-arrow:hover {
  background-color: rgba(15, 23, 42, 0.85);
  transform: translateY(-50%) scale(1.03);
}

/* Badge de estado en esquina superior izquierda de imagen */
.modal-status-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.95);
  padding: 0.45rem 0.85rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Columna de información */
.modal-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
}

/* Botón de WhatsApp en flujo normal (sobre el título) */
#modal-whatsapp-link {
  position: static;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  order: -1;
}

#modal-whatsapp-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

/* Título del local en el modal */
.modal-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  margin-top: 0;
}

/* Lista de detalles */
.modal-details {
  margin: 0.5rem 0 1.25rem;
}

.modal-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.95rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--color-borde);
}

.modal-detail-row:last-child {
  border-bottom: none;
}

.modal-detail-row dt {
  font-weight: 600;
  color: #374151;
}

.modal-detail-row dd {
  margin: 0;
  text-align: right;
  color: #4b5563;
}

/* Comentario del local */
.modal-comment {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #666;
  margin-top: 0.5rem;
}

/* Botón de cierre */
.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0 16px;
  height: 40px;
  background: #ffffff;
  color: #111827;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  z-index: 20;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.22), 0 0 0 0.5px rgba(255, 255, 255, 0.9);
  transform: scale(1.06);
}

.modal-close:active {
  transform: scale(0.94);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18), 0 0 0 0.5px rgba(255, 255, 255, 0.7);
}

/* ========================================
   RESPONSIVE - DESKTOP (min-width: 769px)
   ======================================== */
@media (min-width: 769px) {
  .modal-gallery {
    position: relative !important;
    z-index: 1 !important;
  }

  .modal-content {
    position: relative;
  }

  .modal-close {
    top: 1rem;
    right: 1rem;
    height: 40px;
  }

  #modal-whatsapp-link {
    /* position: absolute; */
    top: 0;
    left: 0;
    z-index: 15;
    margin: 0;
    padding: 0.5rem 1rem;
  }
}

/* ========================================
   RESPONSIVE - MÓVIL (max-width: 768px)
   ======================================== */
@media (max-width: 768px) {
  .modal {
    align-items: flex-start;
  }

  .modal-content {
    max-width: 100%;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
    padding: 1rem 1rem 1.25rem;
    box-shadow: none;
    position: relative;
    overflow: hidden;
  }

  .modal-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 0;
    align-items: flex-start;
  }

  .modal-gallery {
    max-height: 45vh;
  }

  .modal-image {
    width: 100%;
    height: 100%;
    max-height: 45vh;
    object-fit: cover;
  }

  .modal-info {
    max-height: calc(55vh - 2.5rem);
    overflow-y: auto;
    padding-right: 0.25rem;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  }

  .modal-close {
    top: 0.3rem;
    right: 0.3rem;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 1.5rem;
    line-height: 1;
  }

  .modal-arrow {
    width: 36px;
    height: 36px;
    font-size: 1.5rem;
    line-height: 1;
  }

  .modal-title {
    font-size: 1.4rem;
    margin-top: 1rem;
  }

  .modal-detail-row {
    font-size: 0.9rem;
  }

  .modal-comment {
    font-size: 0.9rem;
  }

  /* Botón WhatsApp en móviles: después de la info */
  #modal-whatsapp-link {
    position: static;
    width: auto;
    margin: 1.5rem 0 0;
    top: auto;
    left: auto;
    z-index: auto;
    padding: 0.65rem 1.25rem;
  }

  #modal-whatsapp-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
  }
}
