/* assets/style.css */
:root { --bg-color: #F5F5F7; --text-main: #1D1D1F; --text-secondary: #86868B; --apple-blue: #0071E3; --card-bg: #FFFFFF; --apple-red: #FF3B30;}
body { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background-color: var(--bg-color); color: var(--text-main); margin: 0; padding: 0 0 120px 0; -webkit-tap-highlight-color: transparent; }
.container { max-width: 800px; margin: 0 auto; padding: 0 20px; }

.store-header { position: relative; padding: 50px 20px 20px 20px; max-width: 800px; margin: 0 auto; }
.store-name { font-size: 34px; font-weight: 800; letter-spacing: -0.5px; margin: 0; color: var(--text-main); }
.announcement-banner { background-color: #E8F2FF; color: var(--apple-blue); padding: 14px 18px; border-radius: 16px; font-size: 15px; font-weight: 600; margin-top: 16px; display: flex; align-items: center; gap: 10px; line-height: 1.4; }
.edit-contact-btn { position: absolute; top: 20px; right: 20px; background: #E8F2FF; color: var(--apple-blue); border: none; padding: 8px 14px; border-radius: 20px; font-size: 13px; font-weight: 700; cursor: pointer; transition: transform 0.2s, background 0.2s; box-shadow: 0 2px 8px rgba(0,113,227,0.15);}
.edit-contact-btn:active { transform: scale(0.95); background: #D1E5FF; }

.glass-nav { position: sticky; top: 0; height: 68px; background: rgba(245, 245, 247, 0.8); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid rgba(0, 0, 0, 0.05); display: flex; align-items: center; overflow-x: auto; z-index: 1000; box-sizing: border-box; scrollbar-width: none; }
.glass-nav::-webkit-scrollbar { display: none; }
.nav-inner { display: flex; max-width: 800px; margin: 0 auto; width: 100%; padding: 0 20px; }
.category-btn { background: none; border: none; font-size: 15px; font-weight: 600; color: var(--text-secondary); padding: 8px 16px; border-radius: 20px; margin-right: 8px; cursor: pointer; white-space: nowrap; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); }
.category-btn.active { background-color: var(--text-main); color: #FFFFFF; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.category-title { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 16px; margin-top: 32px; color: var(--text-main); scroll-margin-top: 80px; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; }
.product-card { background-color: var(--card-bg); border-radius: 20px; padding: 12px; box-shadow: 0 4px 16px rgba(0,0,0,0.03); cursor: pointer; display: flex; flex-direction: column; transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease; position: relative; }
@media (hover: hover) { .product-card:not(.sold-out):hover { transform: translateY(-4px); box-shadow: 0 12px 24px rgba(0,0,0,0.08); } }
.product-card:not(.sold-out):active { transform: scale(0.96); }

.product-card.sold-out { opacity: 0.6; filter: grayscale(80%); cursor: not-allowed; }
.sold-out-badge { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -70%); background: rgba(0,0,0,0.7); color: white; padding: 8px 16px; border-radius: 12px; font-weight: 800; font-size: 18px; z-index: 10; letter-spacing: 1px; backdrop-filter: blur(4px); }

.product-img-real { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 14px; margin-bottom: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.product-info { padding: 0 4px; display: flex; flex-direction: column; flex: 1; }
.product-name { font-size: 16px; font-weight: 700; margin: 0 0 6px 0; line-height: 1.3; letter-spacing: -0.3px;}
.product-price { font-size: 15px; font-weight: 500; color: var(--text-secondary); margin: 0; display: flex; align-items: center;}
.stock-badge { font-size: 12px; font-weight: 700; color: var(--apple-red); background: #FFE5E5; padding: 2px 6px; border-radius: 6px; margin-left: 8px; letter-spacing: 0.5px;}

.add-btn-icon { position: absolute; bottom: 12px; right: 12px; width: 32px; height: 32px; border-radius: 16px; background-color: #F5F5F7; color: var(--apple-blue); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: bold; transition: background-color 0.2s, color 0.2s; }
.product-card:hover .add-btn-icon { background-color: var(--apple-blue); color: #FFF; }

.floating-cart { position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%); background: rgba(29, 29, 31, 0.9); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); color: white; padding: 16px 32px; border-radius: 100px; font-size: 16px; font-weight: 600; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2); cursor: pointer; z-index: 999; border: none; display: flex; align-items: center; gap: 12px; transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); }
.floating-cart.hidden { opacity: 0; pointer-events: none; transform: translate(-50%, 40px) scale(0.9); }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 1001; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }

/* 💡 重大修正：底部視窗 (購物車、紀錄、選項) 的寬度與觸發機制 */
.bottom-modal { 
    position: fixed; 
    bottom: -100%; 
    left: 50%; 
    transform: translateX(-50%); /* 讓視窗在電腦大螢幕上置中 */
    width: 100%; 
    max-width: 800px; /* 限制最大寬度，避免電腦螢幕跑版 */
    background: var(--card-bg); 
    border-radius: 28px 28px 0 0; 
    padding: 32px 24px; 
    box-sizing: border-box; 
    z-index: 1002; 
    transition: bottom 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); 
    max-height: 85vh; 
    display: flex; 
    flex-direction: column; 
    box-shadow: 0 -4px 32px rgba(0,0,0,0.15); 
}

/* 💡 已修正：拿掉容易導致重疊的 + .bottom-modal 錯誤綁定，改為精準觸發 */
.bottom-modal.active { bottom: 0; }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-title { font-size: 24px; font-weight: 800; margin: 0; letter-spacing: -0.5px;}
.close-btn { background: #F5F5F7; border: none; width: 32px; height: 32px; border-radius: 16px; font-size: 14px; cursor: pointer; color: var(--text-secondary); display: flex; align-items: center; justify-content: center; transition: background 0.2s;}
.close-btn:hover { background: #E5E5EA; }

.cart-items { flex: 1; overflow-y: auto; margin-bottom: 24px; }
.cart-item { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid rgba(0,0,0,0.05); }
.item-info { flex: 1; }
.item-name { font-size: 16px; font-weight: 700; margin: 0 0 4px 0; }
.item-note { font-size: 13px; color: var(--apple-blue); margin: 0 0 6px 0; font-weight: 600; }
.item-price { color: var(--text-secondary); font-weight: 500; margin: 0; font-size: 15px; }
.item-controls { display: flex; align-items: center; gap: 16px; background: #F5F5F7; padding: 6px; border-radius: 20px; }
.qty-btn { background: #FFF; color: var(--text-main); box-shadow: 0 2px 4px rgba(0,0,0,0.05); border: none; width: 30px; height: 30px; border-radius: 15px; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center;}

.checkout-form { display: flex; flex-direction: column; gap: 16px; margin-bottom: 32px; }
.form-row { display: flex; gap: 16px; }
.form-group { flex: 1; display: flex; flex-direction: column; gap: 8px; }
label { font-size: 13px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px;}
select, input { padding: 16px; border-radius: 14px; border: 2px solid transparent; font-size: 16px; background: #F5F5F7; outline: none; transition: border 0.2s, background 0.2s; font-family: inherit; }
select:focus, input:focus { border-color: var(--apple-blue); background: #FFF; }
.submit-btn { background: var(--apple-blue); color: white; border: none; padding: 18px; border-radius: 16px; font-size: 18px; font-weight: 700; width: 100%; cursor: pointer; transition: transform 0.2s, opacity 0.2s; }
.submit-btn:active { transform: scale(0.98); opacity: 0.9; }

.combo-group { margin-bottom: 24px; }
.combo-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; color: var(--text-main); display: flex; justify-content: space-between; align-items: center;}
.req-label { font-size: 12px; font-weight: bold; padding: 2px 6px; border-radius: 6px; background: #FFE5E5; color: var(--apple-red); }
.opt-label { font-size: 12px; font-weight: bold; padding: 2px 6px; border-radius: 6px; background: #E5E5EA; color: var(--text-secondary); }
.combo-choices { display: flex; flex-direction: column; gap: 10px; }
.combo-label { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #F5F5F7; border-radius: 14px; cursor: pointer; border: 2px solid transparent; transition: all 0.2s; font-size: 16px; font-weight: 600;}
.combo-label:has(input:checked) { background: #E8F2FF; border-color: var(--apple-blue); color: var(--apple-blue); }
.combo-label input[type="radio"] { transform: scale(1.2); accent-color: var(--apple-blue); }

.welcome-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 2000; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.welcome-overlay.active { opacity: 1; pointer-events: auto; }
.welcome-modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -45%); background: var(--card-bg); border-radius: 24px; padding: 32px 24px; width: 90%; max-width: 400px; box-sizing: border-box; z-index: 2001; opacity: 0; pointer-events: none; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); box-shadow: 0 10px 40px rgba(0,0,0,0.2); text-align: center; }
.welcome-modal.active { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }
.welcome-modal h2 { margin: 0 0 12px 0; font-size: 24px; letter-spacing: -0.5px; }
.welcome-modal p { color: var(--text-secondary); margin: 0 0 24px 0; font-weight: 600; font-size: 14px; }

.alert-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 3000; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.alert-overlay.active { opacity: 1; pointer-events: auto; }
.alert-modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -45%); background: var(--card-bg); border-radius: 20px; padding: 24px; width: 85%; max-width: 320px; box-sizing: border-box; z-index: 3001; opacity: 0; pointer-events: none; transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1); box-shadow: 0 10px 40px rgba(0,0,0,0.2); text-align: center; }
.alert-modal.active { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }
.alert-modal h3 { margin: 0 0 8px 0; font-size: 20px; letter-spacing: -0.5px; color: var(--text-main); }
.alert-modal p { color: var(--text-secondary); margin: 0 0 24px 0; font-size: 15px; line-height: 1.5; white-space: pre-wrap; font-weight: 500; }
.alert-btn { background: var(--apple-blue); color: white; border: none; padding: 14px; border-radius: 12px; font-size: 16px; font-weight: 700; cursor: pointer; width: 100%; transition: transform 0.2s; }
.alert-btn:active { transform: scale(0.96); }

.closed-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 9998; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(8px) grayscale(100%); -webkit-backdrop-filter: blur(8px) grayscale(100%); }
.closed-modal { background: var(--card-bg); padding: 32px 24px; border-radius: 24px; text-align: center; max-width: 400px; width: 90%; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.closed-modal h2 { margin: 0 0 12px 0; font-size: 24px; letter-spacing: -0.5px; color: var(--text-main); }
.bh-list { list-style: none; padding: 0; margin: 0; text-align: left; font-size: 15px; font-weight: 600; color: var(--text-main); }
.bh-list li { padding: 12px; border-bottom: 1px solid #E5E5EA; display: flex; justify-content: space-between; align-items: center; }
.bh-list li:last-child { border-bottom: none; }