:root {
    --bg-color: #0f1115;
    --panel-bg: rgba(25, 28, 36, 0.6);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-main: #f0f2f5;
    --text-muted: #9ba1a6;
    --accent: #c9a265;
    --accent-hover: #e0b876;
    --input-bg: rgba(0, 0, 0, 0.3);
    --input-border: rgba(255, 255, 255, 0.15);
    /* 客戶詳細頁字級倍率 (admin 系統設定可調 1.0 / 1.15 / 1.3) */
    --customer-font-scale: 1;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image: linear-gradient(rgba(15, 17, 21, 0.8), rgba(15, 17, 21, 0.8)), url('bg_tech.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

.background-effects {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1; overflow: hidden;
    background: radial-gradient(circle at 50% 50%, rgba(201, 162, 101, 0.05) 0%, transparent 80%);
}

.glow-orb {
    position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.4; animation: float 10s infinite ease-in-out alternate;
}
.orb-1 { width: 400px; height: 400px; background: radial-gradient(circle, rgba(201,162,101,0.2) 0%, rgba(0,0,0,0) 70%); top: -100px; right: -100px; }

@keyframes float { 0% { transform: translate(0, 0); } 100% { transform: translate(30px, 50px); } }

.container { width: 100%; max-width: 1000px; padding: 2rem; z-index: 1; }

header { text-align: center; margin-bottom: 3rem; }
h1 { font-family: 'Playfair Display', serif; font-size: 2.5rem; letter-spacing: 1px; }
h1 span { color: var(--accent); font-style: italic; }

.glass-panel {
    background: var(--panel-bg); backdrop-filter: blur(16px); border: 1px solid var(--panel-border);
    border-radius: 20px; padding: 2.5rem; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Gallery View */
.style-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.style-item { 
    background: rgba(255,255,255,0.03); border: 1px solid var(--panel-border); 
    border-radius: 12px; padding: 15px; cursor: pointer; transition: 0.3s; text-align: center;
}
.style-item:hover { background: rgba(255,255,255,0.06); border-color: var(--accent); transform: translateY(-5px); }
.style-item img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 8px; margin-bottom: 15px; background: #222; display: block; }

/* Form View */
.back-btn { margin-bottom: 20px; background: transparent; border: none; color: var(--accent); cursor: pointer; display: flex; align-items: center; gap: 5px; font-size: 0.9rem; }
.form-layout { display: grid; grid-template-columns: 1fr 1.5fr; gap: 40px; }
@media (max-width: 768px) { .form-layout { grid-template-columns: 1fr; } }

.product-image-placeholder { width: 100%; aspect-ratio: 3/4; background: #1a1d23; border-radius: 12px; overflow: hidden; }
.product-image-placeholder img { width: 100%; height: 100%; object-fit: cover; }

.size-form { display: flex; flex-direction: column; gap: 1.2rem; }
.input-group { display: flex; flex-direction: column; gap: 0.4rem; }
.input-group label { font-size: 0.85rem; color: var(--text-muted); display: flex; justify-content: space-between; }
.unit { color: #666; font-size: 0.75rem; }

/* ===== 客戶詳細頁字級縮放 (受 --customer-font-scale 控制) =====
   admin 可在系統設定切「標準 / 大 / 特大」,即時套用,不用改 CSS。 */
#detailView #detailName     { font-size: calc(1.6rem  * var(--customer-font-scale)); }
#detailView #detailDesc,
#detailView .description    { font-size: calc(0.95rem * var(--customer-font-scale)); }
#detailView .input-group label { font-size: calc(0.95rem * var(--customer-font-scale)); }
#detailView .input-group input { font-size: calc(1rem    * var(--customer-font-scale)); }
#detailView .form-container label {
    font-size: calc(0.95rem * var(--customer-font-scale)) !important;
}
#detailView .form-container input[type="text"],
#detailView .form-container input[type="tel"],
#detailView .form-container input[type="email"] {
    font-size: calc(1rem * var(--customer-font-scale)) !important;
    padding: calc(0.85rem * var(--customer-font-scale)) 1rem !important;
}
#detailView .submit-btn {
    font-size: calc(1rem * var(--customer-font-scale));
    padding: calc(1rem * var(--customer-font-scale));
}

/* ===== 分類藥丸 (Category Pills) ===== */
.category-pills {
    display: flex; flex-wrap: wrap; gap: 10px;
    margin: 0 0 28px;
    padding-bottom: 22px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.category-pill {
    padding: 8px 18px; border-radius: 22px;
    cursor: pointer; user-select: none;
    font-size: 0.9rem; letter-spacing: 0.3px;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid rgba(255,255,255,0.12);
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}
.category-pill:hover {
    color: var(--text-main);
    border-color: rgba(201, 162, 101, 0.55);
    transform: translateY(-1px);
}
.category-pill.active {
    color: #000;
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 4px 18px rgba(201, 162, 101, 0.35);
    letter-spacing: 0.5px;
}
.category-pill .count {
    margin-left: 8px; font-size: 0.72rem;
    color: rgba(255,255,255,0.4);
    font-variant-numeric: tabular-nums;
}
.category-pill.active .count {
    color: rgba(0,0,0,0.55);
}

/* ===== 卡片淡入(切換分類時) ===== */
@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.style-gallery .style-item {
    animation: cardFadeIn 380ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.style-gallery .style-item:nth-child(1)  { animation-delay: 0ms; }
.style-gallery .style-item:nth-child(2)  { animation-delay: 40ms; }
.style-gallery .style-item:nth-child(3)  { animation-delay: 80ms; }
.style-gallery .style-item:nth-child(4)  { animation-delay: 120ms; }
.style-gallery .style-item:nth-child(5)  { animation-delay: 160ms; }
.style-gallery .style-item:nth-child(6)  { animation-delay: 200ms; }
.style-gallery .style-item:nth-child(7)  { animation-delay: 240ms; }
.style-gallery .style-item:nth-child(8)  { animation-delay: 280ms; }
.style-gallery .style-item:nth-child(n+9) { animation-delay: 320ms; }

/* ===== 詳細頁圖片導航 (carousel/click 模式) ===== */
.detail-img-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.55); color: white; border: none;
    width: 40px; height: 40px; border-radius: 50%;
    font-size: 1.6rem; line-height: 1; cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    display: flex; align-items: center; justify-content: center;
    z-index: 5;
}
.detail-img-nav:hover { background: rgba(0, 0, 0, 0.85); transform: translateY(-50%) scale(1.1); }
.detail-img-nav.prev { left: 10px; }
.detail-img-nav.next { right: 10px; }

.detail-img-dots {
    position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 8px; z-index: 5;
    background: rgba(0, 0, 0, 0.4); padding: 6px 12px; border-radius: 20px;
}
.detail-img-dots .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.5); cursor: pointer;
    transition: 0.2s;
}
.detail-img-dots .dot.active {
    background: var(--accent); transform: scale(1.4);
}
.detail-img-dots .dot:hover { background: rgba(255, 255, 255, 0.85); }

input[type="number"] {
    background: var(--input-bg); border: 1px solid var(--input-border); color: var(--text-main);
    padding: 0.8rem 1rem; border-radius: 8px; outline: none; transition: 0.3s;
}
input[type="number"]:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(201, 162, 101, 0.2); }

.submit-btn {
    background: var(--accent); color: #000; border: none; padding: 1rem; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.3s;
}
.submit-btn:hover { background: var(--accent-hover); transform: translateY(-2px); }

.hidden { display: none; }
.result-message { text-align: center; padding-top: 2rem; }
.download-btn { display: inline-block; background: var(--accent); color: #000; padding: 0.8rem 1.5rem; border-radius: 8px; text-decoration: none; font-weight: 600; margin-top: 15px; }

/* Admin Link */
.admin-link { position: fixed; bottom: 20px; right: 20px; color: #444; text-decoration: none; font-size: 0.8rem; }
.admin-link:hover { color: var(--accent); }

/* ===== 回到頂端浮動按鈕 ===== */
.scroll-top-btn {
    position: fixed;
    bottom: 70px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(201, 162, 101, 0.92);
    color: #000;
    border: none;
    font-size: 1.4rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 9998;
    box-shadow: 0 4px 14px rgba(201, 162, 101, 0.35), 0 1px 3px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.scroll-top-btn.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.scroll-top-btn:hover {
    transform: translateY(-3px) scale(1.06);
    background: var(--accent);
    box-shadow: 0 8px 24px rgba(201, 162, 101, 0.55), 0 2px 6px rgba(0, 0, 0, 0.6);
}
.scroll-top-btn:active {
    transform: translateY(0) scale(0.95);
}
