/* ============================================
   PRODUCT MODAL
   ============================================ */

.product-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(34, 34, 34, 0.28);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  z-index: 1001;
  transition: opacity 0.35s ease;
}

.product-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.product-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1002;
  width: min(1080px, calc(100vw - 32px));
  height: min(760px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.92);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.product-modal.active {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.modal-content {
  position: relative;
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.05fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(238, 231, 225, 0.4);
  border-radius: clamp(18px, 2vw, 24px);
  box-shadow: 0 20px 60px rgba(34, 34, 34, 0.15);
  backdrop-filter: blur(12px);
}

.modal-left {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 0.9rem;
  overflow: hidden;
  padding: clamp(1rem, 2.4vw, 1.75rem);
  background: linear-gradient(135deg, var(--blush) 0%, rgba(248, 216, 230, 0.3) 100%);
}

.modal-image-main {
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  border-radius: 16px;
  background: var(--white);
}

.modal-image-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: fadeInImage 0.5s ease-out;
}

@keyframes fadeInImage {
  from {
    opacity: 0;
    transform: scale(0.98);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-gallery {
  display: flex;
  flex: 0 0 auto;
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
  scroll-behavior: smooth;
}

.modal-gallery::-webkit-scrollbar {
  height: 3px;
}

.modal-gallery::-webkit-scrollbar-thumb,
.modal-details::-webkit-scrollbar-thumb {
  background: rgba(200, 167, 107, 0.24);
  border-radius: 999px;
}

.modal-thumb {
  width: clamp(54px, 7vw, 68px);
  height: clamp(54px, 7vw, 68px);
  flex: 0 0 clamp(54px, 7vw, 68px);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 10px;
  background: var(--white);
  transition: border-color 0.25s ease, transform 0.25s ease;
}

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

.modal-thumb:hover,
.modal-thumb.active {
  border-color: var(--gold);
  transform: scale(1.04);
}

.modal-right {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  padding: clamp(1.25rem, 2.8vw, 2.25rem);
  padding-right: clamp(1.1rem, 2.8vw, 2rem);
}

.modal-details {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: clamp(0.8rem, 1.6vw, 1.15rem);
  overflow-y: auto;
  padding-right: 0.35rem;
  -webkit-overflow-scrolling: touch;
}

.modal-details::-webkit-scrollbar {
  width: 4px;
}

.modal-close {
  position: absolute;
  top: clamp(0.7rem, 1.6vw, 1rem);
  right: clamp(0.7rem, 1.6vw, 1rem);
  z-index: 10;
  display: flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(248, 216, 230, 0.72);
  color: var(--text);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  transition: background 0.25s ease, transform 0.25s ease;
}

.modal-close:hover {
  background: rgba(200, 167, 107, 0.2);
  transform: rotate(90deg);
}

.modal-header {
  padding-top: 0.25rem;
  padding-right: 2.4rem;
}

.modal-header h2 {
  margin-bottom: 0.5rem;
  color: var(--text);
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.45rem, 2.3vw, 2rem);
  line-height: 1.12;
}

.modal-category {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--pink);
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.modal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.modal-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  background: rgba(248, 216, 230, 0.4);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  text-align: center;
}

.modal-description {
  margin: 0;
  color: var(--gray);
  font-size: clamp(0.9rem, 1.2vw, 1rem);
  line-height: 1.6;
}

.modal-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-section h3 {
  margin: 0;
  color: var(--text);
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem;
}

.modal-ingredients {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.ingredient-chip {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(200, 167, 107, 0.12);
  border-radius: 999px;
  background: rgba(248, 216, 230, 0.3);
  color: var(--text);
  font-size: 0.85rem;
  text-align: center;
  overflow-wrap: anywhere;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.ingredient-chip::before {
  content: '\273F';
  flex: 0 0 auto;
  color: #78a83f;
  font-size: 0.85rem;
  line-height: 1;
}

.ingredient-chip:hover {
  border-color: var(--gold);
  background: rgba(248, 216, 230, 0.6);
  transform: translateY(-2px);
}

.modal-benefits,
.modal-steps {
  display: grid;
  gap: 0.65rem;
}

.modal-steps {
  counter-reset: step-counter;
}

.benefit-item,
.step {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  padding: 0.65rem 0.7rem;
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.benefit-item {
  background: rgba(248, 216, 230, 0.15);
  transition: background 0.25s ease, transform 0.25s ease;
}

.benefit-item:hover {
  background: rgba(248, 216, 230, 0.3);
  transform: translateX(4px);
}

.step {
  color: var(--gray);
}

.benefit-item::before,
.step::before {
  display: inline-flex;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--gold);
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.benefit-item::before {
  content: '\2713';
}

.step::before {
  content: counter(step-counter);
  counter-increment: step-counter;
}

.modal-whatsapp-btn {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 48px;
  flex: 0 0 auto;
  margin-top: clamp(0.85rem, 1.5vw, 1.1rem);
  padding: 0.95rem 1.2rem;
  border: none;
  border-radius: 999px;
  background: #25d366;
  box-shadow: 0 8px 20px rgba(37, 211, 102, 0.2);
  color: var(--white);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.modal-whatsapp-btn:hover {
  background: #20ba5a;
  box-shadow: 0 12px 28px rgba(37, 211, 102, 0.3);
  transform: translateY(-2px);
}

.modal-whatsapp-btn:active {
  transform: translateY(0);
}

@media (max-width: 1080px) {
  .product-modal {
    width: min(940px, calc(100vw - 28px));
  }

  .modal-content {
    grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  }
}

@media (max-height: 760px) and (min-width: 821px) {
  .product-modal {
    width: min(980px, calc(100vw - 28px));
    height: calc(100dvh - 24px);
  }

  .modal-right {
    gap: 0.75rem;
  }

  .modal-details {
    gap: 0.75rem;
  }

  .modal-description {
    line-height: 1.5;
  }

  .ingredient-chip,
  .benefit-item {
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }
}

@media (max-width: 820px) {
  .product-modal {
    width: min(640px, calc(100vw - 24px));
    height: min(920px, calc(100dvh - 24px));
    max-height: calc(100dvh - 24px);
  }

  .modal-content {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(220px, 42%) minmax(0, 1fr);
    overflow: hidden;
  }

  .modal-left {
    min-height: 0;
    overflow: hidden;
    padding: 1rem;
    border-bottom: 1px solid rgba(238, 231, 225, 0.75);
  }

  .modal-image-main {
    flex: 1 1 auto;
    max-height: none;
  }

  .modal-right {
    min-height: 0;
    overflow: hidden;
    padding: 1.25rem;
  }

  .modal-header h2 {
    font-size: 1.55rem;
  }
}

@media (max-width: 560px) {
  .product-modal {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    height: min(94dvh, 880px);
    max-height: 94dvh;
    transform: translateY(100%) scale(1);
  }

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

  .modal-content {
    grid-template-rows: minmax(230px, 37%) minmax(0, 1fr);
    border-right: none;
    border-bottom: none;
    border-left: none;
    border-radius: 20px 20px 0 0;
  }

  .modal-left {
    gap: 0.65rem;
    padding: 0.85rem;
  }

  .modal-image-main {
    border-radius: 14px;
  }

  .modal-thumb {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
    border-radius: 9px;
  }

  .modal-right {
    gap: 0.8rem;
    padding: 1rem;
  }

  .modal-details {
    gap: 0.8rem;
  }

  .modal-close {
    position: fixed;
    top: 0.75rem;
    right: 0.75rem;
    width: 34px;
    height: 34px;
    background: rgba(255, 245, 248, 0.92);
    box-shadow: 0 8px 20px rgba(34, 34, 34, 0.12);
  }

  .modal-header {
    padding-right: 2.2rem;
  }

  .modal-header h2 {
    font-size: 1.45rem;
  }

  .modal-category {
    font-size: 0.65rem;
    letter-spacing: 0.14em;
  }

  .modal-badges {
    gap: 0.45rem;
  }

  .modal-badge {
    padding: 0.42rem 0.62rem;
    font-size: 0.76rem;
  }

  .modal-ingredients {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .ingredient-chip,
  .benefit-item,
  .step {
    font-size: 0.84rem;
  }

  .modal-whatsapp-btn {
    margin-top: 0.7rem;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.24);
  }
}

@media (max-width: 360px) {
  .modal-left {
    padding: 0.7rem;
  }

  .modal-right {
    padding: 0.85rem;
  }

  .modal-image-main {
    min-height: 0;
  }

  .modal-badge {
    font-size: 0.72rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-modal,
  .product-modal-backdrop,
  .modal-image-main img,
  .modal-thumb,
  .ingredient-chip,
  .benefit-item,
  .modal-whatsapp-btn {
    animation: none;
    transition: none;
  }
}
