:root {
    --primary: #4A235A;
    --primary-light: #F4ECF7;
    --accent: #D4AF37;
    --text-dark: #2E1534;
    --text-light: #7D6B91;
    --white: #ffffff;
    --shadow: 0 10px 30px rgba(74, 35, 90, 0.1);
    --glass: rgba(255, 255, 255, 0.85);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background-color: #fcfaff;
    color: var(--text-dark);
    line-height: 1.6;
    transition: all 0.3s ease;
}

/* View Toggle Controls */
.view-toggle {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--white);
    display: flex;
    justify-content: center;
    padding: 10px;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.view-toggle button {
    padding: 8px 16px;
    border: 1px solid var(--primary-light);
    background: var(--white);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-light);
    transition: all 0.2s;
}

.view-toggle button.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header & Banner */
header {
    width: 100%;
}

.banner {
    position: relative;
    background: linear-gradient(135deg, #2E1534 0%, #4A235A 50%, #6E3E84 100%);
    color: var(--white);
    padding: 80px 20px; /* 大幅增加高度感 */
    text-align: center;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 增加一個環境光暈 */
.banner::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.15), transparent);
    border-radius: 50%;
    filter: blur(60px);
}

.banner-logo-wrapper {
    background: rgba(255, 255, 255, 0.98);
    padding: 20px 40px;
    border-radius: 25px;
    display: inline-block;
    margin-bottom: 40px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    animation: slideDown 1s ease-out;
    border: 1px solid rgba(212, 175, 55, 0.3); /* 淡淡金邊 */
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

.banner-logo {
    width: 280px; /* 手機版 Logo 翻倍 */
    height: auto;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.desktop-view .banner-logo {
    width: 320px; /* 從 420px 縮小至更精緻的大小 */
}

.banner h1 {
    font-weight: 800;
    line-height: 1.2; /* 稍微增加行高讓字體呼吸 */
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
    text-shadow: 0 4px 15px rgba(0,0,0,0.4);
    background: linear-gradient(to bottom, #ffffff, #f0e1ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.mobile-view .banner h1 {
    font-size: 2.2rem; /* 手機版也稍微微調 */
    display: flex;
    flex-direction: column;
}

.desktop-view .banner h1 {
    font-size: 3.6rem; /* 縮小至合適比例，避免斷字 */
}

.subtitle {
    font-size: 1.5rem;
    color: var(--accent);
    margin-bottom: 3rem;
    font-weight: 600;
    letter-spacing: 5px;
    text-transform: uppercase;
}

.countdown-wrapper {
    margin-top: 10px;
    display: inline-block;
}

.countdown {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 20px 50px;
    border-radius: 60px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 1.5rem;
    font-weight: 700;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--white);
}

#timer {
    color: var(--accent);
    font-family: 'Outfit', sans-serif;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

/* PV Rewards */
.pv-rewards {
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 3rem;
    border: 1px solid var(--primary-light);
}

.reward-title {
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 1rem;
    text-align: center;
}

.reward-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 手機版預設 2 欄 */
    gap: 1rem;
}

.desktop-view .reward-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.reward-item {
    text-align: center;
    font-size: 0.85rem;
    padding: 0.5rem;
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.reward-item span {
    color: var(--accent);
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}
.intro {
    text-align: center;
    margin: 4rem 0 2rem;
}

.section-title {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background: var(--accent);
    margin: 10px auto 0;
}

/* Promo Sets Horizontal Scroll */
.promo-sets-wrapper {
    position: relative;
    margin-bottom: 3rem;
}

/* 右側漸層遮罩 */
.promo-sets-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 50px;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,0.9));
    pointer-events: none;
    z-index: 2;
}

.products-grid {
    display: flex; /* 手機版改為橫向排列 */
    gap: 1.2rem;
    overflow-x: auto;
    padding: 1rem 0;
    padding-right: 50px;
    -webkit-overflow-scrolling: touch;
}

/* 優惠套組專屬滾動條 */
.products-grid::-webkit-scrollbar {
    height: 3px;
}
.products-grid::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
.products-grid::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 10px; }

/* 每一張套組卡片：放大寬度，確保內容清晰且大氣 */
.products-grid .product-card {
    min-width: 320px; /* 增加寬度，讓畫面顯示約三個產品 */
    max-width: 320px;
    flex-shrink: 0;
    padding: 1.5rem; 
    border-radius: 20px;
}

/* 確保海報圖片完整顯示，不裁切 */
.promo-image {
    width: 100%;
    height: auto;
    object-fit: contain; /* 確保圖片比例完整 */
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.desktop-view .products-grid {
    display: flex; /* 統一為橫向滑動 */
    overflow-x: auto;
    padding-bottom: 2rem;
}

.desktop-view .promo-sets-wrapper::after {
    display: block; /* 電腦版也顯示漸層提示 */
}

.desktop-view .products-grid .product-card {
    min-width: 320px;
    max-width: 320px;
}

/* Price Styling */
.price-container {
    margin: 1rem 0;
    padding: 0.8rem;
    background: #f9f9f9;
    border-radius: 10px;
}

.price-original {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: #e74c3c;
    text-decoration: line-through;
    opacity: 0.7;
    margin-bottom: 0.3rem;
}

.price-promo {
    display: flex;
    gap: 1rem;
    align-items: baseline;
}

.new-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary); /* 預設深紫色 */
}

.new-price.is-promo {
    color: #27ae60; /* 促銷綠色 */
}

.new-pv {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-light);
}

.new-pv.is-promo {
    color: #2ecc71;
}

.price-container.mini {
    background: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.price-container.mini .old-price, 
.price-container.mini .old-pv {
    font-size: 0.75rem;
    color: #e74c3c;
    text-decoration: line-through;
}

.price-container.mini .new-price {
    font-size: 1.1rem;
    color: var(--primary);
}

.price-container.mini .new-price.is-promo {
    color: #27ae60;
}

.price-container.mini .new-pv {
    font-size: 0.9rem;
    color: var(--text-light);
}

.price-container.mini .new-pv.is-promo {
    color: #2ecc71;
}

/* Category Tabs with Scroll Hint */
.category-filter-wrapper {
    position: relative;
    margin-bottom: 1.5rem;
}

/* 右側漸層遮罩，提示可往後滑動 */
.category-filter-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,0.9));
    pointer-events: none;
    z-index: 2;
}

.category-filter {
    display: flex;
    gap: 0.6rem; /* 稍微縮小間距，增加切邊機率 */
    overflow-x: auto;
    padding: 0.8rem 0;
    padding-right: 40px; /* 給予漸層空間 */
    -webkit-overflow-scrolling: touch; /* 讓 iOS 滑動更順暢 */
}

/* 設計一個極細且優雅的滾動條 */
.category-filter::-webkit-scrollbar {
    height: 3px;
}

.category-filter::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.category-filter::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 10px;
}

.category-tab {
    padding: 0.5rem 1rem;
    background: var(--white);
    border: 1px solid var(--primary-light);
    border-radius: 50px;
    color: var(--primary);
    white-space: nowrap;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    flex-shrink: 0; /* 防止標籤被壓縮 */
}

.category-tab.has-items {
    background: #ffdce5; /* 加深背景 */
    border-color: #ff8fa3; /* 加深邊框 */
    color: #c51b4d; /* 加深文字 */
    font-weight: 800;
    box-shadow: 0 4px 15px rgba(197, 27, 77, 0.15);
}

.category-tab.active.has-items {
    background: #c51b4d;
    color: white;
    border-color: #c51b4d;
}

.product-card.has-items {
    background: #fff0f3; /* 加深背景 */
    border-color: #ff8fa3;
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(197, 27, 77, 0.12);
}

.product-card.has-items h3 {
    color: #c51b4d;
}

/* 新增：單品列被選中時的深色效果 */
.single-item-row.has-items {
    background: #fff0f3 !important;
    border-left: 5px solid #ff8fa3;
    font-weight: 600;
}

.promo-image {
    width: 100%;
    height: auto;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.product-card:hover .promo-image {
    transform: scale(1.03);
}

.category-tab:hover:not(.active) {
    background: var(--primary-light);
}

.category-block {
    margin-bottom: 2rem;
}

.category-title {
    background: var(--primary);
    color: var(--white);
    padding: 0.8rem 1.5rem;
    border-radius: 10px 10px 0 0;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.category-items {
    border: 1px solid var(--primary-light);
    border-top: none;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
}

.single-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--primary-light);
    transition: background 0.2s;
}

.single-item-row:last-child { border-bottom: none; }
.single-item-row:hover { background: #fdfbff; }

.item-name { font-weight: 500; color: var(--text-dark); }
.item-meta { font-size: 0.85rem; color: var(--text-light); }

.quantity-control.mini {
    padding: 0.2rem;
    gap: 0.5rem;
}
.quantity-control.mini .qty-btn { width: 30px; height: 30px; }

.achieved-rewards-list {
    background: #e9f7ef;
    padding: 1rem;
    border-radius: 12px;
    margin-top: 1rem;
    border-left: 5px solid #27ae60;
}

.achieved-rewards-list h4 { color: #1e8449; margin-bottom: 0.5rem; }
.achieved-rewards-list ul { list-style: none; padding-left: 0.5rem; }
.achieved-rewards-list li { font-size: 0.9rem; color: #1e8449; margin-bottom: 0.2rem; }

.product-card {
    background: var(--white);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--primary-light);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(74, 35, 90, 0.15);
}

.product-sku {
    font-size: 0.8rem;
    color: var(--text-light);
    font-family: 'Outfit', sans-serif;
}

.product-card h3 {
    color: var(--primary);
    margin: 0.5rem 0 1rem;
    font-size: 1.4rem;
}

.product-items {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.product-items ul {
    list-style: none;
}

.product-items li::before {
    content: "•";
    color: var(--accent);
    margin-right: 0.5rem;
}

.product-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
}

.quantity-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary-light);
    padding: 0.5rem;
    border-radius: 12px;
}

.qty-btn {
    width: 35px;
    height: 35px;
    border-radius: 8px;
    border: none;
    background: var(--white);
    color: var(--primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.qty-btn:hover {
    background: var(--primary);
    color: var(--white);
}

.qty-val {
    font-weight: 700;
    font-size: 1.1rem;
}

/* Form Section */
.order-form-section {
    background: var(--white);
    padding: 3rem;
    border-radius: 30px;
    box-shadow: var(--shadow);
}

.order-form-section h2 {
    color: var(--primary);
    margin-bottom: 2rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--primary);
}

input[type="text"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--primary-light);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s;
    background-color: var(--white);
}

.info-msg {
    background: #e8f4fd;
    color: #2980b9;
    padding: 1rem;
    border-radius: 12px;
    border-left: 5px solid #3498db;
    margin: 1rem 0;
    font-size: 0.95rem;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* 驗證未通過的欄位樣式 */
input.invalid, select.invalid, textarea.invalid {
    border: 2px solid #e74c3c !important;
    background-color: #fff5f5 !important;
    animation: shake 0.4s; /* 增加一個輕微抖動效果，更醒目 */
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.radio-group {
    display: flex;
    gap: 2rem;
    margin-top: 0.5rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.payment-info {
    background: var(--primary-light);
    padding: 2rem;
    border-radius: 20px;
    margin: 2rem 0;
}

.payment-info h3 {
    margin-bottom: 1rem;
    color: var(--primary);
}

/* Summary */
.summary {
    border-top: 2px dashed var(--primary-light);
    padding-top: 2rem;
    margin-bottom: 2rem;
}

/* 單品清單：固定高度與垂直滾動 */
.category-items {
    max-height: 520px; /* 大約 10 筆商品的高度 */
    overflow-y: auto;
    padding-right: 8px;
    border: 1px solid #eee;
    border-radius: 12px;
    background: #fafafa;
    margin-top: 1rem;
}

/* 垂直滾動條樣式 */
.category-items::-webkit-scrollbar {
    width: 6px;
}
.category-items::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
.category-items::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 10px;
}

/* 底部互動購物車清單 */
.cart-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    background: white;
    margin-bottom: 0.6rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid #f0f0f0;
}

.cart-item-info {
    flex: 1;
    margin-right: 1rem;
}

.cart-item-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    display: block;
    margin-bottom: 2px;
}

.cart-item-price-pv {
    font-size: 0.75rem;
    color: var(--text-light);
}

.cart-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.cart-qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: #fff;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
}

.cart-qty-btn:hover {
    background: var(--primary-light);
}

.cart-qty-val {
    min-width: 20px;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.delete-btn {
    background: #fff0f0;
    color: #e74c3c;
    border: 1px solid #ffdada;
    padding: 5px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: 0.5rem;
    transition: all 0.2s;
}

.delete-btn:hover {
    background: #e74c3c;
    color: white;
}

.next-reward-msg {
    background: #fff9e6;
    color: #856404;
    padding: 0.8rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    border-left: 4px solid #f1c40f;
}

.total-price {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    text-align: right;
    margin-top: 1.5rem;
}

.total-pv-display {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--secondary);
    text-align: right;
    margin-top: 0.2rem;
}

.group-buy-warning {
    margin-top: 1.5rem;
    padding: 1.2rem;
    background-color: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: 12px;
    color: #c53030;
    font-size: 0.9rem;
    line-height: 1.6;
    box-shadow: 0 4px 10px rgba(197, 48, 48, 0.05);
}

.group-buy-warning b {
    color: #9b2c2c;
    font-size: 1rem;
}

.btn-primary {
    width: 100%;
    padding: 1.2rem;
    border: none;
    border-radius: 15px;
    background: linear-gradient(135deg, var(--primary), #6e3e84);
    color: var(--white);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(74, 35, 90, 0.3);
}

footer {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .banner-overlay h1 {
        font-size: 2.2rem;
    }
    .order-form-section {
        padding: 1.5rem;
    }
}

/* --- Admin & Modal Styles --- */
.admin-entry {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-light);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.admin-entry:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #fff;
    margin: 10% auto;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    border-radius: 20px;
    position: relative;
    color: #333;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
}

.report-box {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    font-family: monospace;
    white-space: pre-wrap;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
    font-size: 0.95rem;
    color: #2d3436;
}

.btn-secondary {
    width: 100%;
    padding: 1rem;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

/* Image Lightbox Modal */
.image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}

.image-modal-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(255,255,255,0.1);
    animation: zoomIn 0.3s ease-out;
    cursor: default;
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.close-image-modal {
    position: absolute;
    top: 30px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
}

.close-image-modal:hover {
    color: var(--accent);
}

/* 讓圖片滑鼠游標顯示為可放大狀態 */
.promo-image {
    cursor: zoom-in;
}
