/* ============================================
   TECH BLUE - 無人機統計儀表板
   冷酷科技藍配色風格
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Noto+Sans+TC:wght@400;500;700&display=swap');

:root {
    /* 深邃藍黑背景 */
    --bg-void: #05080f;
    --bg-primary: #0a1020;
    --bg-secondary: #0d1528;
    --bg-tertiary: #121d35;
    --bg-card: rgba(13, 21, 40, 0.85);

    /* 科技藍色系 */
    --blue-100: #e6f4ff;
    --blue-200: #bae0ff;
    --blue-300: #91caff;
    --blue-400: #69b1ff;
    --blue-500: #4096ff;
    --blue-600: #1677ff;
    --blue-700: #0958d9;
    --blue-800: #003eb3;
    --blue-900: #002c8c;

    /* 主色調 */
    --primary: #1890ff;
    --primary-light: #40a9ff;
    --primary-dark: #096dd9;
    --accent: #69c0ff;
    --accent-bright: #91d5ff;

    /* 輔助色 */
    --silver: #c0c6d0;
    --steel: #8892a8;
    --ice: #e8f4fc;
    --highlight: #00d4ff;
    --warning: #faad14;
    --danger: #ff4d4f;
    --success: #52c41a;

    /* 發光效果 */
    --glow-primary: 0 0 20px rgba(24, 144, 255, 0.4), 0 0 40px rgba(24, 144, 255, 0.2);
    --glow-accent: 0 0 15px rgba(105, 192, 255, 0.3);
    --glow-highlight: 0 0 20px rgba(0, 212, 255, 0.4);

    /* 文字 */
    --text-primary: #f0f5ff;
    --text-secondary: #8c99b0;
    --text-muted: #4a5568;

    /* 邊框 */
    --border-primary: rgba(24, 144, 255, 0.3);
    --border-dim: rgba(140, 153, 176, 0.15);
    --border-glow: rgba(24, 144, 255, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 主體背景 - 漸層 + 網格 */
body {
    font-family: 'Exo 2', 'Noto Sans TC', sans-serif;
    background: var(--bg-void);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* 科技網格背景 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(90deg, rgba(24, 144, 255, 0.02) 1px, transparent 1px),
        linear-gradient(rgba(24, 144, 255, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

/* 藍色光暈背景 */
body::after {
    content: '';
    position: fixed;
    top: -30%;
    left: -20%;
    width: 140%;
    height: 160%;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(24, 144, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(9, 109, 217, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(0, 212, 255, 0.03) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
    animation: ambientGlow 20s ease-in-out infinite alternate;
}

@keyframes ambientGlow {
    0% { opacity: 0.8; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.05); }
}

/* 確保內容在背景之上 */
.header, .filters-section, .stats-summary, .charts-container, .footer {
    position: relative;
    z-index: 1;
}

/* ============================================
   頁面標題
   ============================================ */
.header {
    padding: 24px 40px;
    background: linear-gradient(180deg, rgba(24, 144, 255, 0.05) 0%, transparent 100%);
    border-bottom: 1px solid var(--border-primary);
    position: relative;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), var(--accent), var(--primary), transparent);
}

/* 公司品牌連結 */
.header .company-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    padding: 14px 28px;
    background: linear-gradient(135deg, rgba(20, 30, 50, 0.7) 0%, rgba(10, 18, 35, 0.8) 100%);
    border: 1px solid rgba(180, 60, 60, 0.3);
    border-radius: 10px;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.header .company-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(180, 60, 60, 0.1), transparent);
    transition: left 0.6s ease;
}

.header .company-link:hover::before {
    left: 100%;
}

.header .company-link:hover {
    transform: translateY(-2px);
    border-color: rgba(200, 80, 80, 0.5);
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.3),
        0 0 25px rgba(180, 60, 60, 0.2);
}

.header .company-logo {
    height: 45px;
    width: auto;
    filter: brightness(1.1) drop-shadow(0 2px 8px rgba(180, 60, 60, 0.4));
    transition: all 0.4s ease;
}

.header .company-link:hover .company-logo {
    filter: brightness(1.25) drop-shadow(0 4px 15px rgba(200, 80, 80, 0.6));
}

.company-label {
    font-family: 'Noto Sans TC', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 4px;
    color: var(--silver);
    transition: all 0.3s ease;
    padding-top: 6px;
    border-top: 1px solid rgba(180, 60, 60, 0.2);
    width: 100%;
    text-align: center;
}

.header .company-link:hover .company-label {
    color: var(--text-primary);
    border-top-color: rgba(200, 80, 80, 0.4);
}

/* 標題區域 */
.header-title {
    text-align: left;
}

.header h1 {
    font-family: 'Exo 2', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--ice) 0%, var(--primary-light) 50%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
    line-height: 1.2;
}

.header .subtitle {
    color: var(--steel);
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 400;
}

/* ============================================
   篩選器區域
   ============================================ */
.filters-section {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-bottom: 1px solid var(--border-primary);
    padding: 25px 30px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
}

.filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
    justify-content: center;
    max-width: 1400px;
    margin: 0 auto;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-family: 'Exo 2', sans-serif;
    font-size: 0.75rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-icon {
    font-size: 1rem;
}

.filter-group select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 12px 40px 12px 16px;
    color: var(--text-primary);
    font-family: 'Exo 2', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    min-width: 170px;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2340a9ff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.filter-group select:hover {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(24, 144, 255, 0.2);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: var(--glow-primary);
}

.filter-group select option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.reset-btn {
    background: transparent;
    border: 1px solid var(--steel);
    border-radius: 6px;
    padding: 12px 24px;
    color: var(--silver);
    font-family: 'Exo 2', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.reset-btn:hover {
    border-color: var(--primary);
    color: var(--primary-light);
    box-shadow: var(--glow-primary);
    transform: translateY(-2px);
}

.reset-btn span {
    font-size: 1.2rem;
}

.filter-status {
    text-align: center;
    margin-top: 15px;
    font-family: 'Exo 2', sans-serif;
    font-size: 0.85rem;
    color: var(--highlight);
    padding: 10px 24px;
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-radius: 6px;
    display: inline-block;
    margin-left: 50%;
    transform: translateX(-50%);
    letter-spacing: 1px;
    font-weight: 500;
    white-space: nowrap;
    max-width: calc(100% - 30px);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   統計摘要卡片
   ============================================ */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    padding: 40px 30px 30px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-dim);
    border-radius: 10px;
    padding: 28px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

/* 頂部漸層邊框 */
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

/* HUD 角落裝飾 */
.stat-card::after {
    content: '';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 16px;
    height: 16px;
    border-top: 2px solid var(--primary);
    border-right: 2px solid var(--primary);
    opacity: 0.4;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-6px);
    border-color: var(--primary);
    box-shadow:
        0 20px 50px rgba(24, 144, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.stat-card:hover::after {
    opacity: 0.8;
    width: 24px;
    height: 24px;
}

.stat-card .value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.4rem;
    font-weight: 600;
    color: var(--primary-light);
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.stat-card:nth-child(1) .value { color: var(--highlight); }
.stat-card:nth-child(2) .value { color: var(--primary-light); }
.stat-card:nth-child(3) .value { color: var(--accent); }
.stat-card:nth-child(4) .value { color: var(--accent-bright); }

.stat-card .label {
    font-family: 'Exo 2', sans-serif;
    color: var(--steel);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 500;
}

.stat-card .value.updating {
    animation: valuePulse 0.4s ease;
}

@keyframes valuePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.8; }
}

/* ============================================
   圖表容器
   ============================================ */
.charts-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
    padding: 20px 30px 60px;
    max-width: 1600px;
    margin: 0 auto;
}

.chart-box {
    background: var(--bg-card);
    border: 1px solid var(--border-dim);
    border-radius: 12px;
    padding: 26px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

/* 頂部邊框光效 */
.chart-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), var(--accent), var(--primary), transparent);
    opacity: 0.6;
}

.chart-box:hover {
    border-color: var(--border-primary);
    box-shadow:
        0 8px 40px rgba(24, 144, 255, 0.1),
        inset 0 0 40px rgba(24, 144, 255, 0.02);
}

.chart-box.full-width {
    grid-column: 1 / -1;
}

.chart-box h3 {
    font-family: 'Exo 2', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-dim);
    display: flex;
    align-items: center;
    gap: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.chart-box h3::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
    border-radius: 2px;
}

.chart-content {
    min-height: 350px;
    position: relative;
}

.chart-content svg {
    width: 100%;
    height: 100%;
}

/* 動畫延遲 */
.chart-box:nth-child(1) { animation-delay: 0.1s; }
.chart-box:nth-child(2) { animation-delay: 0.15s; }
.chart-box:nth-child(3) { animation-delay: 0.2s; }
.chart-box:nth-child(4) { animation-delay: 0.25s; }
.chart-box:nth-child(5) { animation-delay: 0.3s; }
.chart-box:nth-child(6) { animation-delay: 0.35s; }
.chart-box:nth-child(7) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Tooltip
   ============================================ */
.tooltip {
    position: absolute;
    background: rgba(10, 16, 32, 0.95);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 14px 18px;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 1000;
    box-shadow: var(--glow-primary);
    opacity: 0;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(10px);
}

.tooltip.active {
    opacity: 1;
}

.tooltip .title {
    font-family: 'Exo 2', sans-serif;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 6px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tooltip .value {
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: 500;
}

/* ============================================
   D3 圖表樣式
   ============================================ */
.axis text {
    fill: var(--steel);
    font-family: 'Exo 2', sans-serif;
    font-size: 11px;
    font-weight: 500;
}

.axis line,
.axis path {
    stroke: var(--border-dim);
}

.grid line {
    stroke: rgba(24, 144, 255, 0.08);
    stroke-dasharray: 2, 4;
}

/* ============================================
   圖例
   ============================================ */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 18px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Exo 2', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--steel);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.legend-item:hover {
    background: rgba(24, 144, 255, 0.1);
    border-color: var(--primary);
    color: var(--text-primary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* ============================================
   下鑽返回按鈕
   ============================================ */
.drill-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(24, 144, 255, 0.1);
    border: 1px solid var(--primary);
    border-radius: 6px;
    padding: 8px 16px;
    color: var(--primary-light);
    font-family: 'Exo 2', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.drill-back-btn:hover {
    background: rgba(24, 144, 255, 0.2);
    box-shadow: var(--glow-primary);
    transform: translateX(-3px);
}

.drill-back-btn svg {
    width: 16px;
    height: 16px;
}

.drill-title {
    font-family: 'Exo 2', sans-serif;
    color: var(--accent);
    font-size: 0.9rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.drill-title .county-name {
    color: var(--highlight);
    font-weight: 600;
}

/* ============================================
   無資料提示
   ============================================ */
.no-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--text-muted);
    font-family: 'Exo 2', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.no-data-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* ============================================
   載入動畫
   ============================================ */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-dim);
    border-top-color: var(--primary);
    border-right-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   頁尾
   ============================================ */
.footer {
    text-align: center;
    padding: 35px 30px;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-dim);
    margin-top: 30px;
    position: relative;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

/* Footer 公司品牌 */
.company-brand {
    margin-bottom: 16px;
}

.footer .company-link {
    display: inline-block;
    text-decoration: none;
    padding: 12px 24px;
    background: linear-gradient(145deg, rgba(26, 42, 74, 0.6) 0%, rgba(13, 26, 48, 0.6) 100%);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.footer .company-link:hover {
    background: linear-gradient(145deg, rgba(36, 54, 86, 0.8) 0%, rgba(20, 36, 64, 0.8) 100%);
    box-shadow: 0 0 20px rgba(24, 144, 255, 0.3);
    transform: translateY(-2px);
    border-color: var(--accent);
}

.company-logo-footer {
    height: 36px;
    width: auto;
    display: block;
    filter: brightness(1.1);
    transition: filter 0.3s ease;
}

.footer .company-link:hover .company-logo-footer {
    filter: brightness(1.3) drop-shadow(0 0 10px rgba(24, 144, 255, 0.5));
}

/* ============================================
   響應式設計
   ============================================ */
@media (max-width: 1200px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .filters-container {
        gap: 12px;
    }

    .filter-group select {
        min-width: 140px;
    }

    .header h1 {
        font-size: 2rem;
        letter-spacing: 2px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 20px 16px;
    }

    .header-content {
        flex-direction: column;
        gap: 16px;
    }

    .header .company-link {
        padding: 12px 24px;
        gap: 6px;
    }

    .header .company-logo {
        height: 38px;
    }

    .company-label {
        font-size: 0.9rem;
        letter-spacing: 3px;
    }

    .header-title {
        text-align: center;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .header .subtitle {
        font-size: 0.8rem;
    }

    .filters-section {
        padding: 15px;
        /* 手機版取消 sticky 定位，避免佔用過多空間 */
        position: relative;
        top: auto;
    }

    .filter-group {
        flex: 1;
        min-width: 140px;
    }

    .filter-group select {
        width: 100%;
        min-width: unset;
    }

    .reset-btn {
        width: 100%;
        justify-content: center;
    }

    .stats-summary {
        grid-template-columns: repeat(2, 1fr);
        padding: 20px 15px;
        gap: 15px;
    }

    .stat-card .value {
        font-size: 1.6rem;
    }

    .stat-card .label {
        font-size: 0.7rem;
        letter-spacing: 1px;
        /* 防止標籤換行 */
        white-space: nowrap;
    }

    .charts-container {
        padding: 15px 15px 30px;
        gap: 18px;
    }

    .chart-box {
        padding: 18px;
    }

    .chart-content {
        min-height: 280px;
    }
}

/* ============================================
   GIS 地圖樣式
   ============================================ */
.map-section {
    position: relative;
}

.map-container {
    min-height: 600px;
    position: relative;
    overflow: hidden;
}

/* 全寬地圖區塊更大 */
.chart-box.full-width .map-container {
    min-height: 700px;
}

.map-container svg {
    width: 100%;
    height: 100%;
}

/* 縣市/鄉鎮多邊形 */
.county-path,
.town-path {
    stroke: var(--steel);
    stroke-width: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.county-path:hover,
.town-path:hover {
    stroke: var(--highlight);
    stroke-width: 2px;
    filter: brightness(1.3) drop-shadow(0 0 8px rgba(0, 212, 255, 0.5));
}

.county-path.selected {
    stroke: var(--highlight);
    stroke-width: 2.5px;
}

/* 比例符號（氣泡）*/
.bubble-circle {
    fill: var(--primary);
    fill-opacity: 0.65;
    stroke: var(--highlight);
    stroke-width: 1.5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.bubble-circle:hover {
    fill-opacity: 0.85;
    stroke-width: 2.5px;
    filter: drop-shadow(0 0 12px rgba(0, 212, 255, 0.6));
}

/* 地圖標籤 */
.map-label {
    font-family: 'Exo 2', 'Noto Sans TC', sans-serif;
    font-size: 10px;
    font-weight: 600;
    fill: var(--text-primary);
    text-anchor: middle;
    pointer-events: none;
    text-shadow:
        1px 1px 2px var(--bg-void),
        -1px -1px 2px var(--bg-void),
        1px -1px 2px var(--bg-void),
        -1px 1px 2px var(--bg-void);
}

/* 地圖色階圖例 */
.map-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(10, 16, 32, 0.9);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 12px 16px;
    backdrop-filter: blur(10px);
}

.map-legend-title {
    font-family: 'Exo 2', sans-serif;
    font-size: 0.75rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    font-weight: 600;
}

.map-legend-gradient {
    width: 120px;
    height: 12px;
    border-radius: 3px;
    margin-bottom: 6px;
}

.map-legend-labels {
    display: flex;
    justify-content: space-between;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--steel);
}

/* 地圖返回按鈕 */
.map-back-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(24, 144, 255, 0.15);
    border: 1px solid var(--primary);
    border-radius: 6px;
    padding: 8px 14px;
    color: var(--primary-light);
    font-family: 'Exo 2', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.map-back-btn:hover {
    background: rgba(24, 144, 255, 0.3);
    box-shadow: var(--glow-primary);
    transform: translateX(-3px);
}

/* 地圖縮放控制按鈕 */
.map-zoom-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 10;
}

.map-zoom-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 16, 32, 0.9);
    border: 1px solid var(--primary);
    border-radius: 6px;
    color: var(--primary-light);
    font-family: 'Exo 2', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.map-zoom-btn:hover {
    background: rgba(24, 144, 255, 0.3);
    box-shadow: var(--glow-primary);
    transform: scale(1.1);
}

.map-zoom-btn:active {
    transform: scale(0.95);
}

.map-zoom-reset {
    font-size: 1rem;
}

/* 全螢幕按鈕 */
.map-fullscreen-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 16, 32, 0.9);
    border: 1px solid var(--primary);
    border-radius: 6px;
    color: var(--primary-light);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    margin-top: 8px;
}

.map-fullscreen-btn:hover {
    background: rgba(24, 144, 255, 0.3);
    box-shadow: var(--glow-primary);
    transform: scale(1.1);
}

.map-fullscreen-btn:active {
    transform: scale(0.95);
}

/* 全螢幕狀態 */
.map-container.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: var(--bg-void) !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 60px 20px 20px 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.map-container.fullscreen svg {
    width: auto !important;
    height: calc(100vh - 80px) !important;
    max-width: calc(100vw - 40px) !important;
    max-height: calc(100vh - 80px) !important;
}

.map-container.fullscreen .map-zoom-controls {
    position: fixed;
    top: 20px;
    right: 30px;
    z-index: 10000;
}

.map-container.fullscreen .map-legend {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000;
}

.map-container.fullscreen .map-back-btn {
    position: fixed;
    top: 70px;
    left: 30px;
    z-index: 10000;
}

.map-container.fullscreen .map-hint {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 10000;
}

.map-container.fullscreen .map-title-overlay {
    position: fixed;
    top: 70px;
    z-index: 10000;
}

/* 全螢幕標題 */
.map-fullscreen-title {
    display: none;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    font-family: 'Exo 2', sans-serif;
    font-size: 1.2rem;
    color: var(--highlight);
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    z-index: 10;
}

.map-container.fullscreen .map-fullscreen-title {
    display: block;
}

/* 地圖標題覆蓋層 */
.map-title-overlay {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 16, 32, 0.9);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 8px 20px;
    font-family: 'Exo 2', sans-serif;
    font-size: 0.85rem;
    color: var(--highlight);
    font-weight: 600;
    letter-spacing: 1px;
    backdrop-filter: blur(10px);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
}

.map-title-overlay .title-icon {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

/* 地圖提示文字 */
.map-hint {
    position: absolute;
    bottom: 20px;
    left: 20px;
    font-family: 'Exo 2', sans-serif;
    font-size: 0.75rem;
    color: var(--steel);
    background: rgba(10, 16, 32, 0.8);
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid var(--border-dim);
}

.map-hint::before {
    content: '[ i ]';
    margin-right: 6px;
    color: var(--primary);
    font-weight: 600;
}

/* 地圖動畫 */
@keyframes mapFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.map-container svg {
    animation: mapFadeIn 0.6s ease-out;
}

/* 地圖響應式 */
@media (max-width: 768px) {
    .map-container {
        min-height: 450px;
    }

    .chart-box.full-width .map-container {
        min-height: 500px;
    }

    .map-legend {
        bottom: 10px;
        right: 10px;
        padding: 8px 12px;
    }

    .map-legend-gradient {
        width: 80px;
    }

    .map-back-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}
