/*===============================================================
  main.css — 線上購物系統全站樣式
  設計系統版本 v1.2
  編碼：UTF-8
  品牌色：對齊主網 UniteSys (#003366)
===============================================================*/

/* ── Google Fonts 載入 ── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* ================================================================
   1. CSS 自訂變數（設計 Token）
   品牌色與主網 unitesys.css 保持一致
================================================================ */
:root {
    /* 主品牌色（對齊主網 #003366） */
    --color-primary:       #003366;
    --color-primary-light: #1A4B8C;
    --color-primary-dark:  #001F3D;
    --color-primary-hover: #004585;
    --color-primary-gradient: linear-gradient(135deg, #003366 0%, #1A4B8C 100%);
    --color-glass-border:  rgba(255, 255, 255, 0.4);

    /* 輔助色 */
    --color-accent:        #E85D28;
    --color-accent-light:  #FF7A47;
    --color-gold:          #D4AF37;
    --color-pch-red:       #E12115;
    --color-pch-dark:      #2D2D2D;

    /* 中性色 */
    --color-bg:            #D1E9FF; /* 暫時改為較明亮的藍色，原本顏色: #EBEEF2 */
    --color-surface:       #FFFFFF;
    --color-form-bg:      #D1E6FF; /* 再度調深的淡藍色 */
    --color-border:        #E2E8F0;
    --color-border-light:  #EDF2F7;
    --color-text-main:     #1A202C;
    --color-text-sub:      #4A5568;
    --color-text-muted:    #A0AEC0;

    /* 功能色 */
    --color-success:       #2D8A4E;
    --color-success-bg:    #F0FFF4;
    --color-warning:       #E6A817;
    --color-warning-bg:    #FFFBEB;
    --color-danger:        #C0392B;
    --color-danger-bg:     #FFF5F5;
    --color-info:          #2980B9;
    --color-info-bg:       #EBF8FF;

    /* 字型 */
    --font-body:    'Noto Sans TC', 'Inter', -apple-system, sans-serif;
    --font-mono:    'Courier New', monospace;

    /* 字級 */
    --text-xs:     13px;
    --text-sm:     15px;
    --text-base:   16px;
    --text-md:     18px;
    --text-lg:     20px;
    --text-xl:     24px;
    --text-2xl:    30px;
    --text-3xl:    36px;
    --text-4xl:    42px;

    /* 間距 */
    --space-xs:    4px;
    --space-sm:    8px;
    --space-md:    16px;
    --space-lg:    24px;
    --space-xl:    32px;
    --space-2xl:   48px;

    /* 圓角 */
    --radius-sm:   4px;
    --radius-md:   8px;
    --radius-lg:   12px;
    --radius-xl:   16px;
    --radius-full: 9999px;

    /* 陰影 */
    --shadow-xs:   0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm:   0 4px 10px rgba(0,0,0,0.06);
    --shadow-md:   0 10px 30px rgba(0,51,102,0.1);
    --shadow-lg:   0 20px 50px rgba(0,51,102,0.15);
    --shadow-xl:   0 30px 70px rgba(0,51,102,0.2);

    /* 動畫 */
    --transition:  0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s ease;

    /* 版面寬度 */
    --container-max: 1240px;
    --sidebar-width: 250px;
    --header-height: 70px;
    --top-bar-height: 34px;
    --nav-bar-height: 50px;
}

/* ================================================================
   2. Reset & Base
================================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: var(--text-base);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

/* 強化分類欄位寬度以容納更多欄 */
.shop-nav-dropdown {
    width: 800px !important; 
    right: -100px !important;
}

body {
    font-family: var(--font-body);
    color: var(--text-main);
    background: var(--color-bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-light);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

body.overflow-hidden {
    overflow: hidden !important;
}

ul, ol { list-style: none; }
.mobile-only { display: none !important; }


/* ================================================================
   3. 版面結構
================================================================ */
.shop-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.shop-main {
    flex: 1;
    display: flex;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 12px var(--space-md);
    gap: var(--space-xl);
    width: 100%;
}

/* 當無側欄時，內容區自動填滿 */
.shop-main:not(:has(.shop-sidebar)) .content-area {
    flex: 1;
}

.content-area {
    flex: 1;
    min-width: 0;
}

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* ================================================================
   4. 導覽列 Header
================================================================ */
/* ── 頂部工具列 (已整合至主頁首) ── */
/* 移除原本的 .site-top-bar 樣式 */

.top-bar-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-md);
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 30px;
}

.top-bar-inner a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.top-bar-inner a:hover {
    color: #fff;
}

/* ── 主頁首 (深藍) ── */
.site-header {
    background: var(--color-primary);
    position: sticky;
    top: 0;
    z-index: 3000;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    height: var(--header-height);
}

.header-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-md);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

/* Logo */
.site-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    flex-shrink: 0;
}

.site-logo .logo-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#header-logo-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.site-logo .logo-text {
    color: #FFFFFF;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 搜尋欄 */
/* 自訂搜尋框樣式 */
.header-search {
    flex: 1;
    max-width: 240px; /* 進一步縮減搜尋欄寬度 */
    display: flex;
    align-items: center;
}

.header-search form {
    width: 100%;
    display: flex;
    background: #FFFFFF;
    padding: 2px;
    border-radius: 4px;
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.search-select {
    padding: 0 var(--space-sm);
    height: 48px;
    border: none;
    background: #eee;
    color: #333;
    font-weight: 600;
    font-size: 16px; /* 加大下拉選單字型 */
    border-right: 1px solid #ddd;
}

.search-input {
    flex: 1;
    height: 48px;
    padding: 0 var(--space-md);
    border: none;
    font-size: 16px; /* 稍微縮小字型以適應較窄的寬度 */
    color: #333;
    outline: none;
}

.search-btn {
    height: 48px;
    width: 48px; /* 固定寬度使其成正方形 */
    padding: 0;
    background: transparent; /* 移除方框背景 */
    border: none;
    color: var(--color-primary); /* 圖示改為深藍色 */
    font-size: 20px;
    cursor: pointer;
    transition: transform var(--transition-fast), color var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    background: transparent;
    color: var(--color-accent); /* 懸停時變橘色增加互動感 */
    transform: scale(1.1);
}

/* Header 工具列整合樣式 */
.header-tools {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
}

.utility-links {
    display: flex;
    gap: 15px;
    font-size: 16px; /* 加大工具列連結字型 */
    color: rgba(255,255,255,0.85);
}

.utility-links a {
    color: inherit;
    white-space: nowrap;
}

.utility-links a:hover {
    color: #fff;
    text-decoration: underline;
}

.header-tool-btn {
    position: relative;
    font-size: 24px;
    color: #fff;
    line-height: 1;
}
/* ── 分類選單列 (固定在頂部) ── */
.category-nav {
    background: #fff;
    border-top: none !important;
    border-bottom: 2px solid var(--color-primary);
    min-height: var(--nav-bar-height);
    display: flex;
    align-items: center;
    position: sticky;
    top: calc(var(--header-height) - 1px); /* 稍微向上偏移以補齊縫隙 */
    z-index: 1000;
    padding: 6px 0;
    margin: 0 !important;
}

.category-nav-inner {
    position: relative;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-md);
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center; /* 垂直置中 */
    overflow-x: auto;
    gap: 12px;
    scrollbar-width: none;
}

.category-nav-inner::-webkit-scrollbar { display: none; }

.category-nav-inner a {
    white-space: nowrap;
    color: var(--color-text-sub);
    font-weight: 700;
    font-size: 16px; /* 略微縮小分類按鈕字型，從 18px 改為 16px */
    padding: 8px 24px;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    background: #f1f5f9;
    border: 1px solid var(--color-border);
}

.category-nav-inner a:hover,
.category-nav-inner a.active {
    background: var(--color-primary);
    color: #fff !important;
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.2);
}

/* 分類列 AI 按鈕 (置中流式佈局) */
.btn-category-ai {
    white-space: nowrap;
    color: #fff !important;
    font-weight: 700;
    font-size: 16px;
    padding: 8px 24px;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    background: var(--color-primary);
    border: 1px solid var(--color-primary);
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.2);
    transform: translateY(-2px); /* 預設維持醒目的微浮動狀態 */
}

.btn-category-ai:hover {
    background: #004488;
    transform: translateY(-4px); /* 滑過時更明顯的浮動 */
    box-shadow: 0 6px 15px rgba(0, 51, 102, 0.3);
}

@media (max-width: 1024px) {
    .category-nav-inner {
        justify-content: flex-start !important; /* 手機版需改為靠左，否則橫向捲動會被置中裁切 */
        padding: 4px var(--space-md) 10px var(--space-md);
        -webkit-overflow-scrolling: touch;
    }
    .btn-category-ai {
        padding: 6px 16px;
        font-size: 14px;
    }
}

.header-tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: rgba(255,255,255,0.85);
    font-size: var(--text-xs);
    transition: color var(--transition-fast);
    position: relative;
}

.header-tool-btn:hover {
    color: #FFFFFF;
}

.header-tool-btn .icon {
    font-size: 20px;
    line-height: 1;
}

/* ── 頁首佈局優化 (橫向導覽模式) ── */
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    height: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-shrink: 0;
}

/* ── 桌面版橫向導覽佈局 (僅在 1025px 以上生效) ── */
@media (min-width: 1025px) {
    .header-nav-main {
        flex: 1;
        display: flex;
        justify-content: center;
        margin: 0 20px;
    }

    .main-nav-list {
        list-style: none;
        display: flex;
        gap: 30px;
        margin: 0;
        padding: 0;
    }

    .nav-item-group {
        position: relative;
        padding: 15px 0;
    }

    .nav-item-label {
        color: #fff;
        font-size: 16px;
        font-weight: 700;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 6px;
        transition: color 0.2s, opacity 0.2s;
    }

    .nav-item-label:hover,
    a.nav-item-label:hover {
        color: var(--color-gold) !important;
        opacity: 1;
    }

    .nav-sub-menu {
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%) translateY(10px);
        width: 220px;
        background: #fff;
        border-radius: 12px;
        box-shadow: var(--shadow-xl);
        border: 1px solid #e2e8f0;
        padding: 16px;
        opacity: 0;
        visibility: hidden;
        transition: all 0.2s ease;
        z-index: 2000;
        list-style: none;
    }

    .nav-item-group:hover .nav-sub-menu {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.sub-label {
    font-size: 12px;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.sub-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 10px 0;
}

.nav-sub-menu li a {
    display: block;
    padding: 8px 0;
    font-size: 15px;
    color: #334155 !important;
    transition: all 0.2s;
}

.nav-sub-menu li a:hover {
    color: var(--color-primary) !important;
    transform: translateX(4px);
}

/* 迷你搜尋框 (右側) */
.header-search-mini {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    padding: 4px 6px 4px 16px;
    display: flex;
    align-items: center;
    width: 180px; /* 極致縮短 */
    transition: all 0.2s;
}

.header-search-mini:focus-within {
    background: rgba(255, 255, 255, 0.25);
    width: 220px; /* 聚焦時稍微伸長 */
}

.header-search-mini form {
    display: flex;
    width: 100%;
    align-items: center;
}

.search-input-mini {
    background: none;
    border: none;
    color: #fff;
    font-size: 15px;
    width: 100%;
    outline: none;
}

.search-input-mini::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-btn-mini {
    background: var(--color-accent);
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

/* 回首頁連結樣式調整 */
.home-link {
    background: rgba(255, 255, 255, 0.15);
    padding: 7px 15px;
    border-radius: var(--radius-md);
    font-weight: 700 !important;
    color: #fff !important;
    font-size: 15px;
    white-space: nowrap;
}

.text-danger { color: var(--color-danger) !important; }
.text-accent { color: var(--color-accent) !important; }
.font-bold { font-weight: 700; }

/* 購物車徽章 */
.cart-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: var(--color-accent);
    color: #fff;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* 會員狀態列 */
.header-member-info {
    color: rgba(255,255,255,0.75);
    font-size: var(--text-sm);
    white-space: nowrap;
}

.header-member-info .member-name {
    color: #fff;
    font-weight: 600;
}

/* ================================================================
   5. 分類導覽側欄
================================================================ */
.shop-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
}

.sidebar-section {
    background: #f1f5f9; /* 更顯眼的淺灰藍 */
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: var(--space-2xl);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1.5px solid var(--color-border);
}

.sidebar-section:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 60px rgba(0, 51, 102, 0.12);
}

.sidebar-title {
    background: transparent;
    color: var(--color-primary);
    padding: var(--space-xl) var(--space-lg) var(--space-md);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: var(--space-lg);
    padding-left: 0;
}

/* VIP 會員卡特有樣式 */
.member-card-vivid {
    background: linear-gradient(110deg, #001F3D 0%, #004585 100%);
    color: #fff !important;
    position: relative;
    overflow: hidden;
}

.member-card-vivid::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.sidebar-menu {
    padding: var(--space-xs) 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    margin: 4px var(--space-lg);
    color: var(--color-text-sub);
    font-size: var(--text-sm);
    font-weight: 600;
    transition: all 0.3s ease;
    border-radius: var(--radius-full);
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: var(--color-primary-gradient);
    color: #FFFFFF !important;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.2);
}

/* 登入面板 */
.login-panel {
    padding: var(--space-lg);
}

.login-panel .form-group {
    margin-bottom: var(--space-md);
}

.login-panel input {
    width: 100%;
    padding: var(--space-md);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    background: var(--color-bg);
    transition: all var(--transition-fast);
}

/* 快速連結網格 */
.quick-links-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: var(--space-lg);
}

.quick-links-grid a {
    background: #F8FAFC;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 18px 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-sub);
    text-align: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.02);
}

.quick-links-grid a:hover {
    background: #FFFFFF;
    color: var(--color-primary) !important;
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.06);
}

.quick-links-grid a span.icon-lg {
    font-size: 28px;
    width: 48px;
    height: 48px;
    background: #FFFFFF;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.04);
}

/* 為圖標增加多彩感 */
.icon-cart { color: #FF6B35; background: #FFF5F5 !important; }
.icon-order { color: #6366F1; background: #EEF2FF !important; }
.icon-flow { color: #8B5CF6; background: #F5F3FF !important; }
.icon-pay { color: #10B981; background: #ECFDF5 !important; }
.icon-faq { color: #F59E0B; background: #FFFBEB !important; }
.icon-msg { color: #3B82F6; background: #EFF6FF !important; }

/* ================================================================
   6. 商品卡片
================================================================ */
/* Standard Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: var(--space-md);
}

/* 橫式列表模式 (用於特惠商品) - 強制雙欄並確保顯示 */
.product-grid.horizontal-list {
    display: grid; /* 確保重置或繼承 */
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--space-lg);
}

/* Glass Card 風格（對齊主網 unitesys.css） */
.product-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

/* 橫式卡片核心樣式 */
.product-card.horizontal {
    flex-direction: row;
    align-items: stretch;
    height: 100%;
}

.product-card:hover {
    border-color: var(--color-primary);
}

.product-card-visual {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.product-card.horizontal .product-card-visual {
    width: 200px; /* 雙欄下圖片區寬度縮小 */
    border-right: 1px solid rgba(0, 51, 102, 0.05);
}

.product-card-visual {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 100%;
}

.product-card.horizontal .product-card-visual {
    width: 200px; /* 雙欄下左側視圖區寬度 */
    border-right: 1px solid rgba(0, 51, 102, 0.05);
}

.product-card-img {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #ffffff; /* 確保縮放留白處為白色 */
}

.product-card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* 依原圖比例完整縮放，不裁切 */
    transition: transform var(--transition);
}

/* 移除滑過時的圖片放大效果 */
.product-card:hover .product-card-img img {
    transform: none;
}

/* 特惠標籤 */
.badge-hot {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    background: var(--color-danger);
    color: #fff;
    font-size: var(--text-xs);
    font-weight: 700;
    padding: 2px var(--space-sm);
    border-radius: var(--radius-sm);
    z-index: 2;
    letter-spacing: 0.04em;
}


.product-card-body {
    padding: var(--space-lg);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card.horizontal .product-card-body {
    padding-left: var(--space-xl);
    justify-content: center;
}

.product-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary-dark);
    margin-bottom: var(--space-xs);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 產品編號與標籤 */
.product-meta-info {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
    display: block;
}

/* 產品特徵 (HTML 渲染容器) */
.card-spec-wrapper {
    margin: var(--space-md) 0;
    font-size: 14px;
    color: var(--color-text-sub);
    line-height: 1.5;
    max-height: 100px;
    overflow: hidden;
    position: relative;
    /* 漸層邊緣：若 HTML 太長則顯示淡出感 */
    mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

.card-spec-wrapper b, .card-spec-wrapper strong {
    color: var(--color-primary-dark);
    font-weight: 700;
}

.card-spec-wrapper ul {
    padding-left: 1.2rem;
    margin: 4px 0;
}

.card-spec-wrapper li {
    list-style-type: disc;
    margin-bottom: 2px;
}

.card-spec-wrapper p {
    margin-bottom: 4px;
}

/* 三層價格標籤組 (對齊原始截圖) */
.price-stack-bundle {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: var(--space-md);
    padding: 12px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1.5px solid var(--color-border);
}

.price-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

.price-label {
    background: #C0392B; /* 經典紅 */
    color: #fff;
    font-size: 12px;
    padding: 3px 6px;
    border-radius: 4px;
    margin-right: 10px;
    min-width: 65px;
    text-align: center;
    font-weight: 700;
}

.price-value {
    color: var(--color-text-main);
    font-size: 18px;
    font-weight: 700;
}

.price-value.strike {
    text-decoration: line-through;
    color: var(--color-text-muted);
    opacity: 0.8;
}

.price-value.highlight {
    color: var(--color-danger);
    font-weight: 800;
}

.price-sale {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-danger);
}

.price-sale::before {
    content: '$';
    font-size: var(--text-sm);
    font-weight: 400;
}

.product-card .btn-add-cart {
    width: calc(100% - 24px);
    margin: 0 auto 15px;
    padding: 10px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.product-card .btn-add-cart:hover {
    background: var(--color-primary-hover);
}

.product-card .btn-add-cart:active {
    transform: scale(0.97);
}

.product-card .btn-add-cart.disabled {
    background: var(--color-text-muted);
    cursor: not-allowed;
}

/* ================================================================
   7. 通用按鈕
================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    font-family: var(--font-body);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.btn-primary:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary-light);
    color: #fff;
}

.btn-accent {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}
.btn-accent:hover {
    background: var(--color-accent-light);
    border-color: var(--color-accent-light);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border-color: var(--color-primary);
}
.btn-outline:hover {
    background: var(--color-primary);
    color: #fff;
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
    border-color: var(--color-danger);
}
.btn-danger:hover { opacity: 0.88; }

.btn-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: var(--text-md);
    border-radius: var(--radius-full);
}

.btn-full { width: 100%; }

/* ================================================================
   8. 表單元件
================================================================ */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--color-border);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
}

.form-section-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-primary-dark);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--color-border-light);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-text-sub);
}

.form-label .required {
    color: var(--color-danger);
    margin-left: 2px;
}

/* 全域輸入欄位背景色強制設定 */
input.form-control, 
select.form-control,
textarea.form-control,
input[type="text"].form-control,
input[type="password"].form-control,
input[type="email"].form-control,
input[type="tel"].form-control,
input[type="date"].form-control {
    background-color: var(--color-form-bg) !important;
    background: var(--color-form-bg) !important;
}

.form-control {
    padding: var(--space-sm) var(--space-md);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-family: var(--font-body);
    color: var(--color-text-main);
    background: var(--color-form-bg) !important;  /* 淡藍色背景色，強制執行 */
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    width: 100%;
}

.form-control:focus {
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(46,107,196,0.15);
}

.form-control::placeholder {
    color: var(--color-text-muted);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23718096' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-color: var(--color-form-bg) !important;  /* 下拉選單同步淡藍色 */
    padding-right: 36px;
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--color-danger);
}

/* ================================================================
   9. 購物車
================================================================ */
.cart-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-base);
}

.cart-table th {
    background: var(--color-primary-dark);
    color: #fff;
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    font-weight: 600;
    font-size: var(--text-base);
    letter-spacing: 0.05em;
}

.cart-table td {
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.cart-table tr:last-child td {
    border-bottom: none;
}

.cart-table tr:hover td {
    background: var(--color-border-light);
}

/* 購物車/訂單表格中的商品名稱連結 (桌機與全域基礎) */
.cart-item-name-link {
    font-size: 1.1rem;
    line-height: 1.5;
}

/* 購物車表格專屬手機優化 */
@media (max-width: 768px) {
    .hide-on-mobile {
        display: none !important;
    }
    .cart-table th, .cart-table td {
        padding: 10px 6px !important;
        font-size: 14px !important;
    }
    .col-price { width: 65px; }
    .col-qty { width: 75px; }
    .col-sub { width: 70px; }
    .col-del { width: 45px; }
    
    .cart-item-name-link {
        font-size: 16px !important;
        line-height: 1.4 !important;
        display: inline-block;
        word-break: break-word;
    }
    .cart-qty-input {
        width: 48px;
        padding: 4px;
        font-size: 14px;
    }
}

.cart-item-img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.cart-qty-input {
    width: 60px;
    text-align: center;
    padding: var(--space-xs) var(--space-sm);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-family: var(--font-body);
}

.cart-total-row {
    background: var(--color-border-light);
}

.cart-total-row td {
    font-weight: 700;
    font-size: var(--text-md);
}

/* 結帳摘要卡 */
.checkout-summary {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-lg);
    position: sticky;
    top: calc(var(--header-height) + var(--space-md));
}

.summary-title {
    font-size: var(--text-lg);
    font-weight: 700;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--color-border);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-xs) 0;
    font-size: var(--text-base);
    color: var(--color-text-main);
    font-weight: 700;
}

.summary-row.total {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-danger);
    border-top: 2px solid var(--color-border);
    padding-top: var(--space-sm);
    margin-top: var(--space-sm);
}

/* 雙欄結帳/訂單排版 (支援 RWD) */
.checkout-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: var(--space-lg);
    align-items: start;
}

@media (max-width: 900px) {
    .checkout-layout {
        grid-template-columns: 1fr;
    }
    .checkout-summary {
        position: static; /* 手機版不固定在頂部，順流安置 */
    }
}

/* ================================================================
   10. 訊息提示框
================================================================ */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.alert-success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid #9AE6B4;
}

.alert-warning {
    background: var(--color-warning-bg);
    color: #975A00;
    border: 1px solid #FAD791;
}

.alert-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border: 1px solid #FEB2B2;
}

.alert-info {
    background: var(--color-info-bg);
    color: var(--color-info);
    border: 1px solid #90CDF4;
}

/* ================================================================
   11. 分頁元件
================================================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-xs);
    margin: var(--space-xl) 0;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 var(--space-sm);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    border: 1.5px solid var(--color-border);
    color: var(--color-text-sub);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.pagination a:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.pagination .current {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    font-weight: 700;
}

.pagination .disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ================================================================
   12. 頁面標題列
================================================================ */
.page-header {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-lg) var(--space-xl);
    margin-bottom: var(--space-lg);
    border: 1.5px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.page-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--color-primary-dark);
    display: flex;
    align-items: center;
    gap: 16px;
}
.title-icon {
    width: 48px;
    height: 48px;
    background: var(--color-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0, 51, 102, 0.15);
}
.title-icon i {
    width: 28px;
    height: 28px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.breadcrumb a {
    color: var(--color-text-muted);
}
.breadcrumb a:hover {
    color: var(--color-primary);
}

.breadcrumb .sep {
    color: var(--color-border);
}

.breadcrumb .current {
    color: var(--color-text-main);
    font-weight: 500;
}

/* ================================================================
   13. 首頁專用元件
================================================================ */
.home-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.home-section-title {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-primary-dark);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 移除舊有的方形裝飾 */
.home-section-title::before {
    display: none;
}

.home-view-all {
    font-size: var(--text-sm);
    color: var(--color-primary);
    font-weight: 500;
}

/* 公告欄 */
.notice-list {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--color-border);
    overflow: hidden;
    margin-bottom: var(--space-lg);
}

.notice-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--color-border-light);
    transition: background var(--transition-fast);
}

.notice-item:last-child { border-bottom: none; }
.notice-item:hover { background: var(--color-border-light); }

.notice-date {
    font-size: var(--text-xs);
    color: var(--color-accent);
    font-weight: 700;
    white-space: nowrap;
    padding-top: 2px;
    min-width: 80px;
}

.notice-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 2px;
}

.notice-spec {
    font-size: var(--text-xs);
    color: var(--color-text-sub);
    line-height: 1.6;
}

/* ── 商店頁尾 (同步主網設計) ── */
.site-footer {
    background: #030712 !important; /* 深黑底色 */
    color: #ffffff;
    padding: 64px 0;
    border-top: 1px solid #1f2937;
    margin-top: 60px;
}

.footer-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-md); /* 從 24px 改為 16px */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

@media (min-width: 1025px) {
    .footer-container {
        flex-direction: row;
        align-items: center;
    }
}

.footer-info {
    color: #9ca3af;
    font-size: 12px; /* 從 13px 微調為 12px 以適應手機寬度 */
    text-align: center;
    line-height: 1.8;
}

@media (min-width: 1025px) {
    .footer-info {
        text-align: left;
    }
}

.footer-info p { 
    margin-bottom: 8px; 
    word-break: keep-all; 
    overflow-wrap: break-word;
}
.footer-info a { color: #ffffff; text-decoration: none; transition: all 0.2s; }
.footer-info a:hover { color: #60a5fa; text-decoration: underline; }

.footer-socials {
    display: flex;
    gap: 32px;
    align-items: center;
    margin-top: 40px;
}

@media (min-width: 1025px) {
    .footer-socials {
        margin-top: 0;
        gap: 48px;
    }
}

.social-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    cursor: pointer;
}

.social-icon-box {
    background: #ffffff;
    padding: 6px;
    border-radius: 12px;
    margin-bottom: 8px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.social-item:hover .social-icon-box {
    transform: translateY(-8px) scale(1.05);
}

.social-icon-box img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.social-label {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 600;
    transition: color 0.2s;
}

.social-item:hover .social-label {
    color: #ffffff;
}

/* LINE Modal 同步 */
.line-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.line-modal-content {
    background: #fff;
    border-radius: 24px;
    padding: 32px;
    text-align: center;
    max-width: 310px;
    width: 90%;
    position: relative;
    box-shadow: 0 30px 70px rgba(0,0,0,0.5);
}

/* ================================================================
   15. 動畫效果
================================================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes cartPop {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.35); }
}

.animate-fade-up {
    animation: fadeInUp 0.4s ease both;
}

.animate-fade-in {
    animation: fadeIn 0.3s ease both;
}

/* 載入延遲（用於商品卡片依序出現）*/
.product-card:nth-child(1)  { animation-delay: 0.05s; }
.product-card:nth-child(2)  { animation-delay: 0.10s; }
.product-card:nth-child(3)  { animation-delay: 0.15s; }
.product-card:nth-child(4)  { animation-delay: 0.20s; }
.product-card:nth-child(5)  { animation-delay: 0.25s; }
.product-card:nth-child(6)  { animation-delay: 0.30s; }
.product-card:nth-child(7)  { animation-delay: 0.35s; }
.product-card:nth-child(8)  { animation-delay: 0.40s; }

/* ================================================================
   16. 響應式設計
================================================================ */
@media screen and (max-width: 960px) {
    :root {
        --sidebar-width: 180px;
    }
}

@media screen and (max-width: 768px) {
    .shop-main {
        flex-direction: column;
        padding: var(--space-md) var(--space-sm);
    }

    .shop-sidebar {
        width: 100%;
    }

    .header-inner {
        flex-wrap: nowrap !important;
        height: 100% !important;
        padding: 0 var(--space-md);
        gap: 10px;
    }

    .header-search {
        order: 3;
        max-width: 100%;
        width: 100%;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .form-row {
        grid-template-columns: 1fr;
    }

}

@media screen and (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }

    .page-title {
        font-size: var(--text-xl);
    }

}

/* ================================================================
   17. 工具類別
================================================================ */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-danger  { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-muted   { color: var(--color-text-muted); }
.text-primary { color: var(--color-primary); }
.text-accent  { color: var(--color-accent); }
.font-bold    { font-weight: 700; }
.font-lg      { font-size: var(--text-lg); }

.mb-0  { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.d-flex       { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm       { gap: var(--space-sm); }
.gap-md       { gap: var(--space-md); }

.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--color-border);
    padding: var(--space-lg);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ================================================================
   18. 結帳步驟指示器
================================================================ */
.step {
    padding: var(--space-xs) var(--space-lg);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
    background: var(--color-border-light);
    color: var(--color-text-sub);
    border: 2px solid var(--color-border);
    white-space: nowrap;
}
.step.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.step.done {
    background: var(--color-success-bg);
    color: var(--color-success);
    border-color: var(--color-success);
}
.step-line {
    flex: 1;
    height: 2px;
    background: var(--color-border);
    max-width: 60px;
}
.step-line.done {
    background: var(--color-success);
}

/* ================================================================
   19. 側欄 Glass Card 效果（對齊主網設計）
================================================================ */
.sidebar-section {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-md);
    transition: border-color 0.2s;
}
.sidebar-section:hover {
    border-color: rgba(0, 51, 102, 0.18);
}

/* ── 橫式卡片 RWD 響應式優化 ── */
@media (max-width: 768px) {
    .product-grid.horizontal-list {
        grid-template-columns: 1fr;
    }
    .product-card.horizontal {
        flex-direction: column;
        min-height: auto;
    }
    .product-card.horizontal .product-card-img {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(0, 51, 102, 0.05);
    }
    .product-card.horizontal .product-card-body {
        padding: var(--space-lg);
    }
}

/* ================================================================
   20. 商品規格 HTML 渲染樣式 (item_spec)
================================================================ */
.detail-spec-html {
    color: var(--color-text-sub);
    line-height: 1.6;
    word-break: break-word;
    font-size: 15px;
    margin-top: var(--space-md);
    background: rgba(0, 51, 102, 0.02);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    border: 1px dashed var(--color-border);
}

/* ✦ 商品規格漸層遮罩描述區 (item-list 專用) ✦ */
.card-spec-html-box {
    margin: 12px 0 16px;
    font-size: 14px;
    color: var(--color-text-sub);
    line-height: 1.5;
    max-height: 90px;
    overflow: hidden;
    position: relative;
    /* 漸層漸變效果：防止文字直接截斷 */
    mask-image: linear-gradient(to bottom, black 65%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 65%, transparent 100%);
}

.card-spec-html-box b, 
.card-spec-html-box strong,
.detail-spec-html strong {
    color: var(--color-primary-dark);
    font-weight: 700;
}

.card-spec-html-box ul,
.detail-spec-html ul {
    padding-left: 1.2rem;
    margin: 4px 0;
    list-style-type: disc;
}

.card-spec-html-box li,
.detail-spec-html li {
    margin-bottom: 2px;
}

.card-spec-html-box br {
    margin-bottom: 4px;
}

.detail-spec-html p {
    margin-bottom: 8px;
}

/* ================================================================
   21. 產品大類橫式卡片版面 (item-cat-list)
   結構：左側圖片 | 右側 = [名稱] [價格區] [規格描述]
================================================================ */

/* ── 商品詳情：現代化平面表格 (取代舊式格線) ── */
.detail-info-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px; /* 列與列之間的間隙 */
    margin-bottom: var(--space-md);
}

.detail-info-table th {
    background: #f1f5f9 !important;
    color: var(--color-primary-dark) !important;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 16px;
    width: 100px;
    text-align: left;
    border-radius: 6px 0 0 6px;
    border: none !important;
}

.detail-info-table td {
    background: #fff !important;
    border: 1px solid var(--color-border) !important;
    border-left: none !important;
    padding: 10px 16px;
    border-radius: 0 6px 6px 0;
    vertical-align: middle;
}

.price-origin {
    color: var(--color-text-sub);
    text-decoration: line-through;
    font-size: 14px;
}

.highlighted-price {
    color: var(--color-danger);
    font-weight: 700;
    font-size: 16px;
}

.urgent-price {
    color: var(--color-danger);
    font-weight: 800;
    font-size: 18px;
}

.save-tag {
    font-size: 11px;
    background: var(--color-danger);
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 700;
}

.spec-mini {
    line-height: 1.6;
    color: var(--color-text-sub);
    font-size: 14px;
}

.qty-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--color-border-light);
    color: var(--color-primary);
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    transition: all 0.2s;
}

.qty-field {
    width: 50px;
    height: 36px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    font-size: 15px;
    font-weight: 600;
}

/* 容器：單欄全寬列表 */
.product-grid.item-cat-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.product-card.cat-card {
    flex-direction: row;
    align-items: stretch;
    min-height: 420px;
}

/* 移除滑過時的浮動效果 */
.product-card.cat-card:hover {
    transform: none;
}

/* 左側：圖片＋加入購物車按鈕 */
.cat-card-left {
    width: 40%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(0, 51, 102, 0.08);
    background: #fff;
}

.cat-card-img-link {
    display: block;
    flex: 1;
}

.cat-card-left .product-card-img {
    height: 100%;
    min-height: 180px;
    aspect-ratio: unset;
    position: relative;
    overflow: hidden;
}

/* 圖片充滿整個左側區塊，自動縮放 */
.cat-card-left .product-card-img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
    transform: none; /* 覆蓋預設 hover 放大，避免裁切 */
}

.cat-card-left .btn-add-cart {
    flex-shrink: 0;
    font-size: 13px;
    padding: 9px;
}

/* 右側：整體 flex column */
.cat-card-right {
    flex: 1;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

/* 標題列：商品名稱 + 編號 */
.cat-card-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.cat-card-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--color-primary-dark);
    line-height: 1.35;
    text-decoration: none;
    transition: color 0.2s;
}

.cat-card-name:hover {
    color: var(--color-primary);
}

.cat-card-no {
    font-size: 12px;
    color: var(--color-primary);
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

/* 價格區：緊湊版三層，寬度自動收縮 */
.cat-card-price {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid rgba(0, 51, 102, 0.05);
    padding: 10px 14px;
    flex-shrink: 0;
    align-self: flex-start;   /* 不擐滿整行寬 */
    min-width: 140px;          /* 保證讀讀的最小寬度 */
}

/* 規格描述區：僅顯示文字，隱藏圖片，漸層截斷 */
.cat-card-spec {
    font-size: 13.5px;
    color: var(--color-text-sub);
    line-height: 1.6;
    flex: 1;
    overflow: visible;
    max-height: none;
    position: relative;
}

/* ★ 過濾 item_spec 內的圖片，只保留文字 */
.cat-card-spec img {
    display: none !important;
}

.cat-card-spec b,
.cat-card-spec strong {
    color: var(--color-primary-dark);
    font-weight: 700;
}

.cat-card-spec ul {
    padding-left: 1.1rem;
    margin: 3px 0;
    list-style-type: disc;
}

.cat-card-spec li {
    margin-bottom: 2px;
}

/* ── RWD：平板改單欄 ── */
@media (max-width: 900px) {
    .product-grid.item-cat-list {
        grid-template-columns: 1fr;
    }
}

/* ── RWD：手機版卡片改直向 ── */
@media (max-width: 640px) {
    .product-card.cat-card {
        flex-direction: column;
        min-height: auto;
    }
    .cat-card-left {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(0, 51, 102, 0.06);
    }
    .cat-card-left .product-card-img {
        height: 200px;
        min-height: unset;
    }
    .cat-card-right {
        padding: 12px 14px;
    }
}

/* ── 行動版漢堡選單樣式 ── */
.mobile-menu-toggle {
    display: none; /* 桌面版隱藏 */
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    margin-right: 8px;
}

@media (max-width: 1024px) {
    /* 確保手機版絕對是抽屜結構 */
    .header-nav-main {
        position: fixed !important;
        top: 0;
        left: -100% !important;
        width: 280px !important;
        height: 100vh !important;
        background: #fff !important;
        display: block !important;
        flex: none !important;
        margin: 0 !important;
        box-shadow: 20px 0 50px rgba(0,0,0,0.2) !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 5000 !important;
        padding-top: 20px !important;
        overflow-y: auto !important;
        pointer-events: auto !important;
    }

    .header-nav-main.is-active {
        left: 0 !important;
    }

    .main-nav-list {
        flex-direction: column !important;
        display: flex !important;
        gap: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .nav-item-group {
        width: 100% !important;
        border-bottom: 1px solid #f1f5f9;
        padding: 0 !important;
        list-style: none !important;
    }

    .nav-item-label {
        color: #1a202c !important;
        padding: 16px 24px !important;
        justify-content: space-between !important;
        font-size: 15px !important;
        font-weight: 600 !important;
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        cursor: pointer;
    }

    .nav-item-label i {
        color: #94a3b8 !important;
        transform: rotate(-90deg);
        transition: transform 0.2s;
        width: 18px !important;
        height: 18px !important;
    }

    .nav-sub-menu {
        position: static !important;
        width: 100% !important;
        max-height: 0;
        opacity: 1 !important;
        visibility: visible !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 24px !important;
        transform: none !important;
        overflow: hidden !important;
        background: #f8fafc !important;
        transition: max-height 0.3s ease-in-out, padding 0.3s ease !important;
        list-style: none !important;
    }

    .nav-item-group.is-open .nav-sub-menu {
        max-height: 800px !important; 
        padding: 8px 24px 16px !important;
    }

    .nav-item-group.is-open .nav-item-label i {
        transform: rotate(0deg) !important;
        color: var(--color-primary) !important;
    }

    .nav-sub-menu li a {
        color: #475569 !important;
        padding: 12px 0 !important;
        display: block !important;
        font-size: 14px !important;
        border-bottom: 1px solid rgba(0,0,0,0.03);
        text-decoration: none !important;
    }

    .header-inner {
        flex-wrap: nowrap !important;
        height: 100% !important;
        padding: 0 var(--space-md) !important;
        gap: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .header-right {
        flex-shrink: 0 !important;
        gap: 12px !important;
        display: flex !important;
        align-items: center !important;
    }

    .logo-text { 
        font-size: 16px !important; 
        white-space: nowrap !important;
    }
    
    .mobile-menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 38px !important;
        height: 38px !important;
        background: rgba(255,255,255,0.15) !important;
        border-radius: 8px !important;
        margin-left: 4px !important;
        color: #FFFFFF !important;
        border: none !important;
        cursor: pointer !important;
        flex-shrink: 0 !important;
    }

    .mobile-menu-toggle i {
        width: 22px !important;
        height: 22px !important;
        color: #FFFFFF !important;
    }

    .home-link { display: none !important; } 

    /* 手機版搜尋框極簡化 */
    .header-search-mini {
        width: 36px !important;
        padding: 0 !important;
        background: none !important;
        border: none !important;
        justify-content: center;
    }
    .search-input-mini { display: none; }
    .header-search-mini:focus-within {
        position: absolute;
        right: 15px;
        width: 180px !important;
        background: #fff !important;
        padding: 4px 12px !important;
        border-radius: 20px !important;
        z-index: 4000;
    }
    .header-search-mini:focus-within .search-input-mini {
        display: block;
        color: #333;
    }

    .mobile-only { display: block !important; }
}

/* 遮罩層 */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.menu-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

/* 綜合修正 */
/* 將 .mobile-only 移至上方或確保不覆蓋 RWD */


/* ── 英雄區塊 (Hero Section) ── */
.home-hero {
    position: relative;
    width: 100%;
    min-height: 480px;
    display: flex;
    align-items: center;
    background-color: #002244;
    background-image: linear-gradient(rgba(0, 34, 68, 0.7), rgba(0, 34, 68, 0.7)), url('../../images/store_hero_bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: #fff;
    padding: 100px 0 60px 0;
    margin-bottom: 20px;
}

.hero-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-xl);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    width: 100%;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-subtitle {
    color: #bfdbfe;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    margin-bottom: 16px;
    display: block;
}

.hero-title {
    font-size: 52px;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 24px;
    text-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.hero-desc {
    font-size: 19px;
    color: #f0f9ff;
    line-height: 1.6;
    margin-bottom: 32px;
    max-width: 90%;
}

.hero-visual {
    position: relative;
    display: flex;
    justify-content: center;
}

.float-img {
    position: relative;
    z-index: 10;
    animation: heroFloat 4s ease-in-out infinite;
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.15);
    max-width: 100%;
}

@keyframes heroFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@media (max-width: 992px) {
    .hero-inner {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 40px;
    }
    .hero-content {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .hero-visual {
        display: none;
    }
    .hero-title { font-size: 38px; }
}

/* AI 諮詢按鈕共用 */
.btn-ai-consult {
    background: #ffffff;
    color: #002244;
    font-size: 16px;
    font-weight: 800;
    padding: 14px 32px;
    border-radius: 9999px;
    border: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}
.btn-ai-consult:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    background: #e0f2fe;
}
.btn-ai-consult:active {
    transform: scale(0.98);
}

/* AI 提示彈窗共用 */
.ai-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: 9999;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
}
.ai-modal-content {
    background: #fff;
    border-radius: 30px;
    padding: 40px;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
    position: relative;
    animation: fadeInUp 0.4s ease;
}
.ai-modal-content h3 {
    font-size: 24px;
    font-weight: 800;
    color: #111827;
    margin: 16px 0;
}
.ai-modal-content p {
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 30px;
}
.ai-modal-btn-confirm {
    display: block;
    width: 100%;
    padding: 16px 0;
    color: #003366;
    font-weight: 800;
    font-size: 18px;
    border: 2px solid #003366;
    border-radius: 16px;
    text-decoration: none;
    transition: background 0.2s;
    margin-bottom: 12px;
}
.ai-modal-btn-confirm:hover {
    background: #f0f9ff;
}
.ai-modal-btn-cancel {
    width: 100%;
    padding: 8px 0;
    color: #003366;
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
}
.ai-modal-btn-cancel:hover {
    text-decoration: underline;
}
