/* --- 1. 標準色系設定 --- */
:root {
    /* 核心品牌色 */
    --cal-navy: #002663;        /* 標準深藍 */
    --cal-blue-hover: #003380;  /* 按鈕 Hover 深藍 */
    --cal-light-bg: #f5f7fa;    /* 淺灰藍背景 */
    
    /* 介面色 */
    --bg-gradient-top: #f0f4f8;
    --bg-gradient-bot: #dfe7ef;
    --card-bg: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --divider-color: #e5e5ea;
    
    /* 陰影優化 */
    --card-shadow: 0 12px 40px rgba(0, 38, 99, 0.08);
    --btn-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

/* --- 2. 全局設定 --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Microsoft JhengHei", "微軟正黑體", sans-serif;
    background: linear-gradient(180deg, var(--bg-gradient-top) 0%, var(--bg-gradient-bot) 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text-primary);
}

a { text-decoration: none; }

/* --- 3. 頂部導航 --- */
.top-bar {
    position: absolute; /* 關鍵：讓它浮起來，不佔據高度 */
    top: 12px;          /* 距離卡片頂部(藍條下方)的距離 */
    left: 0;
    width: 100%;        /* 寬度撐滿卡片 */
    padding: 0 25px;    /* 左右留白，對齊卡片邊緣 */
    
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    z-index: 10;        /* 確保它在最上層，可以被點擊 */
}

.logout-btn {
    color: #e67e22;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: opacity 0.2s;
}
.logout-btn:hover { opacity: 0.7; }

/* --- 4. 主卡片容器 --- */
.main-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.card {
    position: relative; /* 關鍵：讓內部的 absolute 元素以這張卡片為邊界 */
    background: var(--card-bg);
    width: 100%;
    max-width: 480px;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    padding: 40px 32px; /* 維持原本內距 */
    text-align: center;
    border-top: 6px solid var(--cal-navy);
}

/* --- 5. Logo 與標題 --- */
.logo-link {
    display: inline-block;
    margin-bottom: 12px;
}

.logo {
    max-width: 200px; 
    width: 100%;       
    height: auto;      
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.card-header h1 {
    font-size: 22px;
    color: var(--cal-navy);
    margin-bottom: 4px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 25px;
    font-weight: 600;
}

/* --- 6. 分類排版 (方案二核心樣式) --- */

.link-container {
    text-align: left; /* 讓內容靠左對齊 */
}

.section-group {
    margin-bottom: 5px;
}

.section-title {
    font-size: 11px;
    color: #999;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 10px 4px; /* 對齊按鈕邊緣 */
}

.divider {
    height: 1px;
    background: var(--divider-color);
    margin: 20px 0;
}

/* 格線佈局系統 */
.grid-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.grid-cols {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 兩欄 */
    gap: 12px;
}

/* --- 7. 按鈕樣式 --- */
.sys-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 10px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    text-align: center;
    min-height: 46px; /* 確保雙欄高度一致 */
}

/* A. 主要按鈕 (深藍實心) */
.primary-btn {
    background-color: var(--cal-navy);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 38, 99, 0.2);
    font-weight: 600;
    font-size: 15px;
}
.primary-btn:hover {
    background-color: var(--cal-blue-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(0, 38, 99, 0.25);
}

/* B. 次要按鈕 (線框) */
.secondary-btn {
    background-color: transparent;
    color: var(--cal-navy);
    border: 1px solid #cdd6e0;
}
.secondary-btn:hover {
    border-color: var(--cal-navy);
    background-color: #f8faff;
}

/* C. 一般功能按鈕 (白色卡片) */
.normal-btn {
    background-color: #fff;
    color: #333;
    border: 1px solid #eaeff5;
    box-shadow: var(--btn-shadow);
}
.normal-btn:hover {
    border-color: var(--cal-navy);
    color: var(--cal-navy);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    z-index: 1;
}

/* --- 8. 手機版響應式優化 --- */
@media (max-width: 480px) {
    .card {
        padding: 30px 20px;
        background: rgba(255, 255, 255, 0.9); /* 手機版稍微透明一點 */
        box-shadow: none; 
        border-top: none;
    }
    
    .grid-cols {
        grid-template-columns: 1fr; /* 手機版變回單欄，方便點擊 */
        gap: 10px;
    }
    
    .logo { max-width: 160px; }

    .top-bar {
        position: relative; /* 手機上取消懸浮，避免重疊 */
        margin-bottom: 10px;
        top: 0;
        padding: 0;
    }
}

/* --- 9. 錯誤訊息 --- */
.warning-text {
    position: fixed;
    bottom: 15px;
    right: 15px;
    font-size: 12px;
    color: #e74c3c;
    font-weight: bold;
    background: rgba(255,255,255,0.95);
    padding: 6px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* 10. 隱藏瀏覽器預設的數字箭頭 (Chrome, Safari, Edge, Firefox) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield; /* Firefox */
}

/* 11. 通用輸入框 */
.input-field {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    color: var(--text-primary);
    background-color: #fff;
    outline: none;
    transition: all 0.2s;
}
.input-field:focus {
    border-color: var(--cal-navy);
    box-shadow: 0 0 0 2px rgba(0, 38, 99, 0.1);
}

/* 12. 場站標籤 (維持不變，微調間距) */
.quick-select-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.tag-btn {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 20px; /* 改為橢圓形較現代 */
    border: 1px solid #e5e7eb;
    background-color: #fff;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}
.tag-btn:hover { background-color: #f3f4f6; color: #111; border-color: #ccc; }
.tag-btn.tw-station { color: #e67e22; background: #fffaf0; border-color: #ffe0b2; }
.tag-btn.tw-station:hover { background: #ffe0b2; }
.tag-btn.jp-station { color: #27ae60; background: #f0fdf4; border-color: #bbf7d0; }
.tag-btn.jp-station:hover { background: #bbf7d0; }

/* 13. [重構] 時間選擇區塊 */
.time-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
/* 天數選擇 Pill (小藥丸樣式) */
.days-pills {
    display: flex;
    gap: 5px;
}
.days-pills span {
    font-size: 11px;
    background: #f1f3f5;
    color: #666;
    padding: 3px 8px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
.days-pills span:hover {
    background: var(--cal-navy);
    color: #fff;
}

/* 時間調整列 */
.time-adjust-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #fff; /* 純白背景 */
    padding: 0;
}

/* 按鈕群組 */
.btn-group {
    display: flex;
    gap: 6px;
}

.adj-btn {
    width: 38px;
    height: 34px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}
.adj-btn:active { transform: scale(0.95); }

/* 減少 (-) 按鈕: 淺灰 */
.adj-btn.dec {
    background-color: #f1f3f5;
    color: #495057;
}
.adj-btn.dec:hover { background-color: #e9ecef; color: #000; }

/* 增加 (+) 按鈕: 淺藍 */
.adj-btn.inc {
    background-color: #e7f5ff;
    color: var(--cal-navy);
}
.adj-btn.inc:hover { background-color: #d0ebff; }

/* 中央輸入顯示 */
.input-display {
    position: relative;
    flex: 1; /* 佔滿中間 */
    display: flex;
    justify-content: center;
    align-items: center;
}
.clean-input {
    width: 60px;
    border: none;
    border-bottom: 2px solid #e9ecef; /* 只留底線 */
    font-size: 20px;
    font-weight: bold;
    color: var(--cal-navy);
    text-align: center;
    padding: 0;
    background: transparent;
    outline: none;
}
.clean-input:focus {
    border-color: var(--cal-navy);
}
.unit {
    font-size: 12px;
    color: #adb5bd;
    margin-left: 2px;
    margin-top: 6px;
}

/* 14. [重構] 頁數控制 (置中) */
.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: center; /* 關鍵：置中 */
    gap: 15px; /* 元素間距 */
    margin-top: 5px;
}

.page-arrow {
    background: transparent;
    border: none;
    color: #86868b;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.page-arrow:hover {
    background-color: #f1f3f5;
    color: var(--cal-navy);
}

.page-input {
    width: 50px;
    height: 40px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: var(--text-primary);
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    outline: none;
}

/* 15. 間距與其他 */
.spacer-sm { height: 18px; }

.error-msg {
    color: #e74c3c;
    background: #fde8e8;
    padding: 10px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 13px;
    display: flex;
    align-items: center;
}

/* --- 16. 新增：場站查詢下拉選單樣式 --- */

.search-wrapper {
    position: relative; /* 讓下拉選單以此為定位基準 */
    width: 100%;
}

/* 觸發按鈕 (放在 input 右側) */
.dropdown-trigger-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}
.dropdown-trigger-btn:hover {
    background-color: #f3f4f6;
    color: var(--cal-navy);
}

/* 懸浮面板本體 */
.station-dropdown-panel {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    z-index: 100;
    margin-top: 8px;
    overflow: hidden;
    padding-bottom: 5px;
}

/* A-Z 字母導航區 */
.letter-tabs {
    display: flex;
    flex-wrap: wrap;
    background: #f8f9fa;
    padding: 8px;
    border-bottom: 1px solid #eee;
    gap: 4px;
    justify-content: center;
}

.letter-tab {
    font-size: 11px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    color: #666;
    font-weight: 600;
    transition: all 0.1s;
}

.letter-tab:hover {
    background: #e9ecef;
    color: var(--cal-navy);
}

.letter-tab.active {
    background: var(--cal-navy);
    color: #fff;
}

/* 機場列表顯示區 */
.station-list-container {
    max-height: 250px; /* 超過高度顯示捲軸 */
    overflow-y: auto;
    padding: 5px 0;
}

.station-item {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.1s;
}

.station-item:last-child {
    border-bottom: none;
}

.station-item:hover {
    background-color: #f0f7ff;
}

.code-badge {
    font-weight: 800;
    color: var(--cal-navy);
    background: #e7f5ff;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 10px;
    min-width: 45px;
    text-align: center;
}

.city-name {
    color: #333;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ... (保留您原本上面的所有 CSS code) ... */


/* --- 17. 登入頁面專屬擴充 (Login Page Extensions) --- */

/* 表單標籤樣式 */
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--cal-navy);
    margin-bottom: 6px;
    text-align: left;
}

/* 密碼輸入框容器 (為了放眼睛圖標) */
.password-wrapper {
    position: relative;
    width: 100%;
}

/* 眼睛圖標按鈕優化 */
.password-toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.password-toggle-btn:hover {
    background-color: #f0f4f8;
}

.password-toggle-btn img {
    width: 20px;
    height: 20px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.password-toggle-btn:hover img {
    opacity: 1;
}

/* 針對輸入框增加右側內距，避免文字被眼睛圖標擋住 */
.password-wrapper .input-field {
    padding-right: 40px; 
}

/* 登入按鈕全寬 */
.full-width {
    width: 100%;
    border: none; /* 移除 submit input 預設邊框 */
    font-size: 16px;
    letter-spacing: 1px;
}

/* 底部連結區域 */
.login-footer-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.secondary-link {
    font-size: 13px;
    color: var(--text-secondary);
    transition: color 0.2s;
    line-height: 1.4;
}

.secondary-link:hover {
    color: var(--cal-navy);
    text-decoration: underline;
}

/* 卡片微調 */
.login-card-adjust {
    padding-top: 30px;
    padding-bottom: 30px;
}

/* 版本號文字樣式調整 (在 Top bar 內) */
.version-text {
    color: #9ca3af;
    font-size: 12px;
    font-family: monospace; /* 等寬字體 */
}
