/**
 * 字體大小統一修正樣式
 * Font Size Consistency Fix
 * 
 * 使用 rem 單位，方便在不同裝置調整
 * 只需修改 html 的 font-size，所有字體自動縮放
 * 
 * 基準：html font-size = 15px（全站統一）
 * 
 * 字體大小規範：
 * - xs:   0.778rem = 11.7px
 * - sm:   0.889rem = 13.3px  
 * - base: 1rem     = 15px（基礎正文）
 * - md:   1.111rem = 16.7px
 * - lg:   1.333rem = 20px
 * - xl:   1.556rem = 23.3px
 * - 2xl:  1.778rem = 26.7px
 * - 3xl:  2rem     = 30px
 */

/* ==================== 根元素字體大小 ==================== */
html {
    /* 全站統一基準：15px */
    font-size: 15px;
}

/* 小螢幕手機 */
@media (max-width: 375px) {
    html {
        font-size: 14px;
    }
}

/* ==================== CSS 變數 ==================== */
:root {
    /* 字體家族 - 微軟正黑體，清晰易讀 */
    --font-family-base: "Microsoft JhengHei UI", "Microsoft JhengHei", "微軟正黑體", "Noto Sans TC", "PingFang TC", "Heiti TC", sans-serif;
    --font-family-bold: "Microsoft JhengHei UI Bold", "Microsoft JhengHei Bold", "微軟正黑體 Bold", "Noto Sans TC Bold", sans-serif;
    
    /* 字體大小 - 全部使用 rem */
    --font-size-xs: 0.778rem;    /* 14px @18px base */
    --font-size-sm: 0.889rem;    /* 16px @18px base */
    --font-size-base: 1rem;      /* 18px @18px base */
    --font-size-md: 1.111rem;    /* 20px @18px base */
    --font-size-lg: 1.333rem;    /* 24px @18px base */
    --font-size-xl: 1.556rem;    /* 28px @18px base */
    --font-size-2xl: 1.778rem;   /* 32px @18px base */
    --font-size-3xl: 2rem;       /* 36px @18px base */
    
    /* 行高 */
    --line-height-tight: 1.3;
    --line-height-base: 1.6;
    --line-height-relaxed: 1.8;
}

/* ==================== 全站基礎樣式 ==================== */
body {
    font-family: var(--font-family-base) !important;
    font-size: var(--font-size-base) !important;
    line-height: var(--line-height-base);
    font-weight: 500;
    color: #1a1a1a !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== 標題 ==================== */
h1, .h1 {
    font-size: var(--font-size-3xl) !important;
    font-family: var(--font-family-bold) !important;
    font-weight: 700 !important;
    line-height: var(--line-height-tight);
}

h2, .h2 {
    font-size: var(--font-size-2xl) !important;
    font-family: var(--font-family-bold) !important;
    font-weight: 700 !important;
    line-height: var(--line-height-tight);
}

h3, .h3 {
    font-size: var(--font-size-xl) !important;
    font-family: var(--font-family-bold) !important;
    font-weight: 700 !important;
    line-height: var(--line-height-tight);
}

h4, .h4 {
    font-size: var(--font-size-lg) !important;
    font-family: var(--font-family-bold) !important;
    font-weight: 700 !important;
}

h5, .h5 {
    font-size: var(--font-size-md) !important;
    font-family: var(--font-family-bold) !important;
    font-weight: 700 !important;
}

h6, .h6 {
    font-size: var(--font-size-base) !important;
    font-family: var(--font-family-bold) !important;
    font-weight: 700 !important;
}

/* ==================== 正文內容 ==================== */
p, li, span, div {
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
}

/* ==================== 小字體元素 ==================== */
.small, small,
.text-muted,
.stat-hint,
.stat-detail,
.stat-label,
.badge,
.signal-tag,
.pool-indicator,
.intensity-label,
.intensity-detail,
.combo-signal,
.longshot-count,
.no-signal,
.indicator-desc,
.download-hint,
.last-updated-text,
.race-detail,
.ih-score-desc,
.u-stat-hint,
.u-stat-label {
    font-size: var(--font-size-xs) !important;
    font-weight: 500;
}

/* ==================== 次要內容 ==================== */
.card-body,
.alert,
.dropdown-item,
.list-group-item,
.form-label,
.horse-summary,
.confidence-signals,
.signal-detail,
.odds-change,
.combo-name,
.pool-count,
.breakdown-label {
    font-size: var(--font-size-sm) !important;
}

/* ==================== 強調內容 ==================== */
.card-title,
.section-block h3,
.alert-heading,
.confidence-amount,
.race-title {
    font-size: var(--font-size-md) !important;
    font-weight: 700;
}

/* ==================== 統計數值 ==================== */
.stat-value,
.u-stat-value {
    font-size: var(--font-size-xl) !important;
    font-weight: 700;
    font-family: var(--font-family-bold) !important;
    letter-spacing: 0.5px;
}

/* ==================== 表格 ==================== */
.table,
.data-table,
.summary-table,
.big-bet-table,
.race-table,
.bet-sim-table {
    font-size: var(--font-size-sm) !important;
}

.table th,
.data-table th,
.summary-table th,
.big-bet-table th,
.race-table th,
.bet-sim-table th {
    font-size: var(--font-size-xs) !important;
    font-weight: 700;
    font-family: var(--font-family-bold) !important;
}

.table td,
.data-table td,
.summary-table td,
.big-bet-table td,
.race-table td,
.bet-sim-table td {
    font-size: var(--font-size-sm) !important;
    padding: 0.4rem 0.35rem !important;
    line-height: var(--line-height-base);
}

/* ==================== 導航 ==================== */
.navbar-brand {
    font-size: var(--font-size-md) !important;
    font-weight: 700;
    font-family: var(--font-family-bold) !important;
}

.nav-link {
    font-size: var(--font-size-base) !important;
    font-weight: 600;
}

.dropdown-item {
    font-size: var(--font-size-sm) !important;
    font-weight: 500;
    padding: 0.5rem 0.8rem !important;
}

/* Tab 導航 */
.analysis-tab-btn,
.tab-btn,
.nav-tabs .nav-link {
    font-size: var(--font-size-sm) !important;
    font-weight: 600;
}

/* ==================== 按鈕 ==================== */
.btn {
    font-size: var(--font-size-base) !important;
    font-weight: 600;
    padding: 0.4rem 0.8rem !important;
    min-height: 2rem;
}

.btn-sm {
    font-size: var(--font-size-xs) !important;
    font-weight: 600;
    padding: 0.3rem 0.6rem !important;
    min-height: 1.6rem;
}

.btn-lg {
    font-size: var(--font-size-md) !important;
    font-weight: 700;
    padding: 0.5rem 1rem !important;
}

/* ==================== 表單 ==================== */
.form-control,
.form-select,
input,
select,
textarea {
    font-size: var(--font-size-base) !important;
    font-weight: 500;
    padding: 0.4rem 0.6rem !important;
    min-height: 2rem;
}

.form-label,
label {
    font-size: var(--font-size-sm) !important;
    font-weight: 600;
}

/* ==================== 卡片 ==================== */
.card-header {
    font-size: var(--font-size-base) !important;
    font-weight: 600;
    padding: 0.6rem 0.8rem !important;
}

.card-body {
    padding: 0.8rem !important;
}

/* ==================== 徽章 ==================== */
.badge {
    padding: 0.2rem 0.4rem !important;
    font-weight: 600;
}

.horse-badge,
.horse-number {
    font-size: var(--font-size-sm) !important;
    font-weight: 700;
    min-width: 1.556rem;
    min-height: 1.556rem;
}

/* ==================== 列表 ==================== */
.list-group-item {
    padding: 0.6rem 0.8rem !important;
}

/* ==================== 連結 ==================== */
a:not(.btn):not(.nav-link):not(.dropdown-item) {
    color: #0056b3;
    text-decoration: underline;
    text-underline-offset: 0.167rem;
}

a:not(.btn):not(.nav-link):not(.dropdown-item):hover {
    color: #003d80;
    text-decoration-thickness: 2px;
}

/* ==================== Footer ==================== */
.footer h6 {
    font-size: var(--font-size-sm) !important;
}

.footer p,
.footer a,
.footer .small {
    font-size: var(--font-size-xs) !important;
}

/* ==================== 頁面特定 ==================== */

/* Big Bet Analysis */
.big-bet-analysis .race-title {
    font-size: var(--font-size-md) !important;
}

.big-bet-analysis .quick-stat {
    font-size: var(--font-size-sm) !important;
}

/* IH Analytics */
.ih-analytics .card h2 {
    font-size: var(--font-size-md) !important;
}

.ih-analytics .ih-badge,
.ih-analytics .ih-index-badge {
    font-size: var(--font-size-sm) !important;
    font-weight: 700;
}

/* Dashboard */
.race-card-title {
    font-size: var(--font-size-md) !important;
    font-weight: 700;
}

/* ==================== 手機版底部導航 ==================== */
.mobile-bottom-nav a {
    font-size: var(--font-size-xs) !important;
}

.mobile-bottom-nav a span {
    font-size: 0.667rem !important; /* 稍小，節省空間 */
}

/* ==================== 覆蓋舊樣式 ==================== */
.u-stat-hint {
    font-size: var(--font-size-xs) !important;
}

.navbar-nav .badge {
    font-size: var(--font-size-xs) !important;
    font-weight: 600;
}

.pool-indicator {
    font-size: var(--font-size-xs) !important;
    font-weight: 600;
}
