/* ==============================================
   RE-LOVED STUDIO - MODAL DE DETALLE
   ============================================== */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.modal.show,
.modal.open,
.modal.active {
  display: flex !important;
}

.modal-dialog {
  width: 100%;
  max-width: 880px;
  margin: auto;
  position: relative;
}

.modal-content {
  position: relative;
  background: #ffffff;
  border-radius: 20px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.2);
  max-height: 88vh;
  overflow: hidden;
}

/* Botón cerrar */
.btn-close-modal-fixed {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  color: #111111;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 30;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.btn-close-modal-fixed:hover {
  background: #ffffff;
  transform: scale(1.08);
}

/* ==============================================
   COLUMNA IZQUIERDA: GALERÍA
   ============================================== */

.modal-gallery-wrapper {
  background: #fbfbfb;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #f0f0f0;
  position: relative;
}

.modal-main-image-container {
  position: relative;
  width: 100%;
  height: 430px;
  background: #f7f7f7;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal-media-viewport {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.modal-media-viewport img,
.modal-media-viewport video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* Flechas sutiles */
.gallery-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #111111;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 15;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
}

.gallery-nav-arrow.arrow-prev {
  left: 12px;
}

.gallery-nav-arrow.arrow-next {
  right: 12px;
}

.gallery-nav-arrow:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-50%) scale(1.05);
}

/* Tira horizontal de miniaturas */
.modal-thumbnails {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: #ffffff;
  overflow-x: auto;
  border-top: 1px solid #f0f0f0;
  max-height: 72px;
}

.modal-thumbnails .thumb-item {
  width: 44px;
  height: 52px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}

.modal-thumbnails .thumb-item.active {
  border-color: #111111;
  opacity: 1;
}

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

/* ==============================================
   COLUMNA DERECHA: INFORMACIÓN
   ============================================== */

.modal-info {
  padding: 2rem 1.8rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}

.modal-brand {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #c94a53;
  margin-bottom: 0.4rem;
  display: inline-block;
}

#modal-titulo {
  font-size: 1.35rem;
  font-weight: 600;
  color: #111111;
  line-height: 1.25;
  margin: 0 0 0.8rem 0;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 1.2rem;
}

.modal-meta span {
  display: inline-block;
  padding: 4px 9px;
  font-size: 0.72rem;
  font-weight: 500;
  border-radius: 50px;
  background: #f4f4f4;
  color: #444444;
}

.modal-price {
  font-size: 1.45rem;
  font-weight: 700;
  color: #111111;
  margin-bottom: 0.8rem;
}

.modal-desc {
  font-size: 0.88rem;
  line-height: 1.5;
  color: #666666;
  margin: 0 0 1.5rem 0;
}

.btn-submit-add {
  width: 100%;
  padding: 0.9rem;
  border-radius: 50px;
  border: none;
  background: #111111;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  margin-top: 1rem;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-submit-add:hover {
  background: #2a2a2a;
}

.btn-submit-add:active {
  transform: scale(0.99);
}

.btn-submit-add:disabled {
  background: #e2e2e2;
  color: #888888;
  cursor: not-allowed;
}
/* Bloqueo total de scroll de fondo en móviles */
body.modal-abierto {
  position: fixed;
  top: var(--scroll-y, 0);
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
  touch-action: none;
}

/* ==============================================
   RESPONSIVE MOBILE
   ============================================== */

@media (max-width: 768px) {
  .modal {
    padding: 0.5rem;
    align-items: flex-start;
  }

  .modal-dialog {
    max-width: 100%;
    margin: auto 0;
  }

  .modal-content {
    grid-template-columns: 1fr;
    max-height: 92vh;
    overflow-y: auto; /* Permite deslizar si el contenido supera la pantalla */
    -webkit-overflow-scrolling: touch;
  }

  .modal-gallery-wrapper {
    border-right: none;
    border-bottom: 1px solid #f0f0f0;
  }

  .modal-main-image-container {
    height: 280px; /* Tamaño equilibrado para no empujar el texto ni el botón fuera */
  }

  .modal-info {
    padding: 1.3rem 1.1rem 1.6rem 1.1rem;
    overflow: visible;
  }

  .btn-submit-add {
    margin-top: 1.2rem;
  }
}