/* --- Root Variables: Minimalist Dark Theme --- */
:root {
    --bg-color: #050505;        /* 極深背景 */
    --card-bg: #111111;        /* 卡片深灰 */
    --text-color: #E6EDF3;
    --muted-text: #6e7681;
    --border-color: rgba(255, 255, 255, 0.08);
    --highlight-color: #00FFA3; /* 品牌螢光綠 */
    --accent-blue: #58A6FF;
    --price-up: #00FFA3;
    --price-down: #ff4d4d;
}

body.light-mode {
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #1a1a1a;
    --muted-color: #6c757d;
    --border-color: rgba(0, 0, 0, 0.1);
}

/* 基礎設定 */
body.light-mode header,
body.light-mode .navbar {
    background-color:  rgba(248, 249, 250, 0.9) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
}

body.light-mode .text-gray-500,
body.light-mode .text-gray-400 {
    color: #495057 !important; 
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', sans-serif;
    margin: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* 當父容器 group 被 hover 時，在按鈕下方建立隱形橋樑 */
.group:hover #navbarDropdown::after {
    content: "";
    position: absolute;
    top: 100%;  
    left: 0;
    width: 100%; 
    height: 20px;   
    background: transparent;
    z-index: 10; 
}

#yearDropdown {
    margin-top: 8px;
}

/* --- 跑馬燈動畫 (保留並優化) --- */
.latest-price-section {
    overflow: hidden;
    width: 100%;
    padding: 12px 0;
    background-color: #0a0a0a;
    border-bottom: 1px solid var(--border-color);
}

.price-marquee {
    display: flex;
    width: max-content;
    animation: marquee-infinite 30s linear infinite;
}

.price-marquee:hover {
    animation-play-state: paused;
}

.price-lists {
    display: flex;
    gap: 0; /* 改由 item padding 控制 */
    list-style: none;
    margin: 0;
    padding: 0;
}

.price-lists .item {
    display: flex;
    align-items: center;
    white-space: nowrap;
    padding: 0 40px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

@keyframes marquee-infinite {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

.price-up { color: var(--price-up); font-weight: bold; }
.price-down { color: var(--price-down); font-weight: bold; }

/* --- 導航欄與 Header --- */
.navbar {
    background-color: rgba(5, 5, 5, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
}

.logo-box { width: 130px; }
.logo-box img { width: 100%; filter: brightness(1.1); }

.navbar-brand {
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--highlight-color) !important;
    text-shadow: 0 0 15px rgba(0, 255, 163, 0.3);
}

/* --- 新聞卡片佈局 (極簡化) --- */
.main-news-card {
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.main-news-card .news-card-img {
    border-radius: 12px;
    transition: transform 0.8s ease;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.main-news-card:hover .news-card-img {
    transform: scale(1.02);
}

.content-wrapper .news-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
    height: 100%;
}

.content-wrapper .news-card:hover {
    border-color: var(--highlight-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px -10px rgba(0, 255, 163, 0.2);
}

.news-card img {
    height: 220px;
    width: 100%;
    object-fit: cover;
    border-bottom: 1px solid var(--border-color);
}

.news-title {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 1rem;
}

.news-meta {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted-text);
}

/* --- 側邊欄排行榜 --- */
.news-ticker {
    background-color: rgba(17, 17, 17, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.news-ticker.disabled {
    display: none !important;
}

.news-ticker h6 {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.news-ticker li {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

/* --- 詳情頁 (Detail Page) 優化 --- */
.img-box {
    border-radius: 16px;
    overflow: hidden;
    margin: 3rem 0;
    border: 1px solid var(--border-color);
}
/* --- 分頁器 --- */
#pagination .page-link {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--muted-text);
    margin: 0 4px;
    border-radius: 4px;
}

#pagination .page-item.active .page-link {
    background: var(--highlight-color);
    color: #000;
    border-color: var(--highlight-color);
}

/* --- 響應式微調 (保留您的斷點) --- */
@media (max-width: 992px) {
    .content-wrapper { margin-right: 0 !important; }
    .news-ticker { position: relative; width: 100%; height: auto; border-radius: 0; border: none; border-top: 1px solid var(--border-color); }
}

@media (max-width: 768px) {
    .navbar-brand { font-size: 0.9rem; letter-spacing: 2px; }
    .main-news-card h2 { font-size: 1.8rem; }
}