/* =========================================================
   Omni8 - 台灣鳥類百科檢索 (整合辨識主體風格版)
   ========================================================= */
:root {
    --primary-green: #5a735e; /* 與主辨識卡片主題一致 */
    --primary-blue: #5C8FB0;
    --primary-blue-dark: #3a6b88;
    --accent-peak: #e11d48;
    --accent-peak-bg: #ffe4e6;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --card-border: #e2e8f0;
    --card-radius: 16px;
}

body.bird-theme {
    background-color: #536254; /* 首頁深綠背景底色 */
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
}

/* 💡 主寬度完全對齊辨識大卡片 */
.wiki-main-wrapper {
    max-width: 1100px;
    margin: 20px auto 60px auto;
    padding: 0 16px;
    box-sizing: border-box;
}

/* 統一的大白底圓角卡片 */
.wiki-unified-card {
    background: #ffffff;
    border-radius: var(--card-radius);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--card-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
}

/* 1. 檢索面板 (左欄條件 + 右欄大按鈕) */
.search-form-layout {
    display: flex;
    gap: 20px;
    align-items: stretch;
}
.search-fields-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* 右側大檢索按鈕 */
.search-action-right {
    display: flex;
    align-items: stretch;
}
.btn-search-large {
    width: 105px;
    background: var(--primary-green);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 4px 14px rgba(90, 115, 94, 0.3);
    transition: all 0.2s ease;
}
.btn-search-large i {
    font-size: 24px;
}
.btn-search-large:hover {
    background: #475d4b;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(90, 115, 94, 0.4);
}
.btn-search-large:active {
    transform: translateY(0);
}

/* 搜尋輸入列 */
.wiki-search-box {
    position: relative;
}
.wiki-search-box .search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 17px;
}
.wiki-search-box input {
    width: 100%;
    padding: 13px 44px 13px 48px;
    border-radius: 30px;
    border: 2px solid #cbd5e1;
    font-size: 15px;
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s;
}
.wiki-search-box input:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 4px rgba(90, 115, 94, 0.15);
}
.clear-search-btn {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    color: #94a3b8;
    cursor: pointer;
    display: none;
}

/* 月份篩選列 */
.wiki-month-filter {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 2px;
}
.filter-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
}
.month-pill-wrap {
    display: flex;
    gap: 6px;
}
.month-pill {
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #475569;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.month-pill.active {
    background: var(--primary-green);
    color: #ffffff;
    border-color: var(--primary-green);
    font-weight: 600;
}

/* 分類勾選列 */
.wiki-checkbox-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 13px;
}
.chk-divider {
    width: 1px;
    height: 16px;
    background: #cbd5e1;
}
.custom-chk {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}
.custom-chk input {
    cursor: pointer;
}

/* 2. 春秋過境看板 */
.transit-board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.transit-controls-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.transit-tabs {
    display: flex;
    gap: 8px;
}
.transit-tab-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: #f1f5f9;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.transit-tab-btn.active {
    background: var(--primary-green);
    color: #ffffff;
}
.transit-tab-btn .tab-arrow {
    font-size: 12px;
    transition: transform 0.2s ease;
}
.transit-tab-btn.is-collapsed .tab-arrow {
    transform: rotate(180deg);
}

/* 猛禽/水鳥/陸鳥 緊靠秋過境按鈕 */
.transit-eco-group {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 8px;
    border-left: 2px solid #e2e8f0;
}

/* 💡 過境鳥雙排 (左右兩欄) 網格設計 */
.transit-grid-content {
    transition: all 0.3s ease;
    overflow: hidden;
}
.transit-grid-content.is-hidden {
    display: none;
}
.transit-two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 10px;
}
.transit-column-table {
    width: 100%;
    border-collapse: collapse;
}
.transit-column-table th {
    background: #f8fafc;
    padding: 10px 8px;
    font-size: 12px;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
    text-align: left;
}
.transit-column-table td {
    padding: 9px 8px;
    font-size: 13px;
    border-bottom: 1px solid #f1f5f9;
}
.transit-column-table tr:hover td {
    background: #f8fafc;
}

/* 單品鳥名連結 (不帶學名，保持精練) */
.transit-bird-name {
    font-weight: bold;
    color: #2b5672;
    cursor: pointer;
}
.transit-bird-name:hover {
    text-decoration: underline;
}

.transit-filters {
    display: flex;
    gap: 14px;
}
.transit-table-responsive {
    overflow-x: auto;
}
.transit-table {
    width: 100%;
    border-collapse: collapse;
}
.transit-table th {
    background: #f8fafc;
    padding: 12px 10px;
    text-align: left;
    font-size: 13px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--card-border);
}
.transit-table td {
    padding: 12px 10px;
    font-size: 14px;
    border-bottom: 1px solid #f1f5f9;
}
.transit-table tr:hover td {
    background: #f8fafc;
}
.transit-bird-link {
    cursor: pointer;
    font-weight: 600;
    color: #2b5672;
}
.transit-bird-link:hover {
    text-decoration: underline;
}

/* 💡 看板收合列：藥丸按鈕 */
.transit-collapsed-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}
.btn-transit-pill {
    padding: 10px 22px;
    border-radius: 25px;
    background: #ffffff;
    border: 1.5px solid var(--primary-green);
    color: var(--primary-green);
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}
.btn-transit-pill:hover {
    background: var(--primary-green);
    color: #ffffff;
}

/* 3. 圖鑑大卡片容器 */
.wiki-gallery-card {
    padding: 24px;
}
.gallery-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--card-border);
}
.gallery-card-title {
    font-size: 17px;
    font-weight: bold;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}
.gallery-count-badge {
    font-size: 13px;
    color: #64748b;
    background: #f1f5f9;
    padding: 4px 12px;
    border-radius: 12px;
}
.gallery-count-badge b {
    color: var(--primary-green);
}

.wiki-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
}
.bird-card-item {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}
.bird-card-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}
.bird-card-thumb {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: #e2e8f0;
}
.bird-card-info {
    padding: 12px;
}
.bird-card-title {
    font-size: 15px;
    font-weight: bold;
    color: var(--text-main);
    margin-bottom: 2px;
}
.bird-card-sci {
    font-size: 12px;
    font-style: italic;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.bird-card-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.bird-tag {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 5px;
    background: #e8f1f5;
    color: #2b5672;
}

/* 4. 右側滑出抽屜 (Drawer) */
.species-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.species-drawer {
    position: fixed;
    top: 0;
    right: -480px;
    width: 440px;
    max-width: 90vw;
    height: 100vh;
    background: #ffffff;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}
.species-drawer.active {
    right: 0;
}
.drawer-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
}
.drawer-title-wrap h3 {
    margin: 0;
    font-size: 20px;
    color: #0f172a;
}
.drawer-title-wrap span {
    font-size: 13px;
    font-style: italic;
    color: var(--text-muted);
}
.drawer-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #94a3b8;
}
.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
}
.drawer-hero-img-box {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    height: 200px;
}
.drawer-hero-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.drawer-hero-overlay {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    gap: 8px;
}
.spot-pill, .range-pill {
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    backdrop-filter: blur(4px);
}

/* 直條圖區塊 */
.transit-daily-chart-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid var(--card-border);
    padding: 16px;
    margin-top: 16px;
}
.chart-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.chart-main-title {
    font-size: 14px;
    font-weight: bold;
    color: #334155;
}
.peak-badge-note {
    font-size: 12px;
    color: var(--accent-peak);
    background: var(--accent-peak-bg);
    padding: 2px 8px;
    border-radius: 6px;
}
.btn-expand-bar {
    width: 100%;
    padding: 7px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    color: #64748b;
    font-size: 12px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-expand-bar:hover {
    background: #f1f5f9;
    color: #334155;
}
.daily-bars-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0;
}
.daily-row-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}
.daily-date {
    width: 44px;
    color: #64748b;
    font-weight: 500;
}
.daily-bar-track {
    flex: 1;
    height: 18px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}
.daily-bar-fill {
    height: 100%;
    background: #85ABC6;
    border-radius: 4px;
    transition: width 0.3s ease;
}
.daily-qty {
    width: 50px;
    text-align: right;
    color: #64748b;
    font-size: 12px;
}

/* 高峰深色突顯 */
.daily-row-item.is-peak .daily-date {
    color: #0f172a;
    font-weight: bold;
}
.daily-row-item.is-peak .daily-bar-fill {
    background: #2b5672;
    box-shadow: 0 0 6px rgba(43, 86, 114, 0.3);
}
.daily-row-item.is-peak .daily-qty {
    color: var(--accent-peak);
    font-weight: bold;
}

.drawer-action-row {
    margin-top: 18px;
}
.btn-full-wiki {
    width: 100%;
    padding: 12px;
    background: var(--primary-green);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(90, 115, 94, 0.25);
}

/* 5. 全螢幕百科彈窗 */
.full-wiki-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: center;
}
.full-wiki-card {
    background: #ffffff;
    width: 90%;
    max-width: 960px;
    height: 85vh;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.full-wiki-header {
    padding: 16px 24px;
    background: #f8fafc;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.full-wiki-header h3 {
    margin: 0;
    font-size: 18px;
    color: #1e293b;
}
.modal-close-icon {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #94a3b8;
}
.full-wiki-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* 手機版自適應 */
@media (max-width: 768px) {
    .search-form-layout {
        flex-direction: column;
    }
    .btn-search-large {
        width: 100%;
        height: 44px;
        flex-direction: row;
    }
    .btn-search-large i {
        font-size: 18px;
    }
    .transit-two-columns {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .transit-eco-group {
        border-left: none;
        padding-left: 0;
    }
}