body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.search-bar {
    flex: 1;
    display: flex;
    align-items: center;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px;
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
}

.search-icon {
    font-size: 20px;
    color: #666;
    margin-left: 10px;
}

.cart-icon-container {
    padding-left: 8px;
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.cart-icon-container .cart-icon {
    font-size: 24px;
    color: #666;
}

.whatsapp-logo {
    background-image: url('/static/icon/whatsapp-logo.svg');
    width: 24px;
    height: 24px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #ff0000;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    border-radius: 50%;
    padding: 2px 6px;
    min-width: 14px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.categories {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 20px;
}

.category {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 20px;
    margin-right: 10px;
    cursor: pointer;
    font-size: 14px;
}

.category.active {
    background-color: #6f42c1;
    color: #fff;
    border-color: #6f42c1;
}

.product-list {
    display: flex;
    flex-direction: column;
}

.product-item {
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    padding: 0;
}

.product-card {
    display: flex;
    align-items: stretch;
    border-radius: 10px 10px 0 0;
    padding: 10px;
}


.product-card img {
    width: 140px;
    height: 140px;
    min-width: 140px;
    border-radius: 10px;
    margin-right: 10px;
    align-self: center;
}


@media (max-width: 424px) {
    .product-card img {
        width: 120px;
        height: 120px;
        min-width: 120px;
        border-radius: 10px;
        margin-right: 10px;
        align-self: center;
    }
}

@media (max-width: 374px) {
    .product-card img {
        width: 90px;
        height: 90px;
        min-width: 90px;
        border-radius: 10px;
        margin-right: 10px;
        align-self: center;
    }
}

.product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.product-info h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.price {
    display: flex;
    align-items: center;
    margin-top: 5px;
}

.current-price {
    font-size: 18px;
    color: #ff0000;
    font-weight: bold;
    margin-right: 10px;
}

.currency {
    font-size: 14px;
    font-weight: normal;
}

.unit {
    font-size: 18px;
    font-weight: bold;
    color: #ff0000;
}

.options {
    display: flex;
    justify-content: flex-start;
    margin-top: 5px;
    margin-bottom: 5px;
    gap: 10px;
}

.option-button {
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 12px;
    color: #333;
    transition: background-color 0.3s;
}

.option-button:hover {
    background-color: #e9ecef;
}

.option-button.active {
    background-color: #6f42c1;
    color: #fff;
}

.expiration {
    font-size: 12px;
    color: #666;
}

.product-tag {
    display: flex;
    align-items: center;
    font-size: 12px;
    margin-top: 5px;
}

.product-tag-text {
    font-weight: bold;
    padding: 2px 12px;
    border-radius: 12px;
    border: 1.5px solid #ccc;
    margin-left: 0;
    margin-right: 5px;
}

.product-tag-green {
    color: #28a745;
    border-color: #28a745;
    background: #f6fffa;
}

.product-tag-grey {
    color: #666;
    border-color: #ccc;
    background: #fafafa;
}

.product-tag-red {
    color: #dc3545;
    border-color: #dc3545;
    background: #f8d7da;
}

.product-tag-pink {
    color: #e83e8c;
    border-color: #e83e8c;
    background: #ffe4f0;
}

.product-tag-purple {
    color: #6f42c1;
    border-color: #6f42c1;
    background: #f3e8ff;
}


.buy-buttons-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 10px;
    border-top: none;
    border-radius: 0 0 10px 10px;
    padding: 0 10px 10px 10px;
}

.add-to-cart-button,
.direct-buy-button {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    border: none;
    border-radius: 16px;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s, box-shadow 0.3s, transform 0.3s;
    flex: 1;
    min-height: 44px;
    color: #fff;
}

.add-to-cart-button {
    background-color: #a47ed4;
}

.add-to-cart-button:hover {
    background-color: #8c67bc;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transform: scale(1.02);
}

.direct-buy-button {
    background-color: #6f42c1;
}

.direct-buy-button:hover {
    background-color: #5a339a;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transform: scale(1.02);
}

.whatsapp-logo {
    margin-right: 8px;
}

.cart-icon {
    margin-right: 8px;
    font-size: 16px;
}

.whatsapp-logo {
    width: 16px;
    height: 16px;
}

.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f5f5f5;
    padding-top: 10px;
    padding-bottom: 10px;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: transform 0.15s cubic-bezier(.45,.05,.55,.95);
    will-change: transform;
}

.header-bar.hide {
    transform: translateY(-120%);
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-message {
    font-size: 16px;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.modal-button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.modal-confirm {
    background: #6f42c1;
    color: #fff;
}

.modal-confirm:hover {
    background: #5a32a3;
}

.modal-cancel {
    background: #eee;
    color: #666;
}

.modal-cancel:hover {
    background: #ddd;
}

.custom-option .custom-quantity {
    border: 1px solid #bbb;
    border-radius: 4px;
    height: 24px;
}

.custom-quantity {
    font-size: 16px;
    width: 35px;
    padding: 1px;
}

/*.product-item .product-card,*/
/*.product-item .buy-buttons-container {*/
/*    border: none !important;*/
/*    box-shadow: none !important;*/
/*}*/



/* CSS 自定義屬性支持 */
@property --angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* 特色商品的彩虹旋轉邊框 */
.product-item.feature-item {
    position: relative;
    border: 3px solid transparent;
    background:
            linear-gradient(#fff, #fff) padding-box,
            conic-gradient(
                    from var(--angle),
                    #ff0000 0deg,
                    #ff7f00 45deg,
                    #ffff00 90deg,
                    #00ff00 135deg,
                    #0000ff 180deg,
                    #4b0082 225deg,
                    #9400d3 270deg,
                    #ff0000 315deg,
                    #ff0000 360deg
            ) border-box;
    animation: rainbow-border-spin 3s linear infinite;
}

/* 降級方案：對於不支持 @property 的瀏覽器 */
@supports not (background: conic-gradient(from var(--angle), red, blue)) {
    .product-item.feature-item {
        border: 3px solid;
        border-image: conic-gradient(
                #ff0000, #ff7f00, #ffff00, #00ff00,
                #0000ff, #4b0082, #9400d3, #ff0000
        ) 1;
        animation: rainbow-border-rotate 3s linear infinite;
    }
}

@keyframes rainbow-border-spin {
    to {
        --angle: 360deg;
    }
}

@keyframes rainbow-border-rotate {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}

/* 確保特色商品內容正常顯示 */
.product-item.feature-item .product-card,
.product-item.feature-item .buy-buttons-container {
    background: #fff;
    position: relative;
    z-index: 1;
}

/* 修改產品卡片樣式，添加相對定位 */
.product-card {
    display: flex;
    align-items: stretch;
    border-radius: 10px 10px 0 0;
    padding: 10px;
    position: relative; /* 新增：為了定位折扣標籤 */
}

/* 產品圖片容器 */
.product-image-container {
    /*position: relative;*/
    /*display: inline-block;*/
    overflow: hidden; /* 防止動畫溢出 */
}

/* 折扣標籤樣式 - 增強動畫效果 */
.discount-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #ff4757, #ff3838);
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4);
    z-index: 10;
    min-width: 30px;
    text-align: center;
    transform: rotate(-5deg) scale(1);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    animation: discount-pulse 2s infinite;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

/* 折扣標籤懸停效果 */
.discount-badge:hover {
    transform: rotate(0deg) scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.6);
    background: linear-gradient(135deg, #ff3838, #ff2222);
}

/* 脈衝動畫 - 更動態 */
@keyframes discount-pulse {
    0% {
        transform: rotate(-5deg) scale(1);
        box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4);
    }
    50% {
        transform: rotate(-3deg) scale(1.05);
        box-shadow: 0 6px 16px rgba(255, 71, 87, 0.6);
    }
    100% {
        transform: rotate(-5deg) scale(1);
        box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4);
    }
}

/* 折扣標籤更新動畫 */
@keyframes discount-update {
    0% {
        transform: rotate(-5deg) scale(1);
        opacity: 1;
    }
    25% {
        transform: rotate(-15deg) scale(0.8);
        opacity: 0.7;
    }
    50% {
        transform: rotate(10deg) scale(1.2);
        opacity: 0.9;
        background: linear-gradient(135deg, #00d2ff, #3a7bd5);
    }
    75% {
        transform: rotate(-8deg) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: rotate(-5deg) scale(1);
        opacity: 1;
    }
}

/* 折扣標籤出現動畫 */
@keyframes discount-appear {
    0% {
        transform: rotate(-5deg) scale(0) translateY(-20px);
        opacity: 0;
    }
    50% {
        transform: rotate(-8deg) scale(1.2) translateY(-5px);
        opacity: 0.8;
    }
    100% {
        transform: rotate(-5deg) scale(1) translateY(0);
        opacity: 1;
    }
}

/* 折扣標籤消失動畫 */
@keyframes discount-disappear {
    0% {
        transform: rotate(-5deg) scale(1) translateY(0);
        opacity: 1;
    }
    50% {
        transform: rotate(-15deg) scale(0.8) translateY(-10px);
        opacity: 0.5;
    }
    100% {
        transform: rotate(-5deg) scale(0) translateY(-30px);
        opacity: 0;
    }
}

/* 折扣標籤閃爍效果類別 */
.discount-badge.updating {
    animation: discount-update 0.5s ease-in-out;
}

.discount-badge.appearing {
    animation: discount-appear 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.discount-badge.disappearing {
    animation: discount-disappear 0.4s ease-in-out forwards;
}

/* 高折扣特殊效果 */
.discount-badge.high-discount {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    animation: high-discount-glow 1.5s infinite;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.6);
}

@keyframes high-discount-glow {
    0% {
        box-shadow: 0 0 20px rgba(255, 107, 107, 0.6);
        transform: rotate(-5deg) scale(1);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 107, 107, 0.8);
        transform: rotate(-3deg) scale(1.05);
    }
    100% {
        box-shadow: 0 0 20px rgba(255, 107, 107, 0.6);
        transform: rotate(-5deg) scale(1);
    }
}

/* 中等折扣效果 */
.discount-badge.medium-discount {
    background: linear-gradient(135deg, #ffa726, #ff9800);
    animation: medium-discount-bounce 2s infinite;
}

@keyframes medium-discount-bounce {
    0%, 100% {
        transform: rotate(-5deg) scale(1);
    }
    50% {
        transform: rotate(-2deg) scale(1.03);
    }
}

/* 響應式調整 */
@media (max-width: 424px) {
    .discount-badge {
        font-size: 11px;
        padding: 3px 6px;
        top: 6px;
        left: 6px;
        min-width: 25px;
    }
}

@media (max-width: 374px) {
    .discount-badge {
        font-size: 10px;
        padding: 2px 5px;
        top: 4px;
        left: 4px;
        min-width: 20px;
    }
}