/* ════════════════════════════════════════════════════════════════════════════
   SOBIE PDP — Mobile UX styles
   ────────────────────────────────────────────────────────────────────────────
   Bao gồm:
   • v14 mobile UX patch (chips, accordion, gallery render, hero layout)
   • 2-column product grid trên mobile (Mix & Match, Cùng BST, Phụ kiện, Bạn vừa xem)
   ──────────────────────────────────────────────────────────────────────────── */


  /* DEFAULTS (desktop) */
  .sb-mob-chips,
  .sb-mob-actions-top,
  .sb-mob-acc-head,
  .sb-mob-size-label,
  .sb-mob-buy-suffix {
    display: none;
  }
  .sb-mob-header,
  .sb-mob-price-card {
    display: contents;
  }

  /* Hide sticky buybar on mobile */
  @media (max-width: 900px) {
    .sb-pdp .sb-buybar,
    #sb-buybar {
      display: none !important;
    }
  }

  @media (max-width: 768px) {

    /* SHOW mobile elements */
    .sb-mob-chips        { display: flex !important; }
    .sb-mob-actions-top  { display: flex !important; }
    .sb-mob-price-card   { display: flex !important; }
    .sb-mob-size-label   { display: inline !important; }
    .sb-mob-buy-suffix   { display: inline !important; }
    .sb-desktop-label    { display: none !important; }

    /* HIDE non-mobile elements */
    .sb-pdp .sb-crumbs { display: none !important; }
    .sb-pdp .sb-brand-tag { display: none !important; }
    .sb-pdp .sb-detail-nav { display: none !important; }
    .sb-pdp .sb-size-recommend { display: none !important; }
    .sb-pdp .sb-action-row { display: none !important; }
    .sb-pdp .sb-title-row .sb-mono { display: none !important; }
    .sb-mob-qty-section > .sb-title-row { display: none !important; }
    .sb-pdp .sb-detail-panel[data-panel="material"] > .sb-h3,
    .sb-pdp .sb-detail-panel[data-panel="material"] > .sb-sub,
    .sb-pdp .sb-detail-panel[data-panel="care"] > .sb-h3,
    .sb-pdp .sb-detail-panel[data-panel="care"] > .sb-sub,
    .sb-pdp .sb-detail-panel[data-panel="ship"] > .sb-h3 {
      display: none !important;
    }

    .sb-mob-header { display: contents !important; }
    .sb-pdp .sb-detail-section { display: block !important; }
    .sb-pdp .sb-detail-panel { display: block !important; }

    /* ═══════════════════════════════════════════════════════════
       v14 KEY FIX — Gallery rendering chain explicit
       ═══════════════════════════════════════════════════════════ */
    .sb-pdp .sb-gallery {
      aspect-ratio: 3 / 4 !important;
      max-height: none !important;
      overflow: hidden !important;
      position: relative !important;
    }
    .sb-pdp .sb-frame {
      position: absolute !important;
      inset: 0 !important;
      width: 100% !important;
      height: 100% !important;
      overflow: hidden !important;
    }
    .sb-pdp .sb-slide-track {
      position: absolute !important;
      inset: 0 !important;
      width: 100% !important;
      height: 100% !important;
      display: flex !important;
    }
    .sb-pdp .sb-slide {
      flex: 0 0 100% !important;
      min-width: 100% !important;
      width: 100% !important;
      height: 100% !important;
      padding: 0 !important;
      display: flex !important;
      align-items: center !important;
      justify-content: center !important;
    }
    .sb-pdp .sb-slide img {
      display: block !important;
      width: 100% !important;
      height: 100% !important;
      object-fit: contain !important;        /* full ảnh, không cắt; JS set khung khớp tỉ lệ ảnh nên không hở viền */
      object-position: center !important;
      background: var(--bg-card, #FAFAFA) !important;
      opacity: 1 !important;
      visibility: visible !important;
    }

    /* v8 fix: Loại khoảng trắng giữa thumb strip và product title (CSS-only,
       không cần chờ JS forceMobileStyles → tránh flicker) */
    .sb-pdp .sb-hero {
      padding: 0 !important;
      gap: 0 !important;
      margin: 0 !important;
    }
    .sb-pdp .sb-thumbs {
      margin: 0 !important;
      padding-bottom: 6px !important;
    }
    .sb-pdp .sb-info.classic-info,
    .sb-pdp .sb-info {
      padding: 12px 16px 24px !important;
      margin: 0 !important;
    }

    /* Mob top actions */
    .sb-mob-actions-top {
      position: absolute !important;
      top: 16px !important;
      right: 0 !important;
      z-index: 5 !important;
      gap: 8px !important;
    }
    .sb-mob-actions-top .sb-wish,
    .sb-mob-actions-top .sb-share,
    .sb-mob-actions-top .sobie-wishlist-btn {
      position: static !important;
      top: auto !important; right: auto !important;
      bottom: auto !important; left: auto !important;
      transform: none !important;
      width: 38px !important; height: 38px !important;
      min-width: 38px !important; max-width: 38px !important;
      border-radius: 50% !important;
      background: white !important;
      border: 1px solid #E5E5E5 !important;
      padding: 0 !important; margin: 0 !important;
      display: flex !important;
      align-items: center !important;
      justify-content: center !important;
      color: #11212A !important;
      box-shadow: none !important;
      opacity: 1 !important;
      visibility: visible !important;
    }
    .sb-mob-actions-top svg {
      width: 16px !important; height: 16px !important;
      stroke: #11212A !important;
    }

    /* Price card */
    .sb-mob-price-card {
      background: #F4F5F7 !important;
      border-radius: 14px !important;
      padding: 18px 20px !important;
      margin: 0 0 16px !important;
      justify-content: space-between !important;
      align-items: center !important;
      gap: 12px !important;
    }
    .sb-mob-price-card .sb-price-row {
      flex: 1 !important;
      display: flex !important;
      flex-direction: column !important;
      align-items: flex-start !important;
      gap: 2px !important;
      margin: 0 !important;
      padding: 0 !important;
      background: transparent !important;
    }
    .sb-mob-price-card .sb-price {
      font-size: 26px !important;
      font-weight: 800 !important;
      color: #11212A !important;
      line-height: 1.1 !important;
    }
    .sb-mob-price-card .sb-price-was {
      font-size: 13px !important;
      color: #A39C90 !important;
    }
    .sb-mob-price-card .sb-price-row::after {
      content: 'Đã bao gồm VAT' !important;
      font-size: 11px !important;
      color: #A39C90 !important;
      font-weight: 400 !important;
      margin-top: 2px !important;
      letter-spacing: 0 !important;
    }
    .sb-mob-price-card .sb-stock-bar {
      flex-shrink: 0 !important;
      margin: 0 !important;
      padding: 0 !important;
      background: transparent !important;
      display: flex !important;
      flex-direction: column !important;
      align-items: flex-end !important;
      text-align: right !important;
    }
    .sb-mob-price-card .sb-stock-track { display: none !important; }
    .sb-mob-price-card .sb-stock-bar > span {
      text-align: right !important;
      font-size: 0 !important;
      line-height: 1.35 !important;
    }
    .sb-mob-price-card .sb-stock-bar > span b {
      font-size: 12px !important;
      display: block !important;
    }
    .sb-mob-price-card .sb-stock-bar > span b:first-of-type {
      color: #16A34A !important;
      font-weight: 600 !important;
      font-size: 13px !important;
    }
    .sb-mob-price-card .sb-stock-bar > span b:first-of-type::before {
      content: '● ' !important;
    }
    .sb-mob-price-card .sb-stock-bar > span b:last-of-type {
      font-weight: 400 !important;
      color: #A39C90 !important;
    }
    .sb-mob-price-card .sb-stock-bar.sb-out > span b:first-of-type {
      color: #DC2626 !important;
    }

    /* Sizes */
    .sb-pdp .sb-size { border-radius: 999px !important; }
    .sb-pdp .sb-size.selected {
      background: #11212A !important;
      color: white !important;
      border-color: #11212A !important;
      font-weight: 600 !important;
    }
    .sb-pdp .sb-size.selected span { color: white !important; }

    /* Buttons */
    .sb-pdp .sb-btn-cart {
      border-radius: 999px !important;
      background: white !important;
      color: #11212A !important;
      border: 1.5px solid #11212A !important;
    }
    .sb-pdp .sb-btn-cart .t {
      text-transform: none !important;
      font-weight: 600 !important;
      letter-spacing: 0 !important;
      color: #11212A !important;
      font-size: 15px !important;
    }
    .sb-pdp .sb-btn-buy {
      border-radius: 999px !important;
      background: #1E3A8A !important;
      color: white !important;
      border: none !important;
    }
    .sb-pdp .sb-btn-buy .t {
      text-transform: none !important;
      font-weight: 600 !important;
      letter-spacing: 0 !important;
      color: white !important;
      font-size: 15px !important;
    }
    .sb-mob-buy-suffix { font-weight: 700 !important; }

    /* Qty */
    .sb-pdp .sb-qty { border-radius: 999px !important; border: 1px solid #E5E5E5 !important; }

    /* Chips */
    .sb-mob-chips {
      flex-wrap: wrap !important;
      gap: 6px !important;
      margin-top: 8px !important;
      margin-bottom: 0 !important;
    }
    .sb-mob-chip {
      display: inline-flex !important;
      align-items: center !important;
      gap: 5px !important;
      padding: 7px 11px !important;
      background: #F4F5F7 !important;
      border-radius: 999px !important;
      font-size: 11.5px !important;
      color: #5B564E !important;
      line-height: 1.3 !important;
      font-weight: 500 !important;
    }
    .sb-mob-chip svg {
      width: 13px !important;
      height: 13px !important;
      stroke: #5B564E !important;
      fill: none !important;
      flex-shrink: 0 !important;
    }

    /* Accordion */
    .sb-pdp .sb-detail-panel > .sb-mob-acc-head,
    button.sb-mob-acc-head {
      display: flex !important;
      width: 100% !important;
      min-height: 64px !important;
      padding: 20px 2px !important;
      margin: 0 !important;
      box-sizing: border-box !important;
      background: transparent !important;
      border: none !important;
      border-radius: 0 !important;
      font-family: inherit !important;
      font-size: 14px !important;
      font-weight: 700 !important;
      letter-spacing: 0.1em !important;
      line-height: 1.4 !important;
      text-transform: uppercase !important;
      color: #11212A !important;
      cursor: pointer !important;
      text-align: left !important;
      justify-content: space-between !important;
      align-items: center !important;
      -webkit-tap-highlight-color: transparent !important;
      -webkit-appearance: none !important;
      appearance: none !important;
      box-shadow: none !important;
      outline: none !important;
    }
    .sb-mob-acc-head:focus, .sb-mob-acc-head:hover {
      background: transparent !important;
      color: #11212A !important;
      box-shadow: none !important;
    }
    .sb-mob-acc-head:active { opacity: 0.7 !important; }
    .sb-mob-acc-label { flex: 1 !important; line-height: 1.4 !important; }
    .sb-mob-acc-icon {
      width: 18px !important;
      height: 18px !important;
      position: relative !important;
      flex-shrink: 0 !important;
      margin-left: 14px !important;
      display: inline-block !important;
    }
    .sb-mob-acc-icon::before, .sb-mob-acc-icon::after {
      content: '' !important;
      position: absolute !important;
      background: #11212A !important;
      transition: transform 0.25s ease !important;
    }
    .sb-mob-acc-icon::before {
      width: 18px !important;
      height: 1.5px !important;
      top: 8px !important;
      left: 0 !important;
    }
    .sb-mob-acc-icon::after {
      width: 1.5px !important;
      height: 18px !important;
      top: 0 !important;
      left: 8px !important;
    }
    .sb-mob-acc-head.is-open .sb-mob-acc-icon::after {
      transform: scaleY(0) !important;
    }
    .sb-detail-panel > *:not(.sb-mob-acc-head) { display: none; }
    .sb-detail-panel.is-open > *:not(.sb-mob-acc-head):not(style):not(script) {
      display: block;
    }
    .sb-detail-panel.is-open { padding-bottom: 24px !important; }
    .sb-detail-panel.is-open > *:not(.sb-mob-acc-head):not(style):not(script) {
      animation: sbAccFade 0.25s ease;
    }
    @keyframes sbAccFade {
      from { opacity: 0; transform: translateY(-4px); }
      to   { opacity: 1; transform: translateY(0); }
    }
  }

/* ════════════════════════════════════════════════════════════════════════════
   MOBILE PRODUCT GRID — 2-column wrap layout
   ──────────────────────────────────────────────────────────────────────────── */

  @media (max-width: 768px) {

    /* ─── Container: grid 2 cột wrap ─── */
    .sb-pdp .sb-mix-grid,
    .sb-pdp .bottom-related-grid,
    .sb-pdp #recently-viewed-grid {
      display: grid !important;
      grid-template-columns: repeat(2, 1fr) !important;
      gap: 12px 10px !important;
      overflow: visible !important;
      overflow-x: visible !important;
      scroll-snap-type: none !important;
      margin: 0 !important;
      padding: 0 !important;
      width: 100% !important;
    }

    /* ─── Card items: reset flex/scroll-snap → fit 50% column ─── */
    .sb-pdp .sb-mix-grid > *,
    .sb-pdp .bottom-related-grid > *,
    .sb-pdp #recently-viewed-grid > * {
      flex: none !important;
      max-width: 100% !important;
      width: 100% !important;
      min-width: 0 !important;
      scroll-snap-align: none !important;
    }

    /* ─── Section container: full-width, không padding âm ─── */
    .sb-pdp .sb-mix-section,
    .sb-pdp .sb-collection-section {
      padding: 36px 16px 28px !important;
      margin: 0 !important;
      border-top: 1px solid #D0D0D0 !important;
    }

    /* ─── Card content: compact hơn cho cột 50% ─── */
    .sb-pdp .luxe-card-wrapper .luxe-product-title,
    .sb-pdp .luxe-card-wrapper .luxe-product-title a {
      font-size: 13px !important;
      line-height: 1.3 !important;
    }
    .sb-pdp .luxe-card-wrapper .luxe-vendor {
      font-size: 10px !important;
      letter-spacing: 0.08em !important;
    }
    .sb-pdp .luxe-card-wrapper .new-price {
      font-size: 13px !important;
      font-weight: 700 !important;
    }
    .sb-pdp .luxe-card-wrapper .old-price {
      font-size: 11px !important;
    }
    .sb-pdp .luxe-card-wrapper .luxe-info-container {
      padding: 10px 8px !important;
    }
    .sb-pdp .luxe-card-wrapper .luxe-tags .tag {
      font-size: 9px !important;
      padding: 3px 6px !important;
      letter-spacing: 0.05em !important;
    }

    /* ─── Section heading: nhỏ hơn cho mobile ─── */
    .sb-pdp .sb-col-head {
      flex-wrap: wrap !important;
      gap: 8px !important;
      margin-bottom: 20px !important;
    }
    .sb-pdp .sb-col-head .sb-h2 {
      font-size: 22px !important;
      margin: 4px 0 !important;
      line-height: 1.2 !important;
    }
    .sb-pdp .sb-col-head .sb-eyebrow {
      font-size: 10px !important;
      letter-spacing: 0.16em !important;
    }
    .sb-pdp .sb-view-all {
      font-size: 11px !important;
      letter-spacing: 0.12em !important;
    }
  }
@media (max-width: 992px) {
  .sb-pdp .sb-info { position: relative; }
  
  /* H1 luôn có min-height đủ chứa 2 nút wishlist/share */
  .sb-pdp .sb-h1 {
    min-height: 60px;
    display: flex;
    align-items: center;
    padding-right: 110px;
    margin: 14px 0 12px;
  }
  
  .sb-pdp .sb-actions-mini {
    position: absolute;
    top: 28px;
    right: 16px;
    margin: 0;
    z-index: 5;
    display: flex;
    gap: 8px;
  }
  
  .sb-pdp .sb-action-row { display: block; }
  .sb-pdp .sb-action-row .sb-delivery { width: 100%; }
}

@media (max-width: 992px) {
  .sb-pdp .sb-mob-actions-top,
  .sb-mob-actions-top {
    padding-right: 16px !important;
    box-sizing: border-box;
  }
}
@media (max-width: 992px) {
  /* Selected size: nền trắng + chữ đen (hoặc style theo design mobile) */
  .sb-pdp .sb-size.selected,
  .sb-pdp .sb-size.selected span {
    color: var(--ink) !important;
  }
  
  /* Nếu mobile muốn nền đen như desktop, dùng block này thay block trên */
  /*
  .sb-pdp .sb-size.selected {
    background: var(--ink) !important;
    color: #fff !important;
  }
  .sb-pdp .sb-size.selected span { color: #fff !important; }
  */
}