/* ==================== 檔案名稱：mobile.css ==================== */

@media (min-width: 900px) {
  .mobile-floating-cart,
  .mobile-cart-backdrop {
    display: none !important;
  }
  .promo-separator {
    display: flex !important;
  }
}

/* 行動裝置共同樣式 (寬度 < 900px：含手機與平板) */
@media (max-width: 899px) {
  body {
    padding: 10px 8px 60px;
    background-color: var(--bg-outer);
  }

  .brand-title-area-outer {
    padding: 6px 0 10px !important;
  }

  .window-container {
    padding: 10px 8px 24px;
    border-radius: 12px 12px 0 0; 
    background-color: var(--bg-body);
    box-shadow: none !important;
  }

  .promo-bar {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px 6px !important;
    margin-bottom: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    justify-content: center !important;
  }

  .promo-separator {
    display: none !important;
  }

  /* 優惠方案共同項目：上下虛線、文字置中 */
  .promo-item {
    padding: 6px 0 !important;
    cursor: pointer !important; 
    box-shadow: none !important;
    box-sizing: border-box !important;
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    display: flex !important; 
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    position: relative !important;
    white-space: nowrap !important;
    height: auto !important;
    min-height: 0 !important;
    transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
  }

  .promo-item:hover {
    transform: translateY(-1px) !important;
  }

  /* 第 1 項（單筆滿額）：跨滿兩欄並置中 */
  .promo-item:nth-of-type(1) {
    width: 100% !important;
    flex: none !important;
    margin: 0 auto !important;
  }

  /* 第 2、3 項（全館任選、同款包色）：雙欄各佔一半，留在第二列原位 */
  .promo-item:nth-of-type(2),
  .promo-item:nth-of-type(3) {
    width: calc(50% - 3px) !important;
    flex: none !important;
  }

  /* 上方虛線：左右內縮 10px、1px 細線、緊密點距 */
  .promo-item::before {
    content: "" !important;
    position: absolute !important;
    top: 0 !important;
    left: 10px !important;
    right: 10px !important;
    height: 1px !important;
    background-image: linear-gradient(to right, #D5CDC5 50%, rgba(255, 255, 255, 0) 0%) !important;
    background-position: top !important;
    background-size: 4px 1px !important;
    background-repeat: repeat-x !important;
    pointer-events: none !important;
  }

  /* 下方虛線：左右內縮 10px、1px 細線、緊密點距 */
  .promo-item::after {
    content: "" !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 10px !important;
    right: 10px !important;
    height: 1px !important;
    background-image: linear-gradient(to right, #D5CDC5 50%, rgba(255, 255, 255, 0) 0%) !important;
    background-position: bottom !important;
    background-size: 4px 1px !important;
    background-repeat: repeat-x !important;
    pointer-events: none !important;
  }

  .promo-title-group {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
  }

  .promo-main-name {
    font-size: 11.5px !important;
    font-weight: 600 !important;
    color: var(--text-main) !important;
    line-height: 1 !important;
    letter-spacing: 0.3px !important;
  }

  .promo-sub-note {
    display: none !important;
  }

  .promo-desc {
    display: none !important;
  }

  .category-tabs {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 2px 4px 6px !important;
    gap: 8px 14px !important;
    margin-bottom: 12px !important; 
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .category-tabs::-webkit-scrollbar {
    display: none !important;
  }

  .category-tab {
    padding: 2px 4px 3px !important;
    font-size: 13.5px !important;
    font-weight: 400 !important; 
    flex-shrink: 0 !important;
    box-shadow: none !important;
    position: relative !important;
    line-height: 1.2 !important;
  }

  .category-tab.active {
    box-shadow: none !important;
    font-weight: 600 !important;
    opacity: 1 !important;
  }

  .category-tab.active::after {
    content: "" !important;
    position: absolute !important;
    bottom: 1px !important;
    left: 2px !important;
    right: 2px !important;
    height: 1px !important;
    background-color: var(--text-main) !important;
  }

  .products-wrapper {
    padding: 0 !important;
    box-shadow: none !important;
  }

  .product-card {
    padding: 10px 6px 8px !important; 
    box-shadow: none !important;
    box-sizing: border-box !important;
    border: 1px solid var(--border-main) !important;
    border-radius: 4px !important;
  }

  .product-tag {
    height: 18px !important;
    font-size: 9px !important;
    padding: 0 !important;
    margin-bottom: 4px !important;
    border: none !important;
  }

  .product-name {
    min-height: 32px !important;
    margin-bottom: 6px !important;
  }
  .product-title-main { font-size: 11px !important; }
  .product-title-sub { font-size: 9.5px !important; }

  .product-color-display {
    font-size: 10.5px !important;
    height: 32px !important;
  }

  .product-bottom-row {
    padding-bottom: 8px !important;
    margin-bottom: 8px !important;
    border-bottom: 1px solid var(--border-main) !important;
  }
  .product-footer {
    gap: 6px !important; 
  }

  .product-price-row {
    height: 24px !important; 
  }
  .product-price {
    font-size: 12px !important; 
    padding: 0 6px !important; 
  }
  .btn-add-square {
    width: 24px !important; 
    height: 24px !important; 
    font-size: 16px !important;
  }
  .btn-colors {
    height: 24px !important; 
    font-size: 10px !important; 
    padding: 0 6px !important; 
  }

  .cart-section {
    position: fixed;
    top: auto;
    bottom: -100%;
    left: 0;
    width: 100%;
    margin-top: 0 !important;
    z-index: 1000;
    transition: bottom 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  }

  .cart-section.is-mobile-open {
    bottom: 0;
  }

  .cart-wrapper {
    background-color: var(--bg-outer) !important; 
    border-radius: 16px 16px 0 0;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);
    padding: 16px 16px 24px;
    border: none !important;
  }
  
  .cart-item-card {
    border: 1px solid #D5CDC5 !important;
  }

  .cart-stepper {
    height: 18px !important; 
  }
  .stepper-btn {
    height: 18px !important;
  }
  .stepper-qty {
    line-height: 18px !important;
  }

  /* 手機版懸浮購物車：微導角正方形 (border-radius: 10px) */
  .mobile-floating-cart {
    display: flex !important;
    position: fixed !important;
    right: 18px !important;
    bottom: 24px !important;
    width: 48px !important;
    height: 48px !important;
    border-radius: 10px !important; 
    background-color: var(--bg-top-bar) !important;
    box-shadow: 2px 3px 10px rgba(0, 0, 0, 0.15) !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 900 !important;
    cursor: pointer !important;
  }

  .mobile-cart-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
  }

  .mobile-cart-icon {
    width: 26px !important;
    height: 26px !important;
    max-width: 26px !important;
    max-height: 26px !important;
    object-fit: contain;
    transform: translateX(-1.5px) !important;
  }

  .mobile-cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #C26D64;
    color: #FFFFFF;
    font-size: 10.5px;
    font-weight: 700;
    border-radius: 10px;
    padding: 2px 5px;
    line-height: 1;
    min-width: 16px;
    text-align: center;
  }

  .mobile-cart-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 950;
  }

  .mobile-cart-backdrop.is-active {
    display: block;
  }

  .color-popover {
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 88vw !important;
    max-width: 320px !important; 
    padding: 10px 12px 10px !important; 
    box-sizing: border-box !important;
  }

  .popover-header {
    margin-bottom: 8px !important;
    padding-bottom: 6px !important;
    border-bottom: 1px dashed #D5CDC5 !important;
    align-items: center !important;
  }

  .popover-title {
    font-size: 12.5px !important;
  }
  
  .popover-close-btn {
    font-size: 16px !important;
  }

  .modal-swatches-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important; 
    gap: 6px !important; 
    max-height: 50vh !important;
    padding-right: 0 !important; 
    width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important; 
    overflow-y: auto !important;
  }

  .modal-swatch-card {
    padding: 4px !important; 
    width: 100% !important;
    min-width: 0 !important; 
    box-sizing: border-box !important;
    border: 1px solid transparent !important;
  }

  .popover-footer {
    margin-top: 8px !important;
    gap: 6px !important; 
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .btn-popover-all {
    flex: 0 0 calc(25% - 4.5px) !important;
    width: calc(25% - 4.5px) !important;
    height: 32px !important;
    font-size: 12.5px !important;
    border: none !important;
  }

  .btn-popover-add {
    flex: 1 !important;
    height: 32px !important;
    font-size: 18px !important;
    border: none !important;
  }
}

/* 平板斷點：560px ～ 899px ➔ 一排 4 個商品 */
@media (min-width: 560px) and (max-width: 899px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
  }

  .product-img {
    width: 72px !important;
    height: 72px !important;
  }

  .product-preview {
    height: 78px !important;
  }

  .category-tabs {
    gap: 12px 20px !important;
  }
}

/* 手機斷點：< 560px ➔ 維持一排 3 個商品 */
@media (max-width: 559px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 4px !important;
  }

  .product-img {
    width: 60px !important;
    height: 60px !important;
  }

  .product-preview {
    height: 65px !important;
  }
}
/* ==================== 檔案結尾：mobile.css ==================== */