body {
    overflow-x: hidden;
    font-family: 'Noto Sans HK', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Tab樣式 - 採用版本B的互動設計 */
.region-tab {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    background-color: #F3F4F6;
    color: #6B7280;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.dark .region-tab {
    background-color: #374151;
    color: #9CA3AF;
}

/* 更新hover效果 - 颜色对换 */
.region-tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dark .region-tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.region-tab.active {
    color: white;
    border-color: #5D5CDE;
    font-weight: 600;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(93, 92, 222, 0.3);
}

.dark .region-tab.active {
    color: white;
    box-shadow: 0 4px 12px rgba(93, 92, 222, 0.5);
}

/* 添加圖標樣式 */
.region-tab::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 8px;
    content: "\f3c5";
}

/* 頂部區域Tab */
.region-tab {
    border-radius: 8px 8px 0 0;
    margin-right: 4px;
}

/* 選項標題 */
.tab-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6B7280;
    margin-bottom: 8px;
    padding: 0 8px;
}

.dark .tab-section-title {
    color: #9CA3AF;
}

/* 統計卡片樣式 */
.stat-card {
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* 地區標籤樣式 */
.district-tag {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 16px;
    background-color: #F0F9FF;
    color: #0369A1;
    font-weight: 500;
    font-size: 0.75rem;
    margin: 2px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.district-tag:hover {
    background-color: #0369A1;
    color: white;
    transform: translateY(-1px);
}

.district-tag.active {
    background-color: #0369A1;
    color: white;
}

.dark .district-tag {
    background-color: #1E3A8A;
    color: #93C5FD;
}

.dark .district-tag:hover,
.dark .district-tag.active {
    background-color: #3B82F6;
    color: #1E293B;
}

/* 分區Tab樣式 */
.subarea-tab {
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    background-color: #E6E6FF;
    color: #5D5CDE;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    margin-bottom: 4px;
    text-align: left;
    width: 100%;
    font-size: 0.875rem;
}

.dark .subarea-tab {
    background-color: #2D2D5A;
    color: #A5A5FF;
}

.subarea-tab:hover {
    background-color: #D6D6FF;
    color: #5D5CDE;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dark .subarea-tab:hover {
    background-color: #3D3D7A;
    color: #C5C5FF;
}

.subarea-tab.active {
    background-color: #5D5CDE;
    color: white;
    border-color: #5D5CDE;
    font-weight: 600;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(93, 92, 222, 0.3);
}

.dark .subarea-tab.active {
    background-color: #5D5CDE;
    color: white;
    box-shadow: 0 4px 12px rgba(93, 92, 222, 0.5);
}

.subarea-tab::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 8px;
    content: "\f3c5";
    font-size: 0.875rem;
}

/* 地區選項樣式 - 每行兩欄 */
.district-tab {
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    background-color: #E6E6FF;
    color: #5D5CDE;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    margin-bottom: 8px;
    text-align: left;
    font-size: 0.875rem;
    width: calc(50% - 4px);
    display: inline-block;
    box-sizing: border-box;
}

.dark .district-tab {
    background-color: #2D2D5A;
    color: #A5A5FF;
}

.district-tab:hover {
    background-color: #D6D6FF;
    color: #5D5CDE;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dark .district-tab:hover {
    background-color: #3D3D7A;
    color: #C5C5FF;
}

.district-tab.active {
    background-color: #5D5CDE;
    color: white;
    border-color: #5D5CDE;
    font-weight: 600;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(93, 92, 222, 0.3);
}

.dark .district-tab.active {
    background-color: #5D5CDE;
    color: white;
    box-shadow: 0 4px 12px rgba(93, 92, 222, 0.5);
}

.district-tab::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 8px;
    content: "\f3c5";
    font-size: 0.875rem;
}

/* 分區選項樣式 - 每行兩欄 */
.subarea-tab-mobile {
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    background-color: #E6E6FF;
    color: #5D5CDE;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    margin-bottom: 8px;
    text-align: left;
    font-size: 0.875rem;
    width: calc(50% - 4px);
    display: inline-block;
    box-sizing: border-box;
}

.dark .subarea-tab-mobile {
    background-color: #2D2D5A;
    color: #A5A5FF;
}

.subarea-tab-mobile:hover {
    background-color: #D6D6FF;
    color: #5D5CDE;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dark .subarea-tab-mobile:hover {
    background-color: #3D3D7A;
    color: #C5C5FF;
}

.subarea-tab-mobile.active {
    background-color: #5D5CDE;
    color: white;
    border-color: #5D5CDE;
    font-weight: 600;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(93, 92, 222, 0.3);
}

.dark .subarea-tab-mobile.active {
    background-color: #5D5CDE;
    color: white;
    box-shadow: 0 4px 12px rgba(93, 92, 222, 0.5);
}

.subarea-tab-mobile::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 8px;
    content: "\f3c5";
    font-size: 0.875rem;
}

/* 地圖容器 */
.map-container {
    width: 100%;
    height: 100%;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    overflow: hidden;
}

.dark .map-container {
    border-color: #4B5563;
}

/* 滾動條樣式 */
.custom-scrollbar {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #CBD5E0 #F7FAFC;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #F7FAFC;
    border-radius: 4px;
}

.dark .custom-scrollbar::-webkit-scrollbar-track {
    background: #2D3748;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #CBD5E0;
    border-radius: 4px;
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb {
    background: #4A5568;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #A0AEC0;
}

/* 無選項提示 */
.no-options {
    padding: 20px;
    text-align: center;
    color: #9CA3AF;
    font-size: 0.875rem;
}

.dark .no-options {
    color: #6B7280;
}

/* 當前選擇顯示 */
.current-selection {
    padding: 12px 16px;
    background-color: #EBF4FF;
    border-left: 4px solid #5D5CDE;
    border-radius: 4px;
    margin-bottom: 12px;
    width: 100%;
}

.dark .current-selection {
    background-color: #2C4361;
}

.current-selection-label {
    font-size: 1.5rem; /* 增加100% */
    color: #6B7280;
    margin-bottom: 4px;
    font-weight: 600;
}

.dark .current-selection-label {
    color: #9CA3AF;
}

.current-selection-value {
    font-size: 1rem;
    font-weight: 600;
    color: #5D5CDE;
}

.dark .current-selection-value {
    color: #8B8AFF;
}

/* 搜索結果樣式 */
.search-results {
    max-height: 300px;
    overflow-y: auto;
}

/* Modal樣式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.active {
    display: block;
}

.modal-content {
    background-color: #fefefe;
    margin: 2% auto;
    padding: 0;
    border: 1px solid #888;
    width: 95%;
    max-width: 1400px;
    max-height: 95vh;
    overflow-y: auto;
    border-radius: 12px;
}

.dark .modal-content {
    background-color: #1f2937;
    border-color: #374151;
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    padding: 10px 20px;
}

.close-modal:hover,
.close-modal:focus {
    color: #000;
}

.dark .close-modal:hover,
.dark .close-modal:focus {
    color: #fff;
}

/* 地區介紹連結 */
.intro-link {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 16px;
    background-color: #5D5CDE;
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.intro-link:hover {
    background-color: #4C4BC0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(93, 92, 222, 0.3);
}

/* 響應式設計 */
@media (max-width: 1024px) {
    .desktop-sidebar {
        display: none;
    }

    .mobile-layout {
        display: block;
    }
}

@media (min-width: 1025px) {
    .desktop-sidebar {
        display: block;
    }

    .mobile-layout {
        display: none;
    }
}

/* 更新：区域选项标题样式 */
.region-options-title {
    font-size: 1.75rem; /* 增加200% */
    font-weight: 600;
    color: #6B7280;
    margin-bottom: 8px;
    padding: 0 8px;
}

.dark .region-options-title {
    color: #9CA3AF;
}

/* 更新：地区选项和分区选项标题样式 - 缩小25% */
.district-options-title,
.subarea-options-title {
    font-size: 1.3125rem; /* 缩小25% */
    font-weight: 600;
    color: #6B7280;
    margin-bottom: 8px;
    padding: 0 8px;
}

.dark .district-options-title,
.dark .subarea-options-title {
    color: #9CA3AF;
}

/* 更新：分区选项底色为灰色 */
.subarea-tab,
.subarea-tab-mobile {
    background-color: #F3F4F6 !important; /* 灰色 */
    color: #6B7280;
}

.dark .subarea-tab,
.dark .subarea-tab-mobile {
    background-color: #4B5563 !important; /* 深色模式下的灰色 */
    color: #D1D5DB;
}

.subarea-tab:hover,
.subarea-tab-mobile:hover {
    background-color: #E5E7EB !important; /* 悬停时的灰色 */
    color: #374151;
}

.dark .subarea-tab:hover,
.dark .subarea-tab-mobile:hover {
    background-color: #6B7280 !important; /* 深色模式下的悬停灰色 */
    color: #F9FAFB;
}

.subarea-tab.active,
.subarea-tab-mobile.active {
    background-color: #5D5CDE !important; /* 激活状态保持原色 */
    color: white;
}

/* 更新：手机版统计面板布局 */
@media (max-width: 1024px) {
    .stats-row {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        gap: 0.5rem !important;
    }
    
    .stats-row .stat-card {
        flex: 1 !important;
        min-width: 0 !important; /* 防止内容溢出 */
        padding: 1rem !important;
    }
    
    .stats-row .stat-card div:first-child {
        font-size: 1.5rem !important;
    }
    
    .stats-row .stat-card div:last-child {
        font-size: 0.75rem !important;
    }
}

/* 更新：区域选项标题位置 */
.region-options-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

/* 更新：手机版区域选项排列方式 */
@media (max-width: 1024px) {
    #region-tabs-mobile {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    #region-tabs-mobile .region-tab {
        margin-right: 0;
        border-radius: 8px;
        text-align: center;
    }
}