/**
 * 商城頁面樣式
 * /pages/products.php
 */

/* 全局變數 - 使用網站主色調 */
:root {
    --product-primary: var(--primary, var(--color-primary));
    --product-primary-dark: var(--primary-dark, var(--color-primary-dark));
    --product-bg: var(--bg-body, var(--bg-body));
    --text-secondary: var(--text-light, #999999);
    --border-color: rgba(170, 145, 119, 0.15);
}

body {
    background-color: var(--product-bg);
}

/* 容器 */
.products-container {
    max-width: 1200px;
    margin: 0 auto;
    /* 與 services/cart 等頁面一致，預留導覽列高度與上方空間 */
    padding: 0 20px 20px;
}

@media (max-width: 767.98px) {
    .products-container {
        /* 手機版導覽列較矮，頂部間距略縮小 */
        padding: 100px 15px 20px;
    }
}

/* 商品卡片 - 簡約美業風格 */
.product-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s ease;
    overflow: hidden;
    height: 100%;
    cursor: pointer;
}

.product-card:hover {
    border-color: var(--product-primary);
    box-shadow: 0 4px 12px rgba(170, 145, 119, 0.15);
    transform: translateY(-2px);
}

/* 圖片容器 */
.product-img-wrapper {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--product-bg);
    position: relative;
}

.product-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-img-wrapper img {
    transform: scale(1.05);
}

/* 標籤容器 - 優化多標籤排列 */
.product-badges-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 10;
    pointer-events: none;
}

.product-badges-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px;
}

.product-badges-left,
.product-badges-right {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 48%;
}

.product-badges-left {
    justify-content: flex-start;
}

.product-badges-right {
    justify-content: flex-end;
}

/* 標籤基本樣式 */
.product-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    line-height: 1.2;
}

.product-badge i {
    font-size: 9px;
    margin-right: 2px;
}

/* 折扣徽章 - 最高優先級（左上） */
.product-badge.discount {
    background: linear-gradient(135deg, var(--color-danger) 0%, #c82333 100%);
    color: #fff;
    font-size: 11px;
    padding: 5px 10px;
}

/* 期間限定徽章（左上） */
.product-badge.limited-time {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

/* 限量徽章（左下） */
.product-badge.limited-qty {
    background: rgba(220, 53, 69, 0.95);
    color: #fff;
    position: absolute;
    bottom: 8px;
    left: 8px;
}

/* 熱銷徽章（右上） */
.product-badge.hot {
    background: linear-gradient(135deg, var(--color-warning) 0%, #ff9800 100%);
    color: #fff;
}

/* 新品徽章（右上） */
.product-badge.new {
    background: linear-gradient(135deg, var(--color-success) 0%, #20c997 100%);
    color: #fff;
}

/* 推薦徽章（右上） */
.product-badge.recommended {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: #fff;
}

/* 商品資訊 */
.product-card-body {
    padding: 20px;
}

/* 商品分類標籤 - 簡潔設計 */
.product-category-tags {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    min-height: 24px;
}

.product-category-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.product-category-tag i {
    font-size: 9px;
}

/* 主要分類標籤 */
.product-category-tag.primary {
    background: linear-gradient(135deg, rgba(170, 145, 119, 0.12) 0%, rgba(170, 145, 119, 0.08) 100%);
    color: var(--product-primary);
    border: 1px solid rgba(170, 145, 119, 0.2);
}

.product-card:hover .product-category-tag.primary {
    background: linear-gradient(135deg, rgba(170, 145, 119, 0.18) 0%, rgba(170, 145, 119, 0.12) 100%);
    border-color: rgba(170, 145, 119, 0.3);
}

/* 次要分類標籤（如果需要） */
.product-category-tag.secondary {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-secondary);
    border: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 10px;
    padding: 3px 8px;
}

/* 舊版兼容 */
.product-category-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 10px;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.product-category {
    display: inline-block;
    background: rgba(170, 145, 119, 0.08);
    color: var(--product-primary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
}

.product-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 10px;
    line-height: 1.4;
    min-height: 2.8em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-rating {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.product-price-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.product-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--product-primary);
    line-height: 1.2;
}

.product-original-price {
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: line-through;
    line-height: 1.2;
}

/* 搜尋和排序區域 */
.product-controls {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(170, 145, 119, 0.05);
}

@media (min-width: 768px) {
    .product-controls {
        padding: 14px 20px;
    }
}

.product-search-input {
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 14px;
    transition: all 0.3s ease;
    height: auto;
}

@media (min-width: 768px) {
    .product-search-input {
        padding: 6px 12px;
    }
}

.product-search-input:focus {
    border-color: var(--product-primary);
    box-shadow: 0 0 0 3px rgba(170, 145, 119, 0.1);
    outline: none;
}

.product-sort-select {
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    height: auto;
}

@media (min-width: 768px) {
    .product-sort-select {
        padding: 6px 12px;
    }
}

.product-sort-select:hover {
    border-color: var(--product-primary);
}

/* 按鈕 */
.btn-product-primary {
    background: var(--product-primary);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 14px;
}

@media (min-width: 768px) {
    .btn-product-primary {
        padding: 6px 16px;
    }
}

.btn-product-primary:hover {
    background: var(--product-primary-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(170, 145, 119, 0.2);
}

/* 區塊標題 */
.section-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
}

.section-title i {
    margin-right: 8px;
}

/* ===== 側邊欄優雅設計 ===== */

/* 側邊欄卡片 - 精緻風格 */
.sidebar-card {
    background: linear-gradient(135deg, #ffffff 0%, #fafaf9 100%);
    border: 1px solid rgba(170, 145, 119, 0.12);
    border-radius: 16px;
    padding: 0;
    box-shadow: 0 4px 16px rgba(170, 145, 119, 0.08);
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

.sidebar-card:hover {
    box-shadow: 0 6px 20px rgba(170, 145, 119, 0.12);
    border-color: rgba(170, 145, 119, 0.18);
}

/* 側邊欄標題區域 - 優雅頭部 */
.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    padding: 24px 24px 20px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(170, 145, 119, 0.05) 0%, rgba(170, 145, 119, 0.02) 100%);
    border-bottom: 1px solid rgba(170, 145, 119, 0.1);
    position: relative;
}

.sidebar-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--product-primary) 0%, var(--product-primary-dark) 100%);
    border-radius: 16px 0 0 0;
}

.sidebar-title::after {
    content: '';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, rgba(170, 145, 119, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.sidebar-title i {
    font-size: 16px;
    color: var(--product-primary);
}

/* 篩選區塊容器 */
.filter-section {
    padding: 20px 24px;
    margin: 0;
    border-bottom: 1px solid rgba(170, 145, 119, 0.08);
    transition: all 0.3s ease;
}

.filter-section:last-child {
    border-bottom: none;
}

.filter-section:hover {
    background: rgba(170, 145, 119, 0.02);
}

/* 篩選標題 - 精緻設計 */
.filter-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--product-primary-dark);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
}

.filter-title i {
    font-size: 13px;
    color: var(--product-primary);
    opacity: 0.8;
}

.filter-option {
    display: block;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.filter-option:hover {
    background: rgba(170, 145, 119, 0.05);
}

.filter-option input[type="radio"]:checked + span {
    color: var(--product-primary);
    font-weight: 600;
}

/* 響應式 */
@media (max-width: 767.98px) {
    .product-img-wrapper {
        height: 180px;
    }

    .product-card-body {
        padding: 16px;
    }

    .product-controls {
        padding: 16px;
    }
}

/* ===== 價格範圍滑桿 ===== */
.price-range-container {
    margin-bottom: 20px;
}

.price-range-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    background: linear-gradient(135deg, rgba(170, 145, 119, 0.05) 0%, rgba(170, 145, 119, 0.02) 100%);
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(170, 145, 119, 0.08);
}

.price-range-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.price-range-values {
    font-size: 13px;
    color: var(--product-primary);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.price-range-slider-wrapper {
    position: relative;
    height: 40px;
    display: flex;
    align-items: center;
}

.price-range-track {
    position: absolute;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, rgba(170, 145, 119, 0.1) 0%, rgba(170, 145, 119, 0.15) 50%, rgba(170, 145, 119, 0.1) 100%);
    border-radius: 4px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.price-range-progress {
    position: absolute;
    height: 5px;
    background: linear-gradient(90deg, var(--product-primary) 0%, var(--product-primary-dark) 100%);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(170, 145, 119, 0.3);
}

.price-range-slider {
    position: relative;
    width: 100%;
}

.price-range-input {
    position: absolute;
    width: 100%;
    height: 4px;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.price-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--product-primary) 0%, var(--product-primary-dark) 100%);
    cursor: pointer;
    pointer-events: auto;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(170, 145, 119, 0.3), 0 0 0 0 rgba(170, 145, 119, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.price-range-input::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(170, 145, 119, 0.4), 0 0 0 4px rgba(170, 145, 119, 0.1);
}

.price-range-input::-webkit-slider-thumb:active {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(170, 145, 119, 0.5), 0 0 0 6px rgba(170, 145, 119, 0.15);
}

.price-range-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--product-primary) 0%, var(--product-primary-dark) 100%);
    cursor: pointer;
    pointer-events: auto;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(170, 145, 119, 0.3), 0 0 0 0 rgba(170, 145, 119, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.price-range-input::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(170, 145, 119, 0.4), 0 0 0 4px rgba(170, 145, 119, 0.1);
}

.price-range-input::-moz-range-thumb:active {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(170, 145, 119, 0.5), 0 0 0 6px rgba(170, 145, 119, 0.15);
}

/* ===== 庫存進度條 ===== */
.product-stock-bar {
    margin-bottom: 8px;
}

.product-stock-bar .progress {
    background-color: rgba(170, 145, 119, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.product-stock-bar .progress-bar {
    transition: width 0.3s ease;
}

.product-stock-info {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.product-stock-info i {
    font-size: 10px;
}

.product-stock-info .text-danger {
    color: var(--color-danger) !important;
}

.product-stock-info .text-warning {
    color: var(--color-warning) !important;
}

.product-stock-info .text-success {
    color: var(--color-success) !important;
}

/* ===== 側邊欄分類篩選 - 優雅列表設計 ===== */

/* 分類列表容器 */
.category-filter-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* 分類項目淡入動畫 */
.category-item-wrapper {
    animation: fadeInUp 0.4s ease backwards;
}

.category-item-wrapper:nth-child(1) { animation-delay: 0.05s; }
.category-item-wrapper:nth-child(2) { animation-delay: 0.1s; }
.category-item-wrapper:nth-child(3) { animation-delay: 0.15s; }
.category-item-wrapper:nth-child(4) { animation-delay: 0.2s; }
.category-item-wrapper:nth-child(5) { animation-delay: 0.25s; }
.category-item-wrapper:nth-child(6) { animation-delay: 0.3s; }
.category-item-wrapper:nth-child(7) { animation-delay: 0.35s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 分類項目包裝器 */
.category-item-wrapper {
    display: flex;
    flex-direction: column;
}

/* 主分類項目 - 精緻設計 */
.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

/* 主分類懸停效果 - 優雅動畫 */
.category-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(90deg, var(--product-primary) 0%, transparent 100%);
    transition: width 0.3s ease;
    opacity: 0.1;
}

.category-item:hover::before {
    width: 100%;
}

.category-item:hover {
    background: linear-gradient(135deg, rgba(170, 145, 119, 0.08) 0%, rgba(170, 145, 119, 0.04) 100%);
    border-color: rgba(170, 145, 119, 0.15);
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(170, 145, 119, 0.08);
}

/* 主分類選中狀態 - 優雅高亮 */
.category-item.active {
    background: linear-gradient(135deg, rgba(170, 145, 119, 0.15) 0%, rgba(170, 145, 119, 0.08) 100%);
    border-color: rgba(170, 145, 119, 0.25);
    box-shadow: 0 2px 12px rgba(170, 145, 119, 0.12);
}

.category-item.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(180deg, var(--product-primary) 0%, var(--product-primary-dark) 100%);
    border-radius: 0 2px 2px 0;
}

.category-item.active .category-item-name {
    color: var(--product-primary);
    font-weight: 600;
}

/* 分類內容（左側） */
.category-item-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

/* 展開/收合箭頭 - 精緻設計 */
.category-expand-icon {
    font-size: 9px;
    color: var(--text-secondary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    opacity: 0.6;
}

.category-expand-icon.expanded {
    transform: rotate(90deg);
    color: var(--product-primary);
    opacity: 1;
}

.category-item:hover .category-expand-icon {
    opacity: 1;
}

/* 分類圖標 - 精緻圓形背景 */
.category-item-icon {
    font-size: 13px;
    color: var(--product-primary);
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(170, 145, 119, 0.12) 0%, rgba(170, 145, 119, 0.06) 100%);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.category-item:hover .category-item-icon {
    background: linear-gradient(135deg, rgba(170, 145, 119, 0.18) 0%, rgba(170, 145, 119, 0.10) 100%);
    transform: scale(1.05);
}

.category-item.active .category-item-icon {
    background: linear-gradient(135deg, var(--product-primary) 0%, var(--product-primary-dark) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(170, 145, 119, 0.3);
}

/* 分類名稱 */
.category-item-name {
    font-size: 14px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
}

/* 「全部商品」特殊樣式 */
.category-item-wrapper:first-child .category-item {
    background: linear-gradient(135deg, rgba(170, 145, 119, 0.04) 0%, rgba(170, 145, 119, 0.02) 100%);
    border: 1px solid rgba(170, 145, 119, 0.08);
}

.category-item-wrapper:first-child .category-item.active {
    background: linear-gradient(135deg, rgba(170, 145, 119, 0.18) 0%, rgba(170, 145, 119, 0.10) 100%);
    border-color: rgba(170, 145, 119, 0.3);
}

/* 商品數量 - 精緻徽章 */
.category-item-count {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.03) 100%);
    padding: 4px 10px;
    border-radius: 12px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.category-item:hover .category-item-count {
    background: linear-gradient(135deg, rgba(170, 145, 119, 0.12) 0%, rgba(170, 145, 119, 0.08) 100%);
    border-color: rgba(170, 145, 119, 0.15);
}

.category-item.active .category-item-count {
    background: linear-gradient(135deg, var(--product-primary) 0%, var(--product-primary-dark) 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 6px rgba(170, 145, 119, 0.25);
}

/* 子分類列表 - 流暢展開動畫 */
.subcategory-list {
    display: none;
    flex-direction: column;
    gap: 3px;
    padding-left: 32px;
    margin-top: 0;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease 0.1s,
                margin-top 0.3s ease;
}

.subcategory-list.expanded {
    display: flex;
    max-height: 600px;
    opacity: 1;
    margin-top: 6px;
}

/* 子分類項目淡入動畫 */
.subcategory-list.expanded .subcategory-item {
    animation: fadeInLeft 0.3s ease backwards;
}

.subcategory-list.expanded .subcategory-item:nth-child(1) { animation-delay: 0.05s; }
.subcategory-list.expanded .subcategory-item:nth-child(2) { animation-delay: 0.1s; }
.subcategory-list.expanded .subcategory-item:nth-child(3) { animation-delay: 0.15s; }
.subcategory-list.expanded .subcategory-item:nth-child(4) { animation-delay: 0.2s; }
.subcategory-list.expanded .subcategory-item:nth-child(5) { animation-delay: 0.25s; }
.subcategory-list.expanded .subcategory-item:nth-child(6) { animation-delay: 0.3s; }

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 子分類項目 - 精緻優雅設計 */
.subcategory-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    border: 1px solid transparent;
    position: relative;
}

.subcategory-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 50%;
    background: linear-gradient(90deg, var(--product-primary) 0%, transparent 100%);
    transition: width 0.25s ease;
    opacity: 0.15;
    border-radius: 4px 0 0 4px;
}

.subcategory-item:hover {
    background: linear-gradient(135deg, rgba(170, 145, 119, 0.06) 0%, rgba(170, 145, 119, 0.03) 100%);
    border-color: rgba(170, 145, 119, 0.1);
    transform: translateX(2px);
}

.subcategory-item:hover::before {
    width: 3px;
}

.subcategory-item.active {
    background: linear-gradient(135deg, rgba(170, 145, 119, 0.12) 0%, rgba(170, 145, 119, 0.06) 100%);
    border-color: rgba(170, 145, 119, 0.2);
    box-shadow: 0 2px 6px rgba(170, 145, 119, 0.08);
}

.subcategory-item.active::before {
    width: 3px;
    opacity: 1;
    background: linear-gradient(180deg, var(--product-primary) 0%, var(--product-primary-dark) 100%);
}

.subcategory-item.active .subcategory-item-name {
    color: var(--product-primary);
    font-weight: 600;
}

/* 子分類名稱 */
.subcategory-item-name {
    font-size: 13px;
    color: var(--text-main);
    flex: 1;
    transition: all 0.2s ease;
}

/* 子分類數量 - 精緻徽章 */
.subcategory-item-count {
    font-size: 11px;
    color: var(--text-secondary);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.03) 100%);
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 600;
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: all 0.25s ease;
}

.subcategory-item:hover .subcategory-item-count {
    background: linear-gradient(135deg, rgba(170, 145, 119, 0.1) 0%, rgba(170, 145, 119, 0.06) 100%);
    border-color: rgba(170, 145, 119, 0.12);
}

.subcategory-item.active .subcategory-item-count {
    background: linear-gradient(135deg, rgba(170, 145, 119, 0.25) 0%, rgba(170, 145, 119, 0.15) 100%);
    color: var(--product-primary);
    border-color: rgba(170, 145, 119, 0.2);
    box-shadow: 0 1px 3px rgba(170, 145, 119, 0.15);
}

/* 側邊欄價格範圍優化 */
.filter-section .price-range-container {
    margin-bottom: 0;
}

.filter-section .price-range-header {
    margin-bottom: 16px;
    justify-content: center;
}

.filter-section .price-range-label {
    display: none; /* 標題已在 filter-title 顯示 */
}

.filter-section .price-range-values {
    font-size: 15px;
    color: var(--product-primary);
    font-weight: 700;
    width: 100%;
    text-align: center;
}

/* 響應式設計 */
@media (max-width: 767.98px) {
    .sidebar-card {
        border-radius: 12px;
    }

    .sidebar-title {
        font-size: 16px;
        padding: 20px 20px 16px;
    }

    .filter-section {
        padding: 16px 20px;
    }

    .category-item {
        padding: 10px 12px;
    }

    .category-item-icon {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }

    .category-item-name {
        font-size: 13px;
    }

    .category-item-count {
        font-size: 10px;
        padding: 3px 8px;
    }

    .subcategory-list {
        padding-left: 28px;
    }

    .subcategory-item {
        padding: 7px 10px;
    }

    .subcategory-item-name {
        font-size: 12px;
    }

    .subcategory-item-count {
        font-size: 10px;
        padding: 2px 6px;
    }

    .price-range-header {
        padding: 8px 12px;
    }

    .price-range-values {
        font-size: 13px;
    }

    .category-filter-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .category-filter-card {
        padding: 10px;
        min-height: 80px;
    }

    .category-filter-icon {
        width: 32px;
        height: 32px;
    }

    .category-filter-icon i {
        font-size: 14px;
    }

    .category-filter-name {
        font-size: 12px;
    }

    .category-filter-count {
        font-size: 10px;
    }

    .subcategory-pill {
        font-size: 12px;
        padding: 5px 10px;
    }

    .subcategory-pill-count {
        font-size: 10px;
        min-width: 18px;
        height: 18px;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .category-filter-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 992px) {
    .category-filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== 限時特賣區塊 - 蝦皮風格 ===== */

.flash-sale-section {
    background: linear-gradient(135deg, #fff5e6 0%, #ffe9cc 100%);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(255, 152, 0, 0.2);
}

/* 限時特賣頭部 */
.flash-sale-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.flash-sale-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    color: #ee4d2d;
}

.flash-sale-title i {
    font-size: 20px;
    color: var(--color-warning);
}

/* 簡潔倒數計時器 */
.flash-sale-countdown {
    display: flex;
    align-items: center;
    gap: 8px;
}

.countdown-timer {
    background: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 700;
    color: #ee4d2d;
    font-family: 'Courier New', monospace;
    border: 1px solid rgba(238, 77, 45, 0.2);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* 橫向滾動商品列表 */
.flash-sale-products {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* 隱藏滾動條但保持功能 */
.flash-sale-products::-webkit-scrollbar {
    height: 6px;
}

.flash-sale-products::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.flash-sale-products::-webkit-scrollbar-thumb {
    background: rgba(238, 77, 45, 0.3);
    border-radius: 4px;
}

.flash-sale-products::-webkit-scrollbar-thumb:hover {
    background: rgba(238, 77, 45, 0.5);
}

/* 限時特賣商品項目 */
.flash-sale-item {
    flex: 0 0 160px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.flash-sale-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border-color: var(--product-primary);
}

/* 商品圖片 */
.flash-sale-item-img {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: #f5f5f5;
}

.flash-sale-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.flash-sale-item:hover .flash-sale-item-img img {
    transform: scale(1.05);
}

/* 折扣標籤 */
.flash-sale-discount {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ee4d2d;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(238, 77, 45, 0.3);
}

/* 商品資訊 */
.flash-sale-item-info {
    padding: 10px;
}

/* 價格區域 */
.flash-sale-item-price {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 8px;
}

.flash-sale-item-price .sale-price {
    font-size: 16px;
    font-weight: 700;
    color: #ee4d2d;
}

.flash-sale-item-price .original-price {
    font-size: 11px;
    color: #999;
    text-decoration: line-through;
}

/* 庫存進度條 */
.flash-sale-stock {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stock-bar {
    width: 100%;
    height: 12px;
    background: #f5f5f5;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.stock-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-warning) 0%, #ff9800 100%);
    border-radius: 6px;
    transition: width 0.3s ease;
}

.stock-text {
    font-size: 10px;
    color: #666;
    text-align: center;
}

/* 響應式設計 */
@media (max-width: 767.98px) {
    .flash-sale-section {
        padding: 12px;
        border-radius: 8px;
    }

    .flash-sale-header {
        margin-bottom: 12px;
    }

    .flash-sale-title {
        font-size: 16px;
    }

    .flash-sale-title i {
        font-size: 18px;
    }

    .countdown-timer {
        font-size: 14px;
        padding: 5px 10px;
    }

    .flash-sale-item {
        flex: 0 0 140px;
    }

    .flash-sale-item-img {
        height: 140px;
    }

    .flash-sale-item-info {
        padding: 8px;
    }

    .flash-sale-item-price .sale-price {
        font-size: 14px;
    }
}

/* === 缺貨商品遮罩 === */
.product-card.is-sold-out .product-img-wrapper img {
    filter: grayscale(60%);
}

.product-sold-out-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.42);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.product-sold-out-label {
    background: rgba(255, 255, 255, 0.92);
    color: #555;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 5px 18px;
    border-radius: 30px;
}
