/* static/css/style.css */
/* 最後更新：整合 8890 品牌元素與雷達風格 (v2.0) */

:root {
    /* --- 核心色系 --- */
    --primary-color: #2c3e50;       /* 深藍灰 (通用主色) */
    --radar-blue: #1e4b8a;          /* 雷達藍 (Hero 背景主色) */
    --radar-dark: #102a52;          /* 雷達深藍 (漸層用) */
    
    /* --- 功能色系 --- */
    --accent-color: #dc3545;        /* 紅色 (降價/特價/重點) */
    --highlight-color: #ffc107;     /* 亮黃色 (8890 品牌/視覺喚醒) */
    --trend-up: #198754;            /* 綠色 (漲價/庫存充足) */
    
    /* --- 介面色系 --- */
    --bg-color: #f4f6f9;            /* 全站背景 (淺灰，對比卡片白) */
    --card-bg: #ffffff;
    --text-main: #333333;
    --text-muted: #6c757d;
    
    /* --- 數值變數 --- */
    --radius-md: 10px;              /* 卡片圓角 */
    --radius-lg: 30px;              /* Banner 圓角 */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-hover: 0 8px 16px rgba(0,0,0,0.12);
}

/* =========================================
   1. 全站基礎設定 (Reset & Typography)
   ========================================= */
body, button, input, select, textarea, table {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    padding-top: 70px; /* 避開 Navbar */
    font-size: 0.95rem;
    line-height: 1.6;
}

/* 連結去底線 */
a { text-decoration: none; color: inherit; transition: color 0.2s; }
a:hover { color: var(--radar-blue); }

/* =========================================
   2. 導覽列 (Navbar)
   ========================================= */
.navbar-custom {
    background-color: var(--radar-dark) !important; /* 更深沈專業的藍 */
    padding: 0.8rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.navbar-custom .navbar-brand {
    color: #fff !important;
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
}

/* 導覽列上的黃色圖示 */
.navbar-brand i { color: var(--highlight-color); }

/* =========================================
   3. Hero Banner (首頁主視覺 - 雷達風格)
   ========================================= */
.hero-banner {
    /* 科技感深藍漸層 */
    background: linear-gradient(135deg, var(--radar-dark) 0%, var(--radar-blue) 100%);
    color: white;
    padding: 3.5rem 1rem;
    margin-bottom: 2rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg); /* 下方大圓角 */
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

/* 裝飾背景圓圈 (增加層次感) */
.hero-banner::before {
    content: '';
    position: absolute;
    top: -50%; left: -10%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* 8890 品牌標籤 (膠囊狀) */
.brand-tag {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    vertical-align: middle;
    margin-right: 8px;
    color: var(--highlight-color); /* 品牌黃 */
    font-family: 'Roboto', sans-serif;
    letter-spacing: 1px;
    backdrop-filter: blur(2px);
}

/* 主標題 */
.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0.8rem 0;
    letter-spacing: 1px;
    text-shadow: 0 4px 10px rgba(0,0,0,0.4); /* 增加文字陰影，提升辨識度 */
}

/* 高亮文字 (用於 "雷達" 或 "特價") */
.text-highlight {
    color: var(--highlight-color);
    position: relative;
    display: inline-block;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 2rem;
    font-weight: 300;
}

/* =========================================
   4. 搜尋框與按鈕
   ========================================= */
.search-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-input {
    height: 55px;
    border-radius: 30px;
    padding-left: 1.5rem;
    padding-right: 3.5rem;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 1); /* 純白背景 */
}

.search-input:focus {
    box-shadow: 0 0 0 4px rgba(255, 193, 7, 0.3); /* 聚焦時發黃光 */
}

.search-btn {
    position: absolute;
    top: 5px; right: 5px;
    height: 45px; width: 45px;
    border-radius: 50%;
    background: var(--radar-blue); /* 搜尋按鈕用深藍，與黃色形成對比 */
    color: white;
    border: none;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    cursor: pointer;
}

.search-btn:hover {
    background: var(--highlight-color);
    color: #333;
    transform: rotate(15deg);
}

/* =========================================
   5. 商品卡片 (Product Card) - 去電商化設計
   ========================================= */
.card-box {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    height: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.card-box:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(0,0,0,0.1);
}

/* 圖片區塊 */
.product-img-wrapper {
    position: relative;
    height: 200px;
    padding: 20px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #f8f9fa;
}

.product-img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    transition: transform 0.3s;
}

.card-box:hover .product-img { transform: scale(1.05); }

/* 卡片文字內容 */
.product-body {
    padding: 1.2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-meta {
    font-size: 0.8rem;
    color: #95a5a6;
    margin-bottom: 0.5rem;
    font-family: monospace;
}

.product-title {
    font-size: 1.0rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.8rem;
    /* 限制顯示兩行 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 3em; 
    line-height: 1.5;
}

/* 價格顯示區 */
.price-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-top: auto; /* 將價格推到底部 */
    padding-top: 0.8rem;
    border-top: 1px solid #f8f9fa;
}

.price-label {
    font-size: 0.75rem;
    color: #999;
    margin-bottom: -2px;
}

.price-main {
    color: var(--accent-color);
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1;
    font-family: 'Roboto', sans-serif;
}

/* 動作按鈕區 (查看走勢) */
.action-row {
    margin-top: 1rem;
}

.btn-trend {
    width: 100%;
    background-color: #fff;
    color: var(--radar-blue);
    border: 1px solid #dee2e6;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-trend:hover {
    background-color: var(--radar-blue);
    color: #fff;
    border-color: var(--radar-blue);
}

/* =========================================
   6. 標籤與徽章 (Badges)
   ========================================= */
/* 歷史低價 (金牌) */
.badge-lowest {
    position: absolute; top: 10px; left: 10px;
    background: linear-gradient(45deg, #f1c40f, #f39c12);
    color: #fff;
    padding: 4px 10px;
    font-size: 0.8rem;
    border-radius: 4px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 10;
    animation: pulse 2s infinite; /* 呼吸燈效果 */
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 降價幅度 */
.badge-discount {
    background-color: #ffeaea;
    color: var(--accent-color);
    border: 1px solid #ffc9c9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 6px;
    vertical-align: middle;
}

/* 缺貨遮罩 */
.oos-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.6);
    z-index: 5;
    display: flex; align-items: center; justify-content: center;
}

.oos-badge {
    background: rgba(50, 50, 50, 0.8);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
}

/* =========================================
   7. 互動元件 (Buttons & Icons)
   ========================================= */
/* 收藏愛心按鈕 (圓形) */
.btn-fav {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 1px solid #eee;
    background: rgba(255, 255, 255, 0.9);
    color: #ccc;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    cursor: pointer;
    font-size: 1rem;
}

.btn-fav:hover {
    transform: scale(1.1);
    color: var(--accent-color);
    border-color: #ffc9c9;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn-fav.active {
    color: var(--accent-color);
    border-color: #ffc9c9;
    background: #fff0f0;
}

/* 定位工具 */
.pos-top-right { position: absolute; top: 10px; right: 10px; z-index: 20; }
.pos-top-left { position: absolute; top: 10px; left: 10px; z-index: 20; }

/* LINE 分享按鈕 (綠色) */
.btn-share-line {
    background: #06c755;
    color: white !important;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid #eee; z-index: 20;
    border-radius: 50%;
    transition: all 0.2s ease;
}
.btn-share-line:hover {
    background: #05b34c;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(6, 199, 85, 0.3) !important;
}

/* =========================================
   8. 圖表 Modal 與其他頁面元件
   ========================================= */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.modal-header-custom {
    border-bottom: 1px solid #eee;
    background-color: #f8f9fa;
}

/* 頁尾 Footer */
footer {
    background: #fff;
    color: var(--text-muted);
}

/* 隱藏卷軸但可捲動 (Utility) */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* =========================================
   9. RWD 手機版優化
   ========================================= */
@media (max-width: 576px) {
    .hero-banner {
        padding: 2.5rem 1rem; /* 手機版 Banner 稍微縮小 */
        border-radius: 0 0 20px 20px;
    }
    
    .hero-title {
        font-size: 1.8rem; /* 手機版標題縮小 */
    }
    
    .search-input {
        height: 45px; /* 手機版搜尋框縮小 */
        font-size: 1rem;
    }
    .search-btn {
        height: 35px; width: 35px;
        top: 5px; right: 5px;
    }
    
    .card-box .product-img-wrapper {
        height: 140px; /* 手機版圖片區縮小 */
        padding: 10px;
    }
    
    .product-body {
        padding: 0.8rem;
    }
    
    .price-main {
        font-size: 1.1rem;
    }
    
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }
}