/* 
 * category.css - Category 頁面完整樣式
 * 包含 CategorySection, NewArrivals, BestSelling 所有樣式
 * 使用 .category-page 命名空間避免樣式衝突
 */

/* === Category 頁面根容器 === */
.category-page {
    font-family: 'Mulish', -apple-system, BlinkMacSystemFont, sans-serif;
    width: 100%;
    overflow-x: hidden;
}

/* === 手機版容器修正 === */
@media (max-width: 576px) {
    .category-page .container {
        padding-left: 0px !important;
        padding-right: 0px !important;
    }

    .category-page .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .category-page .col-12 {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .category-page .category-section-container {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* ================================================
   CategorySection 樣式
   ================================================ */

/* === 分類區域容器 === */
.category-page .category-section-wrapper {
    opacity: 1;
}

/* === 展開/收合按鈕 === */
.category-page .category-toggle-btn {
    background: rgba(175, 150, 135, 0.1);
    color: #dc3545;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 15px auto 0 auto;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 5px 18px;
    border: none;
    font-size: 20px;
    font-family: 'Antonio', sans-serif;
    border-radius: 20px;
    text-align: center;
    width: fit-content;
    font-weight: 500;
}

    .category-page .category-toggle-btn:hover {
        background: rgba(175, 150, 135, 0.15);
        color: #af9687;
    }

.category-page .category-bounce-arrow {
    animation: category-bounce 2s infinite;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-page .category-toggle-btn.category-expanded .category-bounce-arrow {
    transform: rotate(180deg);
}

/* === 分類網格容器 === */

.category-page .category-grid {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

/* 響應式網格 */
@media (max-width: 767px) {
    .category-page .category-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .category-page .category-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 12px;
    }
}

@media (min-width: 1200px) {
    .category-page .category-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 14px;
    }
}

@media (min-width: 1600px) {
    .category-page .category-grid {
        grid-template-columns: repeat(10, 1fr);
        gap: 15px;
    }
}

/* === 分類項目樣式 === */
.category-page .category-grid-item {
    /* Grid item 不需要設置寬度，由 grid-template-columns 控制 */
}

.category-page .category-circle-wrapper {
    max-width: 180px;
    margin: 0 auto;
}

.category-page .category-item {
    text-align: center;
}

.category-page .category-image-container {
    width: 100%;
    padding-bottom: 4px;
    margin: 0 auto;
}

.category-page .category-image-circle {
    width: 100%;
    padding-bottom: 100%;
    position: relative;
    border-radius: 50%;
    overflow: hidden;
    border: transparent;
    background-color: transparent;
    margin: 0 auto;
}

    .category-page .category-image-circle::after {
        content: "";
        position: absolute;
        top: 3px;
        left: 3px;
        right: 3px;
        bottom: 3px;
        border-radius: 50%;
        border: 2px solid rgba(255, 255, 255, 0.8);
        z-index: 1;
        pointer-events: none;
    }

.category-page .category-circle-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    padding: 10px;
    box-sizing: border-box;
}

.category-page .category-name {
    font-size: 1rem !important;
    font-family: "Mulish", sans-serif;
    font-weight: 400;
    margin-top: 4px;
    margin-bottom: 0px;
}

/* === 分類卡片懸停效果 === */
.category-page .category-card:hover {
    transition: transform 0.3s ease;
}

/* === 空狀態訊息 === */
.category-page .category-empty-categories {
    font-family: "Mulish", sans-serif;
    text-align: center;
    padding: 50px 20px;
    color: #999;
    font-style: italic;
    background-color: #fafafa;
    border-radius: 8px;
    margin: 15px 0;
}

    .category-page .category-empty-categories h3 {
        font-family: "Mulish", sans-serif;
        font-size: 1.1rem;
        margin-bottom: 8px;
        color: #666;
    }

/* === 分類響應式調整 === */
@media (min-width: 1200px) {
    .category-page .category-circle-wrapper {
        max-width: 140px;
    }

    .category-page .category-name {
        font-size: 0.85rem !important;
        line-height: 1.2 !important;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .category-page .category-circle-wrapper {
        max-width: 140px;
    }

    .category-page .category-name {
        font-size: 0.9rem !important;
    }
}

@media (max-width: 767px) {
    .category-page .category-circle-wrapper {
        max-width: 120px;
        margin-bottom: 4px;
    }

    .category-page .category-name {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        font-size: 0.9rem !important;
        line-height: 1.1 !important;
    }

    .category-page .category-section-container {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .category-page .category-toggle-btn {
        font-size: 15px;
        padding: 8px 14px;
    }
}

/* ================================================
   產品組件共用樣式（New Arrivals & Best Selling）
   ================================================ */

/* === 骨架屏修復 - 防止手機版跳動 === */
.category-page .category-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1.4 !important; /* 固定比例防止跳動 */
    overflow: hidden;
}

.category-page .category-image-skeleton {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100% !important;
    background: #f0f0f0;
    z-index: 2;
    overflow: hidden;
}

.category-page .category-image-loading {
    opacity: 0;
    z-index: 1;
}

.category-page .category-image-loaded {
    opacity: 1;
    z-index: 3;
    transition: opacity 0.3s ease !important;
}

/* === Shimmer 動畫 === */
.category-page .category-skeleton-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient( 90deg, transparent 0%, rgba(255, 255, 255, 0.6) 50%, transparent 100% );
    background-size: 200% 100%;
    animation: category-shimmer 1.5s infinite;
}

@keyframes category-shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* ================================================
   顏色和尺寸同排顯示樣式
   ================================================ */

/* 🔥 顏色和尺寸容器 - 左右佈局 */
.category-page .category-product-colors-sizes {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    min-height: 18px;
    gap: 8px;
}

/* 顏色區域 - 左側 */
.category-page .category-product-colors {
    flex: 1;
    min-width: 0; /* 允許縮小 */
}

.category-page .category-color-thumbnails {
    display: flex;
    align-items: center;
    gap: 2px;
}

.category-page .category-no-colors {
    display: flex;
    align-items: center;
}

/* 尺寸範圍區域 - 右側 */
.category-page .category-product-size-range {
    flex-shrink: 0; /* 不縮小 */
    margin-left: auto;
}

.category-page .category-size-range-text {
    font-family: "Mulish", sans-serif;
    font-size: 0.75rem;
    color: #999999;
    font-weight: 500;
    white-space: nowrap;
    padding: 2px 6px;
    border-radius: 3px;
}

/* ================================================
   骨架屏樣式 - 顏色和尺寸
   ================================================ */

/* 🔥 骨架屏 - 顏色和尺寸同排 */
.category-page .category-skeleton-colors-sizes {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    min-height: 18px;
    gap: 8px;
}

.category-page .category-skeleton-colors-left {
    display: flex;
    gap: 4px;
    flex: 1;
}

.category-page .category-skeleton-size-range {
    width: 30px;
    height: 14px;
    background: #f0f0f0;
    border-radius: 3px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

/* === 內容骨架屏 === */
.category-page .category-content-skeleton {
    padding: 0 6px 6px 6px;
    min-height: 60px !important;
    max-height: 60px !important;
}

.category-page .category-skeleton-title {
    height: 36px;
    background: #f0f0f0;
    border-radius: 4px;
    margin-bottom: 6px;
    position: relative;
    overflow: hidden;
}

.category-page .category-skeleton-colors {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
    min-height: 18px;
}

.category-page .category-skeleton-color-dot {
    width: 18px;
    height: 18px;
    background: #f0f0f0;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.category-page .category-skeleton-price {
    height: 20px;
    width: 80px;
    background: #f0f0f0;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

/* === 產品網格佈局 === */
.category-page .category-products-grid {
    display: grid !important;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    margin-bottom: 20px;
    padding: 0;
    grid-auto-rows: minmax(350px, auto) !important; /* 防止手機版跳動 */
    align-items: start !important;
}

.category-page .category-grid-item {
    display: flex;
    flex-direction: column;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    contain: layout !important; /* 優化渲染性能 */
}

.category-page .category-product-card {
    height: 100%;
    display: flex !important;
    flex-direction: column !important;
    border-radius: 0;
    background-color: #fff;
    overflow: hidden !important;
    width: 100% !important;
}

.category-page .category-product-content {
    padding: 0 6px 6px 6px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.category-page .category-product-image {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
}

.category-page .category-product-title {
    font-family: "Mulish", sans-serif;
    font-size: 0.9rem;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 36px;
    line-height: 1.2;
}

.category-page .category-product-price {
    font-family: "Mulish", sans-serif;
    font-weight: 500;
    color: #333;
    margin-top: auto;
    font-size: 0.9rem;
}

.category-page .category-color-square {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 3px;
    cursor: pointer;
    overflow: hidden;
    border-radius: 2px;
}

.category-page .category-color-image {
    width: 18px;
    height: 18px;
    object-fit: cover;
    display: block;
    border-radius: 2px;
}

/* === NEW 標籤樣式（僅 New Arrivals）=== */
.category-page .category-new-badge {
    position: absolute !important;
    top: 12px !important;
    left: 12px !important;
    padding: 3px 6px;
    font-size: 10px;
    border-radius: 4px;
    background: #000;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10 !important;
    font-family: 'Mulish', sans-serif;
    transition: all 0.3s ease;
    user-select: none;
    pointer-events: none !important;
}

/* === 願望清單按鈕 === */
.category-page .category-wish-btn {
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

    .category-page .category-wish-btn:hover {
        transform: scale(1.1);
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    }

/* === Load More 按鈕 === */
.category-page .category-load-more-container {
    display: flex;
    justify-content: center;
    margin-top: 15px;
    margin-bottom: 15px;
}

.category-page .category-load-more-btn {
    background-color: white;
    border: 1px solid #af9687;
    color: #af9687;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: "Mulish", sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 160px;
    outline: none;
    border-style: solid;
}

    .category-page .category-load-more-btn:hover {
        background-color: #f5f5f5;
    }

/* === 產品計數 === */
.category-page .category-product-count {
    font-family: "Mulish", sans-serif;
    margin-top: 20px;
    text-align: center;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #333;
}

/* === 空狀態訊息 === */
.category-page .category-empty-message {
    font-family: "Mulish", sans-serif;
    text-align: center;
    padding: 50px 20px;
    color: #999;
    font-style: italic;
    background-color: #fafafa;
    border-radius: 8px;
    margin: 15px 0;
}

    .category-page .category-empty-message h3 {
        font-family: "Mulish", sans-serif;
        font-size: 1.1rem;
        margin-bottom: 8px;
        color: #666;
    }

/* ================================================
   響應式調整
   ================================================ */

/* 手機版響應式 */
@media (max-width: 576px) {
    /* 🔥 強制網格穩定性 */
    .category-page .category-products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        width: 100% !important;
        min-height: 600px !important;
        grid-auto-rows: minmax(350px, auto) !important;
    }

    /* 🔥 固定圖片容器 */
    .category-page .category-image-container {
        aspect-ratio: 1 / 1.4 !important;
        min-height: 250px !important;
        max-height: 250px !important;
    }

    .category-page .category-image-skeleton {
        min-height: 250px !important;
        max-height: 250px !important;
    }

    .category-page .category-product-image {
        min-height: 250px !important;
        max-height: 250px !important;
    }

    /* 🔥 固定內容區域 */
    .category-page .category-product-content {
        padding: 0 3px 4px 3px !important;
        min-height: 60px !important;
        max-height: 90px !important;
    }

    .category-page .category-content-skeleton {
        min-height: 60px !important;
        max-height: 90px !important;
    }

    /* 🔥 顏色和尺寸同排 - 手機版調整 */
    .category-page .category-product-colors-sizes {
        gap: 4px;
        margin-bottom: 4px;
        min-height: 14px;
    }

    .category-page .category-size-range-text {
        font-size: 0.65rem;
        padding: 1px 4px;
        border-radius: 2px;
    }

    .category-page .category-color-thumbnails {
        gap: 1px;
    }

    /* 骨架屏調整 */
    .category-page .category-skeleton-colors-sizes {
        gap: 4px;
        margin-bottom: 4px;
        min-height: 14px;
    }

    .category-page .category-skeleton-size-range {
        width: 25px;
        height: 12px;
    }

    .category-page .category-skeleton-colors-left {
        gap: 2px;
    }

    /* 字體和間距調整 */
    .category-page .category-skeleton-title {
        height: 30px;
        margin-bottom: 4px;
    }

    .category-page .category-skeleton-color-dot {
        width: 14px;
        height: 14px;
    }

    .category-page .category-skeleton-price {
        height: 16px;
        width: 60px;
    }

    .category-page .category-color-square {
        width: 14px;
        height: 14px;
        margin-right: 2px;
    }

    .category-page .category-color-image {
        width: 14px;
        height: 14px;
    }

    .category-page .category-color-more {
        width: 14px;
        height: 14px;
        margin-right: 2px;
    }

    .category-page .category-color-plus {
        font-size: 7px;
    }

    .category-page .category-product-title {
        font-size: 11px;
        height: 30px;
        margin-bottom: 4px;
    }

    .category-page .category-product-price {
        font-size: 12px;
    }

    .category-page .category-load-more-btn {
        min-width: 140px;
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .category-page .category-empty-message {
        padding: 30px 10px;
    }

    .category-page .category-product-count {
        margin-top: 15px;
        font-size: 13px;
    }

    .category-page .category-new-badge {
        top: 10px !important;
        left: 8px !important;
        padding: 3px 6px;
        font-size: 10px;
        border-radius: 3px;
    }
}

/* === 平板版調整 === */
@media (min-width: 577px) and (max-width: 768px) {
    .category-page .category-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .category-page .category-product-title {
        font-size: 0.85rem;
    }

    .category-page .category-product-colors-sizes {
        gap: 6px;
    }

    .category-page .category-size-range-text {
        font-size: 0.7rem;
        padding: 2px 5px;
    }

    .category-page .category-color-square {
        width: 16px;
        height: 16px;
        margin-right: 2px;
    }

    .category-page .category-color-image {
        width: 16px;
        height: 16px;
    }

    .category-page .category-color-more {
        width: 16px;
        height: 16px;
        margin-right: 2px;
    }

    .category-page .category-color-plus {
        font-size: 8px;
    }

    .category-page .category-new-badge {
        top: 10px !important;
        left: 10px !important;
        padding: 3px 6px;
        font-size: 10px;
        border-radius: 3px;
    }
}

@media (min-width: 769px) and (max-width: 992px) {
    .category-page .category-products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .category-page .category-product-colors-sizes {
        gap: 8px;
    }

    .category-page .category-size-range-text {
        font-size: 0.75rem;
        padding: 2px 6px;
    }
}

@media (min-width: 993px) and (max-width: 1200px) {
    .category-page .category-products-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 14px;
    }
}

@media (min-width: 1201px) {
    .category-page .category-products-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 18px;
        max-width: 1400px;
        margin: 0 auto 20px auto;
    }

    .category-page .category-product-colors-sizes {
        gap: 8px;
    }

    .category-page .category-size-range-text {
        font-size: 0.75rem;
        padding: 2px 6px;
    }
}

/* ================================================
   No Image Placeholder
   ================================================ */
.no-image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px dashed #ced4da;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    color: #6c757d;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.no-image-placeholder-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 8px;
    opacity: 0.6;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width: 768px) {
    .no-image-placeholder-icon {
        width: 32px;
        height: 32px;
        margin-bottom: 6px;
    }

    .no-image-placeholder {
        font-size: 0.65rem;
    }
}

/* ================================================
   折扣價格相關樣式
   ================================================ */

/* 价格容器 */
.price-container {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
}

/* 原價樣式 - 灰色、小字、刪除線 */
.original-price {
    color: #999999;
    font-size: 0.70em;
    text-decoration: line-through;
    font-weight: normal;
    line-height: 1.2;
    margin-top: 2px;
}

/* 折扣價樣式 - 紅色、正常大小 */
.discount-price {
    color: #dc3545;
    font-weight: bold;
    font-size: 1em;
    line-height: 1.2;
    margin-top: 1px;
}

/* 一般價格樣式（無折扣時） */
.regular-price {
    color: #333333;
    font-weight: bold;
    font-size: 1em;
    line-height: 1.2;
}

/* 🔥 折扣標籤樣式 */


/* 響應式調整 */
@media (max-width: 768px) {
    .price-container {
        gap: 2px;
    }

    .original-price {
        font-size: 0.8em;
    }

    .discount-price,
    .regular-price {
        font-size: 0.9em;
    }

    .category-discount-badge {
        font-size: 10px;
        padding: 3px 6px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .original-price {
        font-size: 0.82em;
    }

    .discount-price,
    .regular-price {
        font-size: 0.95em;
    }
}

@media (min-width: 1025px) {
    .original-price {
        font-size: 0.85em;
    }

    .discount-price,
    .regular-price {
        font-size: 1em;
    }
}

/* 顏色 + 號樣式 */
.category-page .category-color-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    width: 18px;
    height: 18px;
    margin-right: 3px;
    vertical-align: top;
    background-color:#ffffff!important;
    border:none!important

}

.category-page .category-color-plus {
    font-size: 9px;
    font-weight: 600;
    color: #666;
    text-align: center;
    line-height: 1;
}

/* 響應式調整 */
@media (max-width: 576px) {
    .category-page .category-color-more {
        width: 13px;
        height: 13px;
        margin-right: 2px;
    }

    .category-page .category-color-plus {
        font-size: 8px;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .category-page .category-color-more {
        width: 16px;
        height: 16px;
        margin-right: 3px;
    }

    .category-page .category-color-plus {
        font-size: 9px;
    }
}

/* ================================================
   載入動畫禁用（防止骨架屏期間跳動）
   ================================================ */
.category-page .skeleton-wrapper *,
.category-page .skeleton-wrapper *::before,
.category-page .skeleton-wrapper *::after {
    transition: none !important;
    transform: none !important;
    animation-duration: 0.01ms !important;
}

/* 只保留 shimmer 動畫 */
.category-page .skeleton-wrapper .category-skeleton-shimmer {
    animation: category-shimmer 1.5s infinite !important;
}

/* ================================================
   內容淡入動畫
   ================================================ */
.category-page .category-content-fade-in {
    animation: category-content-fade-in 0.4s ease-out forwards !important;
}

@keyframes category-content-fade-in {
    from {
        opacity: 0;
        transform: none !important;
    }

    to {
        opacity: 1;
        transform: none !important;
    }
}

.category-page .category-skeleton-fade-out {
    pointer-events: none !important;
    position: relative !important;
    z-index: 1 !important;
}

.category-page .category-content-fade-in {
    position: relative !important;
    z-index: 2 !important;
}

/* 優惠文字 */
.category-offer-text {
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 4px;
    line-height: 1.2;
}

    .category-offer-text.limited-offer,
    .category-offer-text.value-buy {
        color: #dc3545;
    }