/* pages/producto/producto.responsive.css
 *
 * Breakpoints del modal/sheet de producto:
 *   < 720px    → mobile: bottom sheet full-width
 *   720–1023px → tablet: modal centrado tipo Tambo
 *   ≥ 1024px   → desktop: modal grande con 2 columnas
 *   ≥ 1280px   → xl: modal más espacioso
 */

/* ============================================================
   TABLET (≥ 720px) — Modal centrado
   ============================================================ */
@media (min-width: 720px) {
  .mf-product-overlay,
  .mf-modal-overlay {
    background: rgba(0, 0, 0, 0.65);
  }

  /* En tablet/PC el sheet se convierte en modal centrado tipo Tambo */
  .mf-product-sheet,
  .mf-modal-sheet {
    position: fixed;
    top: 50%;
    bottom: auto;
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
    width: calc(100% - 3rem);
    max-width: 720px;
    height: auto;
    max-height: 85vh;
    min-height: unset;
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    animation: mf-modal-in 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  /* En modal el handle no se necesita, lo ocultamos */
  .mf-product-sheet__handle {
    display: none;
  }

  /* Botón X visible en tablet/PC */
   .mf-modal-close {
     display: inline-flex;
     position: fixed;
     top: 0.9rem;
     right: 0.9rem;
     z-index: 10000;
     width: 42px;
     height: 42px;
     border-radius: 50%;
     background: var(--mf-bg);
     border: 0;
     color: var(--mf-ink);
     align-items: center;
     justify-content: center;
     cursor: pointer;
     box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
     -webkit-tap-highlight-color: transparent;
   }
   .mf-modal-close:hover {
     background: var(--mf-red);
     color: #fff;
   }
   .mf-modal-close svg { width: 20px; height: 20px; }
   .mf-product-close {
     display: inline-flex;
     width: 42px;
     height: 42px;
     background: var(--mf-bg);
     color: var(--mf-ink);
     box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
   }
   .mf-product-close:hover {
     background: var(--mf-red);
     color: #fff;
   }
   .mf-product-close svg { width: 20px; height: 20px; }

  /* Imagen más pequeña, a la izquierda en PC */
  .mf-product {
    flex-direction: row;
  }
  .mf-product__media {
    flex: 0 0 46%;
    width: 46%;
    aspect-ratio: 1 / 1;
    max-height: none;
    border-radius: 22px 0 0 22px;
  }
  .mf-product__media img,
  .mf-product__media picture {
    padding: 1.75rem;
  }

  .mf-product__info {
    flex: 1;
    padding: 1.5rem 1.6rem 1.5rem;
    gap: 0.75rem;
  }

  .mf-product__title { font-size: 1.55rem; font-weight: 500; }
  .mf-product__price { font-size: 1.75rem; }
  .mf-product__desc { font-size: 13.5px; }

  .mf-product__cta {
    padding: 0.75rem 1.6rem 0.8rem;
    background: var(--mf-bg);
    border-top: 1px solid var(--mf-line);
    margin-top: auto;
    flex-shrink: 0;
  }
  .mf-product__cta-buy {
    font-size: 14px;
    min-height: 40px;
    padding: 0.6rem 1.3rem;
    font-weight: 600;
  }
  .mf-qty button { width: 32px; height: 38px; }
  .mf-qty input { width: 36px; height: 38px; }

  /* Skeleton tablet: layout 2 columnas */
  .mf-product__skeleton {
    display: flex;
    flex-direction: row;
  }
  .mf-product__skel-media {
    flex: 0 0 46%;
    max-height: none;
    aspect-ratio: 1 / 1;
  }
  .mf-product__skel-info {
    flex: 1;
    padding: 1.5rem;
  }
}

/* ============================================================
   DESKTOP (≥ 1024px) — Modal más grande con dos columnas
   ============================================================ */
@media (min-width: 1024px) {
  .mf-product-sheet {
    max-width: 880px;
  }

  .mf-product__media {
    flex: 0 0 48%;
    width: 48%;
  }
  .mf-product__media img,
  .mf-product__media picture {
    padding: 2rem;
  }

  .mf-product__info {
    padding: 1.85rem 2rem;
    gap: 0.85rem;
  }

  .mf-product__title { font-size: 1.85rem; font-weight: 500; }
  .mf-product__price { font-size: 2rem; }
  .mf-product__desc { font-size: 14px; }
  .mf-product__note { font-size: 12.5px; }

  .mf-product__cta-buy {
    min-height: 56px;
    font-size: 15.5px;
  }
  .mf-product__cta-buy:hover { background: var(--mf-red-2); }
  .mf-product__cta-buy:active { transform: translateY(1px); }
  .mf-qty button:hover { background: var(--mf-bg-3); color: var(--mf-red); }
  .mf-product__share:hover { background: var(--mf-red); color: #fff; transform: scale(1.06); }
}

/* ============================================================
   XL (≥ 1280px)
   ============================================================ */
@media (min-width: 1280px) {
  .mf-product-sheet {
    max-width: 1020px;
  }

  .mf-product__media {
    flex: 0 0 50%;
    width: 50%;
  }
  .mf-product__media img,
  .mf-product__media picture {
    padding: 2.5rem;
  }

  .mf-product__info {
    padding: 2.25rem 2.5rem;
  }

  .mf-product__title { font-size: 2.1rem; font-weight: 500; }
  .mf-product__price { font-size: 2.3rem; }
}

/* ============================================================
   Animación de entrada del sheet en mobile
   ============================================================ */
@keyframes mf-sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes mf-sheet-down {
  from { transform: translateY(0); }
  to   { transform: translateY(100%); }
}

@keyframes mf-modal-in {
  from { transform: translate(-50%, -50%) scale(0.92); opacity: 0; }
  to   { transform: translate(-50%, -50%) scale(1);    opacity: 1; }
}

@keyframes mf-modal-out {
  from { transform: translate(-50%, -50%) scale(1);    opacity: 1; }
  to   { transform: translate(-50%, -50%) scale(0.94); opacity: 0; }
}

@keyframes mf-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes mf-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@media (max-width: 719px) {
  .mf-product-sheet {
    animation: mf-sheet-up 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
}

@media (min-width: 720px) {
  .mf-product-sheet {
    animation: mf-modal-in 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
  .mf-product-overlay {
    animation: mf-fade-in 0.25s ease forwards;
  }
}

/* ============================================================
   SAFE-AREAS en mobile
   ============================================================ */
@supports (padding: max(0px)) {
  .mf-product-close {
    top: max(0.7rem, env(safe-area-inset-top));
    right: max(0.7rem, env(safe-area-inset-right));
  }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .mf-product-sheet,
  .mf-product-overlay,
  .mf-product__media img,
  .mf-product__share,
  .mf-product__cta-buy,
  .mf-product-related__item {
    transition: none;
    animation: none;
  }
}
