/* ===================================
   PRODUCT MODAL (TIENDA)
   =================================== */


.product-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 2000;
}
.product-modal.open { display: block; }

.product-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}

.product-modal__container {
  position: relative;
  width: min(1100px, 95vw);
  height: min(80vh, 95vh);
  margin: 5vh auto;
  background: var(--color-white);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.product-modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.06);
  color: #333;
  font-size: 1.25rem;
  cursor: pointer;
  z-index: 2;
}
.product-modal__close:hover { background: rgba(0,0,0,0.12); }

.product-modal__content {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0;
  height: 100%;
}

.modal-image {
  background: #f7f7f7;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.modal-info {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.modal-category {
  display: inline-block;
  background: var(--color-secondary);
  color: var(--color-primary);
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.modal-info h2 { margin: 0 0 0.5rem 0; }
.modal-meta { color: #666; font-size: 0.95rem; margin-bottom: 1rem; }
.modal-description { color: #444; margin-bottom: 1rem; max-height: 35vh; overflow: auto; }

.modal-price { display: flex; gap: 0.75rem; align-items: baseline; margin-bottom: 0.5rem; }
.modal-price .price { font-size: 1.6rem; font-weight: 800; color: var(--color-primary); }
.modal-price .price-anterior { text-decoration: line-through; color: #999; }

.stock-status { font-weight: 600; margin-bottom: 1rem; }
.stock-status.disponible { color: #0f766e; }
.stock-status.agotado { color: #b91c1c; }

.modal-action {
  margin-top: auto;
  width: 100%;
}

/* Mobile adjustments with consistent image height */
@media (max-width: 900px) {
  .product-modal__content { grid-template-columns: 1fr; }
  .product-modal__container { height: auto; max-height: 95vh; overflow-y: auto; }
  .modal-image { height: 52vh; }
  .modal-description { max-height: 25vh; }
  .modal-info { padding-bottom: 1rem; }
}

@media (max-width: 480px) {
  .modal-image { height: 52vh; }
  .modal-action {
    position: sticky;
    bottom: 0;
    background: transparent; /* keep button's own background (primary) */
    box-shadow: 0 -6px 12px rgba(0,0,0,0.06);
    padding-top: 0.5rem;
    z-index: 2;
    display: block;
  }
  .modal-action.btn.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-white);
  }
}

@supports (padding: env(safe-area-inset-bottom)) {
  .product-modal__container { padding-bottom: env(safe-area-inset-bottom); }
  .modal-action { margin-bottom: env(safe-area-inset-bottom); }
}
