/* =========================================
   1. General Styles (共用基礎設定)
========================================= */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f4f6f9;
    margin: 0;
    color: #333;
}

/* =========================================
   2. Login Page Specifics (登入頁專屬)
========================================= */
.login-body {
    background-color: #121212;
    color: white;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-box {
    background: #1e1e1e;
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    width: 85%;
    max-width: 400px;
    text-align: center;
}

.login-box h1 { margin-top: 0; font-size: 28px; color: #4facfe; margin-bottom: 30px; }

.login-box input[type="password"] {
    width: 100%; padding: 15px; margin-bottom: 25px; border-radius: 8px;
    border: 1px solid #333; background: #2c2c2c; color: white; font-size: 20px;
    box-sizing: border-box; text-align: center;
}

.login-box button {
    width: 100%; padding: 15px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white; border: none; border-radius: 8px; font-size: 20px;
    font-weight: bold; cursor: pointer; transition: 0.3s;
}

.login-box button:active { transform: scale(0.98); }

/* =========================================
   3. Header & Navigation (儀表板與總結共用)
========================================= */
.header {
    background-color: #1e293b; color: white; padding: 15px;
    text-align: center; position: sticky; top: 0; z-index: 100;
    display: flex; justify-content: center; align-items: center; gap: 10px;
}
/* 如果沒有 flex 需求，也可覆蓋，視頁面而定 */

.header h2 { margin: 0; font-size: 20px; }
.snapshot-time { font-size: 12px; color: #94a3b8; margin-top: 5px; }

.scroll-nav {
    display: flex; overflow-x: auto; background: white; padding: 10px;
    border-bottom: 1px solid #e2e8f0; white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}
.scroll-nav::-webkit-scrollbar { display: none; }

.btn-race {
    display: inline-block; padding: 10px 10px; margin-right: 8px;
    border-radius: 20px; background-color: #f1f5f9; color: #475569;
    text-decoration: none; font-size: 14px; font-weight: 500;
    min-width: 45px; text-align: center; transition: 0.2s;
}
.btn-race.active { background-color: #3b82f6; color: white; box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.5); }

/* =========================================
   4. Tables (儀表板專屬 & 現代化數據表格)
========================================= */
.custom-table-wrapper {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: right; /* 數字預設向右對齊，方便比對位數 */
}

.custom-table th, .custom-table td {
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
}

.custom-table th {
    background-color: #f8fafc;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    cursor: pointer;
}

.custom-table tbody tr:hover {
    background-color: #f8fafc;
}

/* 第一欄 (策略名稱) 向左對齊 */
.custom-table td:first-child,
.custom-table th:first-child {
    text-align: left;
    font-weight: 600;
    color: #334155;
}

/* 獲利與虧損的數值顏色 */
.text-profit-pos { color: #10b981; font-weight: 700; }
.text-profit-neg { color: #ef4444; font-weight: 700; }
.text-neutral { color: #94a3b8; }

h3.section-title {
    font-size: 1.15rem;
    color: #0f172a;
    border-left: 4px solid #3b82f6;
    padding-left: 12px;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* 排序小圖標 */
.sort-icon { font-size: 0.8em; margin-left: 5px; color: #cbd5e1; }

/* =========================================
   5. Summary Specifics (總結頁注單卡片)
========================================= */
.bet-card {
    background: white; padding: 15px; border-radius: 12px;
    margin-bottom: 15px; box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-left: 5px solid #3b82f6;
}
.bet-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.race-badge { background: #e2e8f0; padding: 4px 8px; border-radius: 6px; font-size: 12px; font-weight: bold; color: #475569; }
.bet-strategy { font-weight: bold; color: #1e293b; }
.bet-selections { font-size: 18px; letter-spacing: 1px; color: #0f172a; margin-bottom: 10px; word-wrap: break-word; }
.bet-footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid #f1f5f9; padding-top: 10px; }
.bet-invested { color: #64748b; font-size: 14px; }
.pending { color: #f59e0b; font-weight: bold; font-size: 14px; }o

/* =========================================
   6. Layout & Utilities (排版與通用工具)
========================================= */
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

/* 注單卡片網格 (Dashboard 使用) */
.bets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* 退賽馬匹專屬提示框 */
.scratched-box {
    background: #fef2f2;
    border-left: 4px solid #ef4444;
    padding: 12px 16px;
    border-radius: 8px;
    color: #991b1b;
    margin-bottom: 20px;
    font-weight: 500;
    font-size: 0.95rem;
}
.scratched-item {
    display: inline-block;
    background: #fee2e2;
    padding: 4px 10px;
    border-radius: 20px;
    margin-right: 8px;
    margin-top: 4px;
    font-size: 0.85rem;
}

/* =========================================
   7. Header Info Badges (頂部導航膠囊)
========================================= */
.header-info {
    display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; margin: 0;
}
.info-badge {
    background: #334155; color: #f8fafc; padding: 5px 12px;
    border-radius: 8px; font-size: 0.95rem; font-weight: 500;
    border: 1px solid #475569; letter-spacing: 0.5px;
}
.badge-highlight {
    background: #3b82f6; border-color: #2563eb; color: white; font-weight: bold;
}
