/* ============================================
   OMNI — Mobile Native App Styles (Optimized)
   Transforma la tienda en experiencia tipo app nativa
   Solo aplica en viewports ≤ 768px
   ============================================ */

/* ─── Safe Area & System UI ─── */
@supports (padding: max(0px)) {
  @media (max-width: 768px) {
    .tienda .container,
    .product-single .container {
      padding-left: max(var(--space-3), env(safe-area-inset-left));
      padding-right: max(var(--space-3), env(safe-area-inset-right));
    }
  }
}

/* ─── Sección Tienda Mobile ─── */
@media (max-width: 768px) {
  .tienda {
    padding: var(--space-6) 0 var(--space-12);
    min-height: auto;
  }

  .tienda__header {
    text-align: left;
    margin-bottom: var(--space-3);
    padding: 0 var(--space-3);
  }

  .tienda__header .text-display {
    font-size: var(--text-xl);
    margin-bottom: var(--space-1);
    line-height: 1.2;
  }

  .tienda__subtitle {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
  }

  /* Botón cargar más */
  .tienda .flex-center {
    margin-top: var(--space-6);
  }

  .tienda .flex-center .btn {
    min-height: 44px;
    font-size: var(--text-xs);
    padding: var(--space-2) var(--space-6);
  }
}

/* ─── Filter Bar Nativo ─── */
@media (max-width: 768px) {
  .filter-bar {
    position: sticky;
    top: var(--navbar-height);
    z-index: var(--z-sticky);
    background: rgba(26, 21, 37, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(197, 160, 89, 0.08);
    margin-bottom: var(--space-3);
    padding: var(--space-2) var(--space-3);
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    overflow: visible;
  }

  /* Pills horizontales tipo stories */
  .filter-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0;
    gap: 6px;
    flex: 1;
    mask-image: linear-gradient(to right, black 90%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black 90%, transparent 100%);
    padding-right: var(--space-4);
  }

  .filter-pills::-webkit-scrollbar {
    display: none;
  }

  .filter-pill {
    flex-shrink: 0;
    padding: 5px 12px;
    font-size: 0.7rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
    background: transparent;
    transition: all 0.15s ease;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.04em;
    line-height: 1;
    white-space: nowrap;
  }

  .filter-pill:active {
    transform: scale(0.96);
    opacity: 0.9;
  }

  .filter-pill.is-active {
    background: var(--gradient-accion);
    border-color: var(--color-accion);
    box-shadow: 0 2px 8px rgba(255, 109, 0, 0.3);
    font-weight: 600;
  }

  /* Botón ordenar como chip */
  .filter-select {
    min-height: 32px;
    padding: 4px 24px 4px 10px;
    font-size: 0.7rem;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    background-position: right 8px center;
    background-size: 10px;
    flex-shrink: 0;
    letter-spacing: 0.02em;
  }

  /* Ocultar view-toggles en mobile */
  .view-toggles {
    display: none;
  }
}

/* ─── Grid de Productos Nativo ─── */
@media (max-width: 768px) {
  .grid-products {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: 0 var(--space-3);
  }

  .grid-products--compact,
  .grid-products--wide {
    display: flex !important;
    flex-direction: column !important;
  }
}

/* ─── Product Card Nativa (OPTIMIZED) ─── */
@media (max-width: 768px) {
  .product-card {
    display: grid;
    grid-template-columns: 110px 1fr;
    grid-template-rows: auto 1fr;
    gap: 0;
    background: var(--color-bg-card);
    border: 1px solid rgba(197, 160, 89, 0.12);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
    position: relative;
    min-height: 110px;
  }

  .product-card:active {
    transform: scale(0.987);
    border-color: rgba(197, 160, 89, 0.3);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  }

  /* Imagen: columna 1, ocupa ambas filas */
  .product-card > a:first-of-type {
    grid-column: 1;
    grid-row: 1 / 3;
    display: block;
    height: 100%;
    align-self: stretch;
  }

  .product-card__image-wrapper {
    aspect-ratio: auto;
    width: 110px;
    min-height: 110px;
    height: 100%;
    border-radius: 0;
    position: relative;
    background: var(--color-akasha);
  }

  .product-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: none;
    border-radius: 0;
  }

  .product-card:hover .product-card__image {
    transform: none;
  }

  /* Badge: columna 2 (body), fila 1, alineado arriba a la derecha — FUERA de la imagen */
  .product-card__badge {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: start;
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    margin: 8px 10px 4px 0;
    font-size: 0.55rem;
    padding: 2px 6px;
    z-index: 2;
    letter-spacing: 0.02em;
    line-height: 1.3;
  }

  /* Overlay oculto en mobile */
  .product-card__overlay {
    display: none;
  }

  /* Body: columna 2, fila 2 */
  .product-card__body {
    grid-column: 2;
    grid-row: 2;
    padding: 0 12px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-height: 0;
    overflow: hidden;
  }

  .product-card__collection {
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    margin-bottom: 0;
    opacity: 0.7;
    line-height: 1;
  }

  .product-card__name {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.25;
    -webkit-line-clamp: 2;
    margin-bottom: 2px;
    color: var(--color-text-primary);
    letter-spacing: 0.01em;
  }

  .product-card__price {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0;
    line-height: 1.2;
    color: var(--color-oro);
  }

  /* Selector de color en card mobile */
  .product-card__colors {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    margin-bottom: 2px;
  }
  .product-card__colors-label {
    font-size: 0.6rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
  }
  .color-swatches {
    display: flex;
    gap: 4px;
  }
  .color-swatch {
    width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    border: 1.5px solid transparent;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
  }
  .color-swatch.is-active {
    border-color: var(--color-oro);
    box-shadow: 0 0 0 1px var(--color-bg-card), 0 0 0 2px var(--color-oro);
  }

  /* Precio anterior más compacto */
  .product-card__body div[style*="line-through"] {
    font-size: 0.75rem !important;
    gap: 6px !important;
    margin-bottom: 2px !important;
  }

  .product-card__body div[style*="line-through"] .product-card__price {
    font-size: 0.95rem;
  }

  /* Meta oculta en mobile nativo */
  .product-card__meta {
    display: none;
  }

  /* ═══ CTAs — CORRECCIÓN BOTONES DESBORDADOS ═══ */
  .product-card__cta-group {
    flex-direction: row;
    gap: 6px;
    margin-top: 6px;
    align-items: stretch;
  }

  .product-card__btn-cart,
  .product-card__btn-buy {
    flex: 1 1 0;
    min-height: 34px;
    max-height: 40px;
    font-size: 0.6rem;
    padding: 4px 6px;
    border-radius: var(--radius-md);
    letter-spacing: 0.02em;
    line-height: 1.2;
    white-space: normal;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-align: center;
    align-items: center;
    justify-content: center;
    /* Reset de estilos de .btn que causan desbordamiento */
    text-transform: none;
    font-weight: 600;
  }

  /* El botón primario (Agregar al Carrito) ligeramente más prominente */
  .product-card__btn-cart {
    flex: 1.3 1 0;
    background: var(--gradient-accion);
    color: #fff;
    border: none;
    box-shadow: 0 1px 6px rgba(255, 109, 0, 0.25);
  }

  .product-card__btn-cart:active {
    transform: scale(0.97);
    box-shadow: 0 1px 3px rgba(255, 109, 0, 0.2);
  }

  /* Botón secundario más sutil */
  .product-card__btn-buy {
    flex: 1 1 0;
    background: transparent;
    color: var(--color-oro);
    border: 1px solid rgba(197, 160, 89, 0.3);
  }

  .product-card__btn-buy:active {
    background: rgba(197, 160, 89, 0.08);
    transform: scale(0.97);
  }
}

/* ─── Extra small: ajustes finos ≤ 480px ─── */
@media (max-width: 480px) {
  .product-card {
    grid-template-columns: 100px 1fr;
    min-height: 100px;
  }

  .product-card > a:first-of-type {
    grid-column: 1;
    grid-row: 1 / 3;
  }

  .product-card__image-wrapper {
    width: 100px;
    min-height: 100px;
  }

  .product-card__badge {
    margin: 6px 8px 2px 0;
    font-size: 0.5rem;
    padding: 1px 5px;
  }

  .product-card__body {
    grid-column: 2;
    grid-row: 2;
    padding: 0 10px 8px;
    gap: 2px;
  }

  .product-card__name {
    font-size: 0.8rem;
    line-height: 1.2;
  }

  .product-card__price {
    font-size: 0.85rem;
  }

  .product-card__cta-group {
    gap: 5px;
    margin-top: 5px;
  }

  .product-card__btn-cart,
  .product-card__btn-buy {
    min-height: 30px;
    max-height: 36px;
    font-size: 0.55rem;
    padding: 3px 4px;
    line-height: 1.15;
    letter-spacing: 0.01em;
  }
}

/* ─── Cart Drawer Nativo (Bottom Sheet) ─── */
@media (max-width: 768px) {
  .cart-drawer {
    top: auto;
    right: 0;
    bottom: -100%;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 85vh;
    min-height: 35vh;
    border-left: none;
    border-top: 1px solid rgba(197, 160, 89, 0.1);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    transition: bottom 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    background: rgba(26, 21, 37, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
  }

  .cart-drawer.is-active {
    right: 0;
    bottom: 0;
  }

  /* Handle indicator */
  .cart-drawer::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: rgba(197, 160, 89, 0.25);
    border-radius: var(--radius-full);
    z-index: 2;
  }

  .cart-drawer__header {
    padding-top: var(--space-5);
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid rgba(197, 160, 89, 0.06);
  }

  .cart-drawer__header h2 {
    font-size: var(--text-base);
    margin: 0;
  }

  .cart-drawer__items {
    padding: var(--space-3) var(--space-4);
    gap: var(--space-3);
  }

  .cart-drawer__footer {
    padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
    background: rgba(5, 5, 5, 0.7);
    border-top: 1px solid rgba(197, 160, 89, 0.08);
  }

  .cart-drawer__summary {
    font-size: var(--text-base);
    margin-bottom: var(--space-3);
  }

  .cart-drawer__footer .btn {
    min-height: 48px;
    font-size: var(--text-sm);
  }

  .cart-item__img {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
  }

  .cart-item__title {
    font-size: 0.8rem;
  }

  .cart-item__price {
    font-size: 0.8rem;
  }

  .cart-item__qty-btn {
    width: 28px;
    height: 28px;
    min-height: 28px;
  }
}

/* ─── Mobile Menu Nativo (Bottom Sheet) ─── */
@media (max-width: 768px) {
  .mobile-menu {
    top: auto;
    right: 0;
    bottom: -100%;
    left: 0;
    height: auto;
    min-height: 45vh;
    max-height: 70vh;
    justify-content: flex-start;
    padding-top: var(--space-6);
    padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    transform: none;
    transition: bottom 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    background: rgba(5, 5, 5, 0.98);
  }

  .mobile-menu.is-open {
    bottom: 0;
    transform: none;
  }

  .mobile-menu::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: rgba(197, 160, 89, 0.25);
    border-radius: var(--radius-full);
  }

  .mobile-menu__link {
    font-size: var(--text-lg);
    padding: var(--space-3) var(--space-5);
    width: 100%;
    text-align: center;
    line-height: 1.4;
  }

  .mobile-menu .btn {
    margin-top: var(--space-4);
    min-height: 44px;
    font-size: var(--text-sm);
  }
}

/* ─── Single Product Mobile Nativo ─── */
@media (max-width: 768px) {
  .product-single {
    padding-top: calc(var(--navbar-height) + var(--space-2));
    padding-bottom: var(--space-12);
  }

  .product-single__grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .product-single__gallery {
    margin: 0 calc(var(--space-3) * -1);
    width: calc(100% + var(--space-6));
  }

  .product-single__main-img {
    border-radius: 0;
    aspect-ratio: 1;
    border: none;
  }

  .product-single__thumbnails {
    padding: 0 var(--space-3);
    gap: var(--space-2);
    margin-top: var(--space-2);
  }

  .product-single__thumb {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    border-width: 1.5px;
  }

  .product-single__info {
    padding: 0 var(--space-3);
    gap: var(--space-3);
  }

  .product-single__title {
    font-size: var(--text-xl);
    line-height: 1.15;
    margin-bottom: var(--space-2);
  }

  .product-single__manifestation {
    margin-top: var(--space-2) !important;
    padding: var(--space-2) var(--space-3) !important;
    gap: var(--space-2) !important;
  }
  .product-single__manifestation > div:first-child {
    width: 32px !important;
    height: 32px !important;
  }
  .product-single__manifestation p:first-child {
    font-size: var(--text-xs) !important;
  }
  .product-single__manifestation p:last-child {
    font-size: 0.65rem !important;
  }

  .product-single__price {
    font-size: var(--text-lg);
    margin-bottom: 0;
  }

  .product-single__desc-short {
    font-size: var(--text-base);
    line-height: 1.5;
    margin-bottom: 0;
  }

  /* Barra de acciones fija abajo */
  .product-single__actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-sticky);
    margin: 0;
    padding: var(--space-2) var(--space-3);
    padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
    background: rgba(11, 16, 38, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(197, 160, 89, 0.1);
    gap: var(--space-2);
  }

  .product-single__actions .btn {
    min-height: 48px;
    font-size: var(--text-sm);
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Padding compensatorio para el contenido */
  .product-single__desc-long {
    margin-bottom: calc(48px + var(--space-8));
    font-size: var(--text-sm);
    line-height: 1.7;
  }

  /* Size selector mobile */
  .product-single__sizes {
    margin-top: var(--space-2);
  }

  .size-selector {
    gap: var(--space-2);
  }

  .size-btn {
    width: 48px;
    height: 48px;
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
  }
}

/* ─── Colecciones Mobile — Carrusel nativo ─── */
@media (max-width: 768px) {
  .colecciones {
    padding: var(--space-12) 0;
  }

  .colecciones .text-center {
    text-align: left;
    padding: 0 var(--space-3);
    margin-bottom: var(--space-4);
  }

  .colecciones .section-subtitle {
    text-align: left;
    padding: 0 var(--space-3);
    margin-bottom: var(--space-4);
    font-size: var(--text-base);
  }

  .collections-grid {
    display: flex !important;
    gap: var(--space-3);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scroll-padding-left: var(--space-3);
    padding-left: var(--space-3);
    padding-right: var(--space-3);
    scrollbar-width: none;
  }

  .collections-grid::-webkit-scrollbar {
    display: none;
  }

  .collections-grid .collection-card {
    flex: 0 0 72%;
    max-width: 260px;
    aspect-ratio: 3/4;
    scroll-snap-align: start;
    border-radius: var(--radius-xl);
  }

  .collection-card__content {
    padding: var(--space-4);
    align-items: flex-start;
    justify-content: flex-end;
    text-align: left;
    gap: 4px;
  }

  .collection-card__number {
    display: block;
    font-size: 0.6rem;
    margin-bottom: 2px;
  }

  .collection-card__title {
    font-size: var(--text-base);
    margin-bottom: 4px;
    line-height: 1.2;
  }

  .collection-card__desc {
    display: block;
    font-size: 0.75rem;
    margin-bottom: var(--space-2);
    opacity: 0.75;
    line-height: 1.4;
  }

  .collection-card__link {
    display: inline-flex;
    font-size: 0.75rem;
    gap: 4px;
  }
}

/* ─── Touch targets mejorados ─── */
@media (max-width: 768px) {
  .navbar__cart,
  .navbar__hamburger,
  .footer__social,
  .filter-pill,
  .filter-select,
  .faq-item__header,
  .cart-item__qty-btn,
  .cart-item__remove {
    min-height: 44px;
    min-width: 44px;
  }

  /* Inputs más grandes para iOS */
  .form-newsletter__input,
  input[type="email"],
  input[type="text"],
  input[type="tel"] {
    min-height: 48px;
    font-size: 16px;
  }
}

/* ─── Animaciones tipo app nativa ─── */
@media (max-width: 768px) {
  @keyframes slideUpFade {
    from {
      opacity: 0;
      transform: translateY(16px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .grid-products .product-card {
    animation: slideUpFade 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  /* Stagger animation */
  .grid-products .product-card:nth-child(1) { animation-delay: 0ms; }
  .grid-products .product-card:nth-child(2) { animation-delay: 35ms; }
  .grid-products .product-card:nth-child(3) { animation-delay: 70ms; }
  .grid-products .product-card:nth-child(4) { animation-delay: 105ms; }
  .grid-products .product-card:nth-child(5) { animation-delay: 140ms; }
  .grid-products .product-card:nth-child(6) { animation-delay: 175ms; }
  .grid-products .product-card:nth-child(7) { animation-delay: 210ms; }
  .grid-products .product-card:nth-child(8) { animation-delay: 245ms; }
}

/* ─── Navbar mobile refinements ─── */
@media (max-width: 768px) {
  .navbar__inner {
    padding: 0 var(--space-3);
  }

  .navbar__logo img {
    height: 32px;
  }
}

/* ─── FAQ mobile refinements ─── */
@media (max-width: 768px) {
  .faq-section {
    padding: var(--space-12) 0;
  }

  .faq-item__header {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    line-height: 1.4;
    min-height: 52px;
  }

  .faq-item__content {
    padding: 0 var(--space-4) var(--space-4);
    font-size: var(--text-sm);
    line-height: 1.7;
  }
}

/* ─── Circulo / Newsletter mobile ─── */
@media (max-width: 768px) {
  .circulo {
    padding: var(--space-12) 0;
  }

  .circulo .text-4xl {
    font-size: var(--text-xl);
  }

  .form-newsletter {
    flex-direction: column;
    gap: var(--space-2);
    max-width: 100%;
    padding: 0 var(--space-3);
  }

  .form-newsletter__input {
    min-height: 48px;
    border-radius: var(--radius-md);
  }

  .form-newsletter .btn {
    min-height: 48px;
    width: 100%;
  }

  .trust-badges {
    gap: var(--space-4);
    margin-top: var(--space-4);
  }
}

/* ─── Footer mobile ─── */
@media (max-width: 768px) {
  .footer {
    padding: var(--space-10) 0 var(--space-6);
  }

  .footer__links {
    gap: var(--space-3);
    margin-bottom: var(--space-6);
  }

  .footer__link {
    font-size: var(--text-xs);
  }

  .footer__socials {
    gap: var(--space-4);
    margin-bottom: var(--space-6);
  }

  .footer__social {
    width: 36px;
    height: 36px;
  }
}
