/**
 * YS CART — 購物車樣式
 *
 * Morandi 色系設計。包含購物車頁面、迷你購物車、Toast 通知。
 *
 * @version 2.0.0
 */

/* ════════════════════════════════════════════════
   購物車頁面
   ════════════════════════════════════════════════ */

.ys-ec-cart-page {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
    font-family: var(--ys-ec-font);
}

.ys-ec-cart-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ys-ec-text);
    margin: 0 0 24px;
}

/* ─── 空購物車（置中圖示） ─── */

.ys-ec-cart-empty {
    text-align: center;
    padding: 80px 20px;
    background: var(--ys-ec-card-bg);
    border-radius: var(--ys-ec-radius-lg);
    box-shadow: var(--ys-ec-shadow);
}

.ys-ec-cart-empty-icon {
    color: var(--ys-ec-primary-light);
    margin-bottom: 20px;
}

.ys-ec-cart-empty-icon svg {
    width: 80px;
    height: 80px;
    stroke-width: 1;
}

.ys-ec-cart-empty p {
    color: var(--ys-ec-text-muted);
    font-size: 1.05rem;
    margin-bottom: 24px;
}

/* ─── 購物車內容佈局 ─── */

.ys-ec-cart-content {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 32px;
    align-items: start;
}

/* ─── 購物車表頭 ─── */

.ys-ec-cart-header {
    display: grid;
    grid-template-columns: minmax(240px, 2fr) 100px 152px 100px 40px;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    background: var(--ys-ec-primary-bg);
    border-radius: var(--ys-ec-radius);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ys-ec-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ─── 購物車項目（圓角卡片） ─── */

.ys-ec-cart-item {
    display: grid;
    grid-template-columns: minmax(240px, 2fr) 100px 152px 100px 40px;
    gap: 12px;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--ys-ec-border-light);
    transition: background-color var(--ys-ec-transition);
}

.ys-ec-cart-item:hover {
    background-color: var(--ys-ec-primary-bg);
}

.ys-ec-cart-item:last-child {
    border-bottom: none;
}

/* 商品資訊區 */
.ys-ec-cart-item-product {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.ys-ec-cart-item-img {
    width: 72px;
    height: 72px;
    min-width: 72px;
    display: block;
    object-fit: cover;
    border-radius: var(--ys-ec-radius);
    border: 1px solid var(--ys-ec-border-light);
    flex-shrink: 0;
}

.ys-ec-cart-item-info {
    min-width: 0;
}

.ys-ec-cart-item-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ys-ec-text);
    margin: 0 0 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ys-ec-cart-item-variant {
    display: block;
    font-size: 13px;
    color: var(--ys-ec-primary-dark);
    font-weight: 600;
    margin-top: 2px;
}

.ys-ec-cart-item-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 8px;
    background: var(--ys-ec-primary);
    color: #fff;
    border-radius: 100px;
    margin-top: 4px;
}

/* 單價 */
.ys-ec-cart-item-price {
    font-size: 0.95rem;
    color: var(--ys-ec-text);
    text-align: center;
}

/* 數量控制（Morandi 風格 +/- 按鈕） */
.ys-ec-cart-item-qty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 152px;
    min-width: 152px;
}

.ys-ec-qty-minus,
.ys-ec-qty-plus {
    width: 32px;
    height: 32px;
    border: 1.5px solid var(--ys-ec-border);
    background: var(--ys-ec-card-bg);
    color: var(--ys-ec-text);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    user-select: none;
    box-sizing: border-box;
    padding: 0;
}

.ys-ec-qty-minus {
    border-radius: var(--ys-ec-radius) 0 0 var(--ys-ec-radius);
    border-right: none;
}

.ys-ec-qty-plus {
    border-radius: 0 var(--ys-ec-radius) var(--ys-ec-radius) 0;
    border-left: none;
}

.ys-ec-qty-minus:hover,
.ys-ec-qty-plus:hover {
    background: var(--ys-ec-primary-bg);
    color: var(--ys-ec-primary-dark);
}

.ys-ec-qty-input {
    width: 48px;
    height: 32px;
    border: 1.5px solid var(--ys-ec-border);
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--ys-ec-text);
    padding: 6px 4px;
    box-sizing: border-box;
    -moz-appearance: textfield;
    appearance: textfield;
    outline: none;
}

.ys-ec-qty-input::-webkit-outer-spin-button,
.ys-ec-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ys-ec-qty-input:focus {
    border-color: var(--ys-ec-primary);
    box-shadow: 0 0 0 2px rgba(143, 168, 184, 0.15);
}

.ys-ec-cart-page .ys-ec-cart-item-qty .ys-ec-qty-minus,
.ys-ec-cart-page .ys-ec-cart-item-qty .ys-ec-qty-plus {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    flex: 0 0 40px;
}

.ys-ec-cart-page .ys-ec-cart-item-qty .ys-ec-qty-input {
    width: 72px;
    min-width: 72px;
    height: 40px;
    min-height: 40px;
    flex: 0 0 72px;
    padding: 0 8px;
    line-height: 40px;
    border: 1.5px solid var(--ys-ec-border);
    border-radius: 0;
    background: var(--ys-ec-card-bg);
}

/* 行小計 */
.ys-ec-cart-item-total {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ys-ec-text);
    text-align: center;
}

/* 移除按鈕 */
.ys-ec-cart-item-remove {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--ys-ec-text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.15s ease;
}

.ys-ec-cart-item-remove:hover {
    background: var(--ys-ec-danger-light);
    color: var(--ys-ec-danger);
}

/* ════════════════════════════════════════════════
   側邊欄（圓角陰影卡片）
   ════════════════════════════════════════════════ */

.ys-ec-cart-sidebar {
    position: sticky;
    top: 100px;
    background: var(--ys-ec-card-bg);
    border: 1px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius-lg);
    padding: 24px;
    box-shadow: var(--ys-ec-shadow);
}

/* ─── 優惠券 ─── */

.ys-ec-cart-coupon {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--ys-ec-border-light);
}

.ys-ec-cart-coupon h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ys-ec-text);
    margin: 0 0 12px;
}

.ys-ec-cart-coupon-form {
    display: flex;
    gap: 8px;
}

.ys-ec-input {
    flex: 1;
    height: 40px;
    padding: 0 12px;
    border: 1.5px solid var(--ys-ec-border);
    border-radius: var(--ys-ec-radius);
    font-size: 0.9rem;
    color: var(--ys-ec-text);
    outline: none;
    transition: border-color var(--ys-ec-transition), box-shadow var(--ys-ec-transition);
}

.ys-ec-input:focus {
    border-color: var(--ys-ec-primary);
    box-shadow: 0 0 0 3px rgba(143, 168, 184, 0.2);
}

.ys-ec-input::placeholder {
    color: var(--ys-ec-text-muted);
}

.ys-ec-coupon-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--ys-ec-primary-bg);
    color: var(--ys-ec-primary-dark);
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
}

.ys-ec-coupon-remove {
    border: none;
    background: transparent;
    color: var(--ys-ec-primary-dark);
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
}

.ys-ec-coupon-remove:hover {
    opacity: 1;
}

/* ─── 合計 ─── */

.ys-ec-cart-totals {
    margin-bottom: 20px;
}

.ys-ec-cart-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 0.95rem;
    color: var(--ys-ec-text);
}

.ys-ec-cart-totals-discount {
    color: var(--ys-ec-danger);
}

.ys-ec-cart-grand-total {
    padding-top: 12px;
    margin-top: 8px;
    border-top: 2px solid var(--ys-ec-text);
    font-weight: 700;
    font-size: 1.15rem;
}

/* ─── 按鈕 ─── */

.ys-ec-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--ys-ec-radius);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--ys-ec-transition);
    border: none;
    line-height: 1;
    font-family: var(--ys-ec-font);
}

.ys-ec-btn-primary {
    background: var(--ys-ec-primary);
    color: #ffffff;
}

.ys-ec-btn-primary:hover {
    background: var(--ys-ec-primary-dark);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(143, 168, 184, 0.35);
}

.ys-ec-btn-outline {
    background: transparent;
    color: var(--ys-ec-text);
    border: 1.5px solid var(--ys-ec-border);
}

.ys-ec-btn-outline:hover {
    border-color: var(--ys-ec-primary);
    color: var(--ys-ec-primary-dark);
    background: var(--ys-ec-primary-bg);
}

.ys-ec-btn-block {
    width: 100%;
}

.ys-ec-btn-sm {
    height: 36px;
    padding: 0 16px;
    font-size: 0.85rem;
}

.ys-ec-cart-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ─── Loading 遮罩 ─── */

.ys-ec-cart-loading {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: var(--ys-ec-radius);
}

.ys-ec-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--ys-ec-border);
    border-top-color: var(--ys-ec-primary);
    border-radius: 50%;
    animation: ys-ec-spin 0.6s linear infinite;
}

@keyframes ys-ec-spin {
    to { transform: rotate(360deg); }
}

/* ════════════════════════════════════════════════
   Toast 通知（Morandi 配色）
   ════════════════════════════════════════════════ */

.ys-ec-toast {
    position: fixed !important;
    top: 80px !important;
    right: 24px !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 100001 !important;
    min-width: 200px !important;
    max-width: 360px !important;
    width: auto !important;
    height: auto !important;
    max-height: 60px !important;
    padding: 12px 20px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15) !important;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    pointer-events: auto;
    font-family: var(--ys-ec-font);
    line-height: 1.4;
    overflow: hidden;
}

.ys-ec-toast.ys-ec-toast-show {
    transform: translateX(0);
}

.ys-ec-toast-success {
    background: var(--ys-ec-success-light);
    color: #3d6b4a;
    border: 1px solid rgba(125, 171, 142, 0.3);
}

.ys-ec-toast-error {
    background: var(--ys-ec-danger-light);
    color: #8b4c4c;
    border: 1px solid rgba(192, 128, 128, 0.3);
}

/* ════════════════════════════════════════════════
   迷你購物車（浮動 + 滑入動畫）
   ════════════════════════════════════════════════ */

.ys-ec-mini-cart {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}

/* 購物車圖示按鈕 */
.ys-ec-mini-cart-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--ys-ec-primary);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(143, 168, 184, 0.4);
    transition: all var(--ys-ec-transition);
    position: relative;
}

.ys-ec-mini-cart-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(143, 168, 184, 0.5);
}

/* 數量徽章 */
.ys-ec-mini-cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--ys-ec-danger);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* 展開面板（滑入動畫 + 陰影） */
.ys-ec-mini-cart-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 340px;
    max-height: 480px;
    background: var(--ys-ec-card-bg);
    border: 1px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius-lg);
    box-shadow: var(--ys-ec-shadow-lg);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.25s ease;
}

.ys-ec-mini-cart-panel.ys-ec-mini-cart-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ys-ec-mini-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--ys-ec-border-light);
}

.ys-ec-mini-cart-header h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ys-ec-text);
    margin: 0;
}

.ys-ec-mini-cart-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--ys-ec-text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s ease;
}

.ys-ec-mini-cart-close:hover {
    background: var(--ys-ec-primary-bg);
}

.ys-ec-mini-cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

.ys-ec-mini-cart-empty {
    text-align: center;
    color: var(--ys-ec-text-muted);
    padding: 24px 0;
    font-size: 0.9rem;
}

/* 迷你購物車項目 */
.ys-ec-mini-cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--ys-ec-border-light);
}

/* 消除 item 與 total 之間的雙線：讓 total 的 border-top 負責分隔 */
.ys-ec-mini-cart-item:has(+ .ys-ec-mini-cart-total) {
    border-bottom: none;
}
/* fallback：若瀏覽器不支援 :has()，用 JS class 控制（見 refreshMiniCartFromApi） */
.ys-ec-mini-cart-item.ys-ec-last-item {
    border-bottom: none;
}

.ys-ec-mini-cart-item-img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--ys-ec-border-light);
    flex-shrink: 0;
}

.ys-ec-mini-cart-item-info {
    flex: 1;
    min-width: 0;
}

.ys-ec-mini-cart-item-title {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ys-ec-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ys-ec-mini-cart-item-variant {
    display: block;
    font-size: 12px;
    color: var(--ys-ec-primary-dark);
    font-weight: 600;
    margin-top: 2px;
    line-height: 1.3;
}

.ys-ec-mini-cart-item-meta {
    display: block;
    font-size: 13px;
    color: var(--ys-ec-text-muted);
    margin-top: 2px;
}

.ys-ec-mini-cart-item-remove {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--ys-ec-text-muted);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.ys-ec-mini-cart-item-remove:hover {
    background: var(--ys-ec-danger-light);
    color: var(--ys-ec-danger);
}

/* 迷你購物車小計 */
.ys-ec-mini-cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0 0;
    margin-top: 4px;
    border-top: 1px solid var(--ys-ec-border-light);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--ys-ec-text);
}

.ys-ec-mini-cart-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--ys-ec-border-light);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ys-ec-mini-cart-footer .ys-ec-btn {
    box-sizing: border-box;
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

/* 查看購物車按鈕 — 明顯邊框 */
.ys-ec-mini-cart-footer .ys-ec-btn-outline {
    border: 2px solid var(--ys-ec-primary) !important;
    color: var(--ys-ec-primary) !important;
    background: transparent !important;
}

.ys-ec-mini-cart-footer .ys-ec-btn-outline:hover {
    background: var(--ys-ec-primary-bg) !important;
}

/* 前往結帳按鈕 — 白色文字 */
.ys-ec-mini-cart-footer .ys-ec-btn-primary {
    background: var(--ys-ec-primary) !important;
    color: #fff !important;
    border-color: var(--ys-ec-primary) !important;
}

.ys-ec-mini-cart-footer .ys-ec-btn-primary:hover {
    background: var(--ys-ec-primary-dark) !important;
}

/* ════════════════════════════════════════════════
   加價購推薦區塊
   ════════════════════════════════════════════════ */

.ys-ec-addon-section {
    grid-column: 1 / -1;
    margin-top: 24px;
    padding: 20px;
    background: var(--ys-ec-card-bg);
    border: 1px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius-lg);
    box-shadow: var(--ys-ec-shadow);
}

.ys-ec-addon-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--ys-ec-text);
    margin: 0 0 16px;
}

.ys-ec-addon-title svg {
    color: var(--ys-ec-warning, #c4a67a);
    flex-shrink: 0;
}

.ys-ec-addon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.ys-ec-addon-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius);
    background: var(--ys-ec-body-bg);
    transition: box-shadow 0.15s ease;
}

.ys-ec-addon-item:hover {
    box-shadow: var(--ys-ec-shadow-hover);
}

.ys-ec-addon-img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: var(--ys-ec-radius);
    border: 1px solid var(--ys-ec-border-light);
    flex-shrink: 0;
}

.ys-ec-addon-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ys-ec-addon-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ys-ec-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ys-ec-addon-price {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ys-ec-danger);
}

.ys-ec-add-addon {
    flex-shrink: 0;
}

/* ─── 贈品選擇區 ─── */

.ys-ec-gift-picker {
    grid-column: 1 / -1;
    margin-top: 24px;
    padding: 20px;
    background: var(--ys-ec-card-bg);
    border: 1px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius-lg);
    box-shadow: var(--ys-ec-shadow);
}

.ys-ec-gift-promo {
    margin-bottom: 16px;
}

.ys-ec-gift-promo:last-child {
    margin-bottom: 0;
}

.ys-ec-gift-promo-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ys-ec-text);
    margin: 0 0 12px;
}

.ys-ec-gift-icon {
    font-size: 1.1em;
    line-height: 1;
}

.ys-ec-gift-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.ys-ec-gift-card {
    width: 160px;
    padding: 14px 12px;
    border: 1.5px solid var(--ys-ec-border-light);
    border-radius: var(--ys-ec-radius);
    background: var(--ys-ec-body-bg);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.ys-ec-gift-card:hover {
    border-color: var(--ys-ec-primary, #8fa8b8);
    box-shadow: var(--ys-ec-shadow-hover);
    transform: translateY(-2px);
}

.ys-ec-gift-card-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid var(--ys-ec-border-light);
}

.ys-ec-gift-card-placeholder {
    width: 80px;
    height: 80px;
    background: var(--ys-ec-border-light, #f3f4f6);
    border-radius: 6px;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ys-ec-muted, #ccc);
}

.ys-ec-gift-card-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--ys-ec-text);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ys-ec-gift-card-price {
    font-size: 0.75rem;
    color: #27ae60;
    font-weight: 600;
    margin-bottom: 8px;
}

.ys-ec-gift-card .ys-ec-btn-sm {
    width: 100%;
    font-size: 0.75rem;
    padding: 5px 8px;
}

/* ════════════════════════════════════════════════
   響應式（行動裝置 < 768px）
   ════════════════════════════════════════════════ */

@media (max-width: 1080px) {
    .ys-ec-cart-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {

    .ys-ec-cart-header {
        display: none;
    }

    .ys-ec-cart-item {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px 12px;
        position: relative;
        background: var(--ys-ec-card-bg);
        border-radius: var(--ys-ec-radius);
        border: 1px solid var(--ys-ec-border-light);
        box-shadow: var(--ys-ec-shadow);
        margin-bottom: 12px;
    }

    .ys-ec-cart-item:last-child {
        margin-bottom: 0;
    }

    .ys-ec-cart-item-product {
        padding-right: 40px;
    }

    .ys-ec-cart-item-img {
        width: 60px;
        height: 60px;
    }

    .ys-ec-cart-item-price,
    .ys-ec-cart-item-total {
        text-align: left;
    }

    .ys-ec-cart-item-price::before,
    .ys-ec-cart-item-total::before {
        content: attr(data-label) ": ";
        font-weight: 400;
        color: var(--ys-ec-text-muted);
        font-size: 0.85rem;
    }

    .ys-ec-cart-item-qty {
        justify-content: flex-start;
    }

    .ys-ec-cart-item-remove {
        position: absolute;
        top: 16px;
        right: 12px;
    }

    .ys-ec-cart-sidebar {
        position: static;
    }

    /* 贈品選擇區行動裝置：水平捲動 */
    .ys-ec-gift-cards {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
        scrollbar-width: thin;
    }

    .ys-ec-gift-card {
        flex: 0 0 150px;
        width: 150px;
    }

    .ys-ec-gift-picker {
        padding: 16px;
    }

    /* 加價購區塊行動裝置：水平捲動 */
    .ys-ec-addon-grid {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 12px;
        padding-bottom: 8px;
        scrollbar-width: thin;
    }

    .ys-ec-addon-item {
        flex: 0 0 240px;
    }

    /* 迷你購物車面板全寬 */
    .ys-ec-mini-cart-panel {
        width: calc(100vw - 32px);
        right: -8px;
    }

    /* Toast 全寬 */
    .ys-ec-toast {
        left: 16px;
        right: 16px;
        min-width: auto;
        max-width: none;
    }
}

/* 結帳頁隱藏浮動購物車 */
.ys-ec-checkout-wrapper ~ .ys-ec-mini-cart {
    display: none !important;
}

@media (max-width: 480px) {
    .ys-ec-cart-page {
        padding: 16px 12px;
    }

    .ys-ec-cart-title {
        font-size: 1.25rem;
    }

    .ys-ec-cart-sidebar {
        padding: 16px;
    }
}
