/* ======================================================= */
/* 15. 校系對比頁面專屬樣式 */
/* ======================================================= */

#comparison-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* --- 搜尋區域的兩種狀態 --- */

.search-section {
    width: 100%;
    max-width: 600px;
    transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: 100;
}

/* 初始狀態：在正中央 */
#comparison-page.initial-state .search-section {
    margin-top: 30vh;
}

/* 啟用狀態：移到上方 */
#comparison-page.active-state .search-section {
    margin-top: 20px;
    max-width: 800px; /* 搜尋時拉寬一點 */
}

.search-input-wrapper {
    position: relative;
    background: white;
    padding: 5px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    border: 2px solid transparent;
    transition: border 0.3s;
}

.search-input-wrapper:focus-within {
    border-color: #4CAF50;
}

#comparison-search {
    width: 100%;
    padding: 15px 25px;
    border: none;
    outline: none;
    font-size: 18px;
    border-radius: 50px;
}

/* --- 結果行樣式 --- */

.results-container {
    width: 100%;
    max-width: 1000px;
    margin-top: 40px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

#comparison-page.active-state .results-container {
    opacity: 1;
    transform: translateY(0);
}

/* 卡片整體 */
.comparison-row {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 24px;
    border: 1px solid #f0f0f0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 上半部：115 資訊 */
.card-main {
    padding: 20px 25px 10px 25px;
}

.dept-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.uni-name { font-size: 13px; color: #888; display: block; margin-bottom: 2px; }
.dept-name { font-size: 20px; font-weight: 800; color: #333; }

.current-year-badge {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
}

/* 115 標準展示 */
.current-standards {
    display: flex;
    gap: 30px;
}

.std-section label {
    display: block;
    font-size: 13px;
    color: #bbb;
    font-weight: bold;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.pills-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.gsat-pill, .weight-pill {
    padding: 0.5rem 10px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    border: 1px solid transparent;
}

.gsat-pill { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.weight-pill { background: #fff9db; color: #f08c00; border-color: #fff3bf; }

/* 下半部：往年輔助資訊 */
.card-footer {
    background: #f8fafc;
    border-top: 1px dashed #e2e8f0;
    padding: 10px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.footer-label { font-size: 11px; color: #94a3b8; font-weight: bold; }

.history-tags-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.history-tag {
    font-size: 13px;
    display: flex;
    gap: 6px;
}

.h-year { color: #94a3b8; font-weight: 500; }
.m-score { font-weight: 700; color: #334155; }
.m-ratio { color: #64748b; font-size: 12px; }

.h-divider {
    width: 1px;
    height: 14px;
    background: #e2e8f0;
}

/* 修改歷史資料區塊容器 */
.card-history-section {
    background: #fcfcfc;
    border-top: 1px solid #f0f0f0;
    padding: 12px 25px;
}

.history-grid-wrapper {
    display: flex;
    gap: 30px; /* 114年與113年的間距 */
    -webkit-overflow-scrolling: touch;
    overflow-x: auto; /* 內容超出時顯示捲軸 */
}

.history-grid-wrapper::-webkit-scrollbar {
    height: 0px;
}

.history-block {
    flex-shrink: 0;
    /* flex: 1; */
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* 歷史資料第一行：年份、人數、分數 */
.h-top-line {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.h-year {
    font-weight: 800;
    color: #abb8c3;
    min-width: 40px;
}

.h-admitted {
    color: #666;
    background: #f0f0f0;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.h-score {
    font-weight: 700;
    color: #444;
}

.h-score small {
    font-weight: normal;
    color: #999;
    margin-left: 4px;
}

/* 歷史資料第二行：科目倍數 (用更小的字體與深灰色) */
.h-weights {
    font-size: 11px;
    color: #888;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 沒資料時的樣式 */
.no-data {
    color: #a3a3a3;
    font-size: 12px;
}

/* 手機版適配：將今年標準改為垂直 */
@media (max-width: 600px) {
    .current-standards { flex-direction: column; gap: 3px; }
    .card-footer { flex-direction: column; align-items: flex-start; gap: 8px; }
    .h-divider { display: none; }
}

.year-label { font-size: 11px; color: #aaa; display: block; }
.year-data { font-size: 14px; color: #333; font-weight: 500; }

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ======================================================= */
/* 17. 薄荷鼠尾草 (#76bfa2) 專屬色系方案 */
/* ======================================================= */

:root {
    --sage-primary: #76bfa2;        /* 核心色：薄荷鼠尾草 */
    --sage-light: #eef7f4;          /* 背景與標籤：極淺薄荷 */
    --sage-medium: #b8dccf;         /* 輔助邊框：粉綠 */
    --sage-dark: #3d6b59;           /* 強調文字：深森林綠 */
    --bg-white: #ffffff;
    --card-shadow: rgba(118, 191, 162, 0.12); /* 基於主色的柔和陰影 */
}

/* 網頁整體背景 */
body {
    font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif; /* 假設使用 Inter 或系統無襯線字體 */
    background-color: #f7f7f7; 
    color: #444;
}

/* --- 搜尋框優化 --- */
.search-input-wrapper {
    border: 2px solid var(--sage-light);
    box-shadow: 0 8px 25px var(--card-shadow);
}

.search-input-wrapper:focus-within {
    border-color: var(--sage-primary);
}

/* --- 校系卡片樣式 --- */
.comparison-row {
    background: var(--bg-white);
    border: 1px solid var(--sage-light);
    box-shadow: 0 4px 12px var(--card-shadow);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.comparison-row:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(118, 191, 162, 0.2);
}

/* 115 招生標籤：白字配主色 */
.current-year-badge {
    background-color: var(--sage-primary);
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
}

/* 學測標籤：淺綠底深綠字 */
.gsat-pill {
    background: var(--sage-light);
    color: var(--sage-dark);
    border: 1px solid var(--sage-medium);
}

/* 加權標籤：白底主色框 */
.weight-pill {
    padding: 0.5rem 0;
    background: white;
    color: var(--sage-dark);
    border: 0;
    border-radius: 0;
    display: inline-block; /* 確保 margin 屬性可以正確應用 */
}

/* --- 往年參考區塊 --- */
.card-history-section {
    background: #fdfdfd; /* 保持輕盈 */
    border-top: 1px dashed var(--sage-medium);
    padding: 15px 25px;
}

.h-year {
    color: #777f8a;
    font-weight: 800;
}

.h-admitted {
    background: var(--sage-light);
    color: var(--sage-dark);
    font-weight: bold;
}

.h-score {
    color: var(--sage-dark);
}

.h-weights {
    color: #7a8a84; /* 帶一點綠調的灰 */
}

.data-separator {
    color: #cccccc; /* 極淺灰色，柔和分隔線 */
    font-size: 1.5em; /* 與周圍文字大小相同 */
    font-weight: 300; /* 輕字重，降低存在感 */
    height: 100%;
    margin: 0 3px;   /* 🌟 核心間距：左右各 8px 創造呼吸空間 */
    display: inline-block; /* 確保 margin 屬性可以正確應用 */
    /* 移除 data-tag 上的 margin-right 避免過大的間隔 */
}

.weight-strong {
    color: #77BFA2;
    font-weight: 700;
}

/* --- 說明框樣式 --- */
.search-description {
    margin-top: 25px;
    padding: 20px;
    background: var(--sage-light); /* 使用薄荷鼠尾草淺色 */
    border-radius: 12px;
    border: 1px solid var(--sage-medium);
    color: var(--sage-dark);
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    
    /* 動態過渡效果 */
    transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    opacity: 1;
    transform: translateY(0);
    overflow: hidden;
}

.search-description .info-title {
    font-weight: bold;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* .search-description ul {
    margin: 0;
    padding-left: 20px;
    font-size: 14px;
    line-height: 1.6;
} */

.search-description p {
    /* margin-bottom: 5px; */
    padding-left: 5px;
    border-left: 3px solid var(--sage-primary);
    font-size: 14px;
    margin-top: 11px;
    margin-bottom: 11px;
}

/* --- 當狀態變為 active (搜尋中) 時消失 --- */
#comparison-page.active-state .search-description {
    opacity: 0;
    transform: translateY(-20px); /* 往上位移一點 */
    max-height: 0;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none; /* 確保消失後不會被點擊到 */
}

.link {
    color: rgb(122, 139, 131);
    cursor: pointer;
    text-decoration: underline;
}

/* ======================================================= */
/* 18. Filter Island 篩選島樣式 */
/* ======================================================= */

#filter-island-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    transition: all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}


.filter-hint {
    font-size: 12px;
    font-weight: bold;
    color: var(--sage-dark);
    white-space: nowrap;
    border-right: 1px solid var(--sage-medium);
    padding-right: 12px;
}

/* 移除捲軸顯示 */
.filter-subjects::-webkit-scrollbar { display: none; }

.filter-item {
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 20px;
    cursor: pointer;
    background: white;
    color: #888;
    border: 1px solid #eee;
    transition: all 0.2s;
    white-space: nowrap;
    user-select: none;
}

.filter-island {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid var(--sage-medium);
    border-radius: 28px; /* 稍微減少圓角讓它更有洗鍊感 */
    padding: 12px 20px;
    display: flex;
    flex-direction: column; /* 垂直排列兩排 */
    gap: 10px;
    box-shadow: 0 15px 45px rgba(118, 191, 162, 0.25);
    width: max-content;
    max-width: 90vw;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-label {
    font-size: 11px;
    font-weight: 900;
    color: var(--sage-primary);
    background: var(--sage-light);
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.filter-subjects {
    display: flex;
    gap: 6px;
    padding: 4px;
    overflow-x: auto;
}

/* 兩排之間的細線 */
.filter-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--sage-medium), transparent);
    width: 100%;
    opacity: 0.5;
}

/* 三種狀態的樣式 */
/* 1. 必選 (Include) */
.filter-item.include {
    background: var(--sage-primary);
    color: white;
    border-color: var(--sage-primary);
}
/* .filter-item.include::before { content: ""; } */

/* 2. 排除 (Exclude) */
.filter-item.exclude {
    background: #ff7675; /* 柔和的紅 */
    color: white;
    border-color: #ff7675;
}
/* .filter-item.exclude::before { content: "✕ "; } */

/* 懸浮縮放 */
.filter-item:hover { transform: scale(1.05); }

@media (max-width: 600px) {
    #filter-island-container {
        bottom: 0;
    }

    .filter-island {
        border-radius: 0;
    }

    .search-description p {
        font-size: 12px;
    }

    .uni-name {
        font-size: 11px;
    }

    .dept-name {
        font-size: 15px;
    }

    .std-section label {
        font-size: 11px;
        margin-bottom: 2px;
    }

    .gsat-pill, .weight-pill {
        font-size: 13px;
    }

    .dept-header {
        margin-bottom: 3px;
    }

    .gsat-pill {
        padding: 6px;
    }

    .weight-pill {
        padding: 2px 0;
    }

    .card-history-section {
        padding: 10px 25px;
    }

    .history-block {
        gap: 1px;
    }

    .h-admitted {
        font-size: 9px;
    }

    .h-weights {
        font-size: 10px;
    }

    
}

#you-cant-see-me {
    color: #f7f7f7;
    height: 120px;
}

/* 卡片淡入動畫 */
@keyframes fadeInCard {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.comparison-row {
    animation: fadeInCard 0.4s ease forwards;
    /* 效能優化：讓瀏覽器知道這個元素不會影響外部佈局 */
    contain: content; 
}

/* 讓捲軸更滑順 */
html {
    scroll-behavior: smooth;
}

/* --- 跳轉圖示樣式 --- */
.history-grid-wrapper .card-main {
    position: relative; 
}

.history-grid-wrapper {
    padding-right: 40px;
}

.to-uac-button {
    border: none;
    background-color: #33333300;
}

.jump-link {
    position: absolute;
    right: 20px;
    width: 34px;
    height: 35px;
    margin-left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sage-medium); /* 預設使用較淡的綠 */
    border-radius: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
    z-index: 10;
}

.jump-link svg {
    width: 18px;
    height: 18px;
}

.jump-link:hover {
    background-color: var(--sage-light); /* 淺色底 */
    color: var(--sage-primary); /* 深色圖示 */
    transform: scale(1.1);
}

/* 修正標題區域不要被圖示擋到 */
.dept-header {
    padding-right: 40px; 
}