/* ==========================================================================
   Central Go 工具页面统一样式表 (Tool Style - 2025 宽屏适配版)
   包含：通用布局、Vitool风格头部/按钮、页脚、色卡表格、PDF/图片查看器
   ========================================================================== */

/* 
   =========================================
   1. 全局变量与重置
   ========================================= 
*/
:root {
    --primary-color: #001d31;
    --primary-hover: #004060;
    --danger-color: #dc3545;
    --bg-color: #f8f9fa;
    --text-color: #001d31;
    --text-light: #666;
    --border-color: #dee2e6;
    --header-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

/* 
   =========================================
   2. 顶部导航栏 (Header)
   ========================================= 
*/
.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    height: var(--header-height);
    flex-shrink: 0;
    z-index: 100;
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
    z-index: 2;
    min-width: 80px;
    gap: 10px;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    z-index: 2;
    min-width: 80px;
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.header-logo {
    height: 32px;
    width: auto;
}

.app-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

/* 
   =========================================
   3. 按钮系统 (Buttons)
   ========================================= 
*/
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
    height: 34px;
    box-sizing: border-box;
    margin: 0;
}

.btn-icon {
    width: 1.1em;
    height: 1.1em;
    fill: currentColor;
    margin-top: -1px;
}

/* 样式A: 深蓝主按钮 */
.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* 样式B: 浅灰次级按钮 */
.btn-info {
    background-color: #e9ecef;
    color: #495057;
    border-color: #dee2e6;
}

.btn-info:hover {
    background-color: #dee2e6;
    color: #212529;
    border-color: #ced4da;
}

/* 样式C: 深色主页按钮 */
.btn-dark {
    background-color: #001d31;
    color: white;
    border-color: #001d31;
}

.btn-dark:hover {
    background-color: #004060;
    border-color: #004060;
}

.btn-dark .btn-icon path,
.btn-dark .btn-icon polygon {
    fill: white !important;
}

/* 样式D: 控制栏按钮 (筛选器/PDF控制) */
.ctrl-btn {
    /* 默认状态：未选中 (#bdcbd2) */
    background-color: #bdcbd2;
    color: #001d31;
    border: 1px solid #bdcbd2;
    padding: 0 20px;
    height: 36px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    line-height: 1;
}

.ctrl-btn:hover {
    background-color: #aeb9be;
    border-color: #aeb9be;
}

/* 选中状态 / 主要操作 */
.ctrl-btn.primary,
.ctrl-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.ctrl-btn.primary:hover,
.ctrl-btn.active:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* 
   =========================================
   4. 通用容器与标题 (Widened)
   ========================================= 
*/
.tool-container {
    flex: 1;
    width: 100%;
    /* 修改点：加宽容器最大宽度 */
    max-width: 1400px; 
    margin: 0 auto;
    padding: 20px;
    overflow-y: auto;
}

.page-title {
    text-align: center;
    color: var(--primary-color);
    font-size: 28px;
    margin-bottom: 10px;
}

.page-subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 30px;
}

.tool-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    padding: 30px;
    margin-bottom: 30px;
}

/* 
   =========================================
   5. 底部信息栏 (Footer)
   ========================================= 
*/
.bottom-bar,
.tool-footer {
    background-color: white;
    border-top: 1px solid var(--border-color);
    padding: 8px 20px;
    font-size: 0.8rem;
    color: #6c757d;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.footer-content,
.footer-items {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-content a:hover,
.footer-items a:hover {
    text-decoration: underline;
}

.beian-icon {
    height: 14px;
    margin-right: 2px;
    vertical-align: middle;
}

/* 
   =========================================
   6. 弹窗组件 (Dialog)
   ========================================= 
*/
.text-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    width: 450px;
    max-width: 90vw;
}

.dialog-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: #999;
    cursor: pointer;
}

.dialog-close-btn:hover {
    color: #333;
}

.dialog-content h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    border-bottom: 2px solid #bdcbd2;
    padding-bottom: 8px;
    font-size: 1.1rem;
}

.dialog-content p {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #495057;
}

.dialog-content strong {
    color: var(--primary-color);
}

/* 
   =========================================
   7. 特定组件：色卡表格 (Table)
   ========================================= 
*/
.table-container, 
.table-responsive {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
}

.modern-table, 
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

th, td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

th {
    background-color: #f1f3f5;
    color: var(--primary-color);
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
}

td {
    font-size: 14px;
    transition: background 0.2s;
    cursor: pointer;
}

tr:hover, 
tbody tr:hover {
    background-color: #f8f9fa;
}

/* 
   =========================================
   8. 特定组件：PDF 阅读器
   ========================================= 
*/
.pdf-wrapper {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.pdf-controls {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
}

#pdf-canvas-container {
    flex: 1;
    overflow: auto;
    background-color: #525659;
    border-radius: 4px;
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 20px;
    max-height: 80vh;
}

canvas {
    display: block;
    margin: 0 auto;
}

/* 
   =========================================
   9. 特定组件：横向滚动选项卡 (Tabs)
   ========================================= 
*/
.tabs-wrapper {
    width: 100%;
    overflow-x: auto;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-radius: 12px 12px 0 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs-wrapper::-webkit-scrollbar {
    display: none;
}

.modern-tabs {
    display: flex;
    padding: 0 5px;
    gap: 0;
    width: max-content;
}

.tab-item {
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-light);
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    font-weight: 500;
    white-space: nowrap;
}

.tab-item:hover {
    color: var(--primary-color);
    background-color: rgba(0, 0, 0, 0.03);
}

.tab-item.active {
    color: var(--primary-color);
    font-weight: bold;
    background-color: white;
}

/* 
   =========================================
   10. 特定组件：图片查看器 (Image Viewer)
   ========================================= 
*/
.image-viewer-card {
    padding: 0 !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.image-display-area {
    width: 100%;
    min-height: 400px;
    background-color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-image: radial-gradient(#f0f0f0 1px, transparent 1px);
    background-size: 20px 20px;
}

.image-display-area img {
    max-width: 100%;
    height: auto;
    max-height: 70vh;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: opacity 0.3s ease;
}

.viewer-actions {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: center;
    gap: 15px;
    background: #fff;
}

/* 
   =========================================
   11. 特定组件：深色说明卡 (Info Card)
   ========================================= 
*/
.info-card {
    background: linear-gradient(120deg, var(--primary-color), #003366);
    color: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    margin-top: 30px;
}

.info-card h3 {
    font-size: 22px;
    margin-bottom: 15px;
    position: relative;
    display: inline-block;
    color: white;
    border-bottom: none;
}

.info-card h3::after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background: #3498db;
    margin: 8px auto 0;
}

.info-card p {
    opacity: 0.9;
    font-size: 15px;
    margin-bottom: 15px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.info-card a {
    color: #3498db;
    text-decoration: underline;
}

/* 
   =========================================
   12. 工具特定：站名变化 (Staname)
   ========================================= 
*/
.filter-card {
    padding: 20px;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    justify-content: center;
}

.filter-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #eee;
    padding-top: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-tag {
    padding: 5px 12px;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    background-color: #f8f9fa;
    color: #495057;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.filter-tag:hover {
    background-color: #e9ecef;
}

.filter-tag.active {
    box-shadow: 0 0 0 2px var(--primary-color) inset;
    border-color: transparent;
    font-weight: bold;
}

/* 线路颜色定义 */
.filter-tag[data-line="all"].active { background: var(--primary-color); color: white; }
.filter-tag[data-line="1号线八通线"].active, .line-1号线八通线 { background-color: #c23a30; color: white; }
.filter-tag[data-line="2号线"].active, .line-2号线 { background-color: #006098; color: white; }
.filter-tag[data-line="3号线"].active, .line-3号线 { background-color: #e60033; color: white; }
.filter-tag[data-line="4号线大兴线"].active, .line-4号线大兴线 { background-color: #008e9c; color: white; }
.filter-tag[data-line="5号线"].active, .line-5号线 { background-color: #a6217f; color: white; }
.filter-tag[data-line="6号线"].active, .line-6号线 { background-color: #d29700; color: white; }
.filter-tag[data-line="7号线"].active, .line-7号线 { background-color: #fac671; color: #001d31; }
.filter-tag[data-line="8号线"].active, .line-8号线 { background-color: #009b6b; color: white; }
.filter-tag[data-line="9号线"].active, .line-9号线 { background-color: #8fc31f; color: #001d31; }
.filter-tag[data-line="10号线"].active, .line-10号线 { background-color: #009bc0; color: white; }
.filter-tag[data-line="11号线"].active, .line-11号线 { background-color: #ed796b; color: white; }
.filter-tag[data-line="12号线"].active, .line-12号线 { background-color: #c76b00; color: white; }
.filter-tag[data-line="13号线"].active, .line-13号线 { background-color: #f9e700; color: #001d31; }
.filter-tag[data-line="14号线"].active, .line-14号线 { background-color: #d5a7a1; color: #001d31; }
.filter-tag[data-line="15号线"].active, .line-15号线 { background-color: #6a357d; color: white; }
.filter-tag[data-line="16号线"].active, .line-16号线 { background-color: #76a32d; color: white; }
.filter-tag[data-line="17号线"].active, .line-17号线 { background-color: #00a9a9; color: white; }
.filter-tag[data-line="18号线"].active, .line-18号线 { background-color: #5654a2; color: white; }
.filter-tag[data-line="19号线"].active, .line-19号线 { background-color: #d6abc1; color: #001d31; }
.filter-tag[data-line="亦庄线"].active, .line-亦庄线 { background-color: #e40077; color: white; }
.filter-tag[data-line="房山线"].active, .line-房山线 { background-color: #e46022; color: white; }
.filter-tag[data-line="燕房线"].active, .line-燕房线 { background-color: #e46022; color: white; }
.filter-tag[data-line="S1线"].active, .line-S1线 { background-color: #b25921; color: white; }
.filter-tag[data-line="昌平线"].active, .line-昌平线 { background-color: #de82b2; color: #001d31; }
.filter-tag[data-line="西郊线"].active, .line-西郊线 { background-color: #e6081b; color: white; }
.filter-tag[data-line="亦庄T1线"].active, .line-亦庄T1线 { background-color: #e6081b; color: white; }
.filter-tag[data-line="首都机场线"].active, .line-首都机场线 { background-color: #a29bbb; color: #001d31; }
.filter-tag[data-line="大兴机场线"].active, .line-大兴机场线 { background-color: #004ba0; color: white; }

.line-tag {
    display: inline-block;
    margin-left: 5px;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 11px;
    white-space: nowrap;
    vertical-align: middle;
}

.filter-modes {
    display: none;
    align-items: center;
    gap: 10px;
}

.filter-modes.visible {
    display: flex;
}

.mode-label {
    font-size: 13px;
    color: #666;
    font-weight: 600;
}

.compare-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #eef2f7;
    padding: 5px 15px;
    border-radius: 20px;
    border: 1px solid #dce4ec;
}

.compare-info {
    font-size: 13px;
    font-weight: bold;
    color: var(--primary-color);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    height: 28px;
}

.station-table th {
    cursor: pointer;
    transition: background 0.2s;
}

.station-table th:hover {
    background-color: #e2e6ea;
    color: var(--primary-color);
}

.station-table th:nth-child(1), 
.station-table th:nth-child(2) {
    cursor: default;
    background-color: #f1f3f5;
    color: var(--primary-color);
}

th.selected, 
td.selected {
    background-color: #e8f0fe !important;
    color: var(--primary-color);
    position: relative;
}

th.selected::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: #3498db;
}

td.diff {
    background-color: #fff5f5 !important;
    color: #dc3545;
    font-weight: 600;
}

td.same {
    background-color: #f6fff6 !important;
    color: #28a745;
    opacity: 0.8;
}

/* 
   =========================================
   13. 响应式适配 (Responsive)
   ========================================= 
*/
@media (max-width: 720px) {
    .tab-item {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .viewer-actions {
        flex-direction: column;
    }
    
    .viewer-actions .btn,
    .viewer-actions .ctrl-btn {
        width: 100%;
        justify-content: center;
    }
    
    .pdf-wrapper {
        padding: 10px;
    }
    
    .pdf-controls {
        flex-wrap: wrap;
    }
    
    .ctrl-btn {
        flex: 1 1 40%;
        font-size: 12px;
    }
    
    .filter-tags {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 5px;
        flex-wrap: nowrap;
    }
    
    .filter-tag {
        flex-shrink: 0;
    }
    
    .filter-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .app-title {
        font-size: 0.95rem;
    }
    
    .header-logo {
        height: 24px;
    }
    
    .btn span {
        display: none;
    }
    
    .btn {
        padding: 6px;
    }
    
    .viewer-actions .btn,
    .pdf-controls .ctrl-btn,
    .viewer-actions .btn span,
    .pdf-controls .ctrl-btn span {
        display: inline;
        padding: 0 15px;
        height: 36px;
        width: 100%;
    }
    
    .top-bar, 
    .tool-header {
        padding: 8px 10px;
    }
    
    .image-display-area {
        min-height: 250px;
    }
    
    .page-title {
        font-size: 24px;
    }
    
    .tool-card {
        padding: 20px;
    }
    
    .header-right span {
        display: none;
    }

    .bottom-bar .footer-content,
    .tool-footer .footer-items {
        display: flex !important;
        flex-direction: column !important;
        gap: 2px !important;
        line-height: 1.3 !important;
        padding: 5px 0 !important;
    }

    .bottom-bar,
    .tool-footer {
        height: auto !important;
        min-height: 60px;
    }

    .bottom-bar, 
    .tool-footer,
    .footer-content span,
    .footer-items span,
    .footer-content a,
    .footer-items a {
        font-size: 10px !important;
    }

    .beian-icon {
        height: 10px !important;
        width: auto !important;
        vertical-align: middle !important;
        margin-right: 2px !important;
    }

    /* 1. 移除最外层容器的内边距，让内容直抵屏幕边缘 */
    .tool-container {
        padding-left: 0;
        padding-right: 0;
    }

    /* 2. 通用卡片扁平化处理 */
    .tool-card {
        border-radius: 0;       /* 去除圆角 */
        box-shadow: none;       /* 去除阴影 */
        margin-bottom: 10px;    /* 减小卡片间距 */
        border-top: 1px solid #eee;    /* 添加上下边框区分内容 */
        border-bottom: 1px solid #eee;
        padding: 20px 15px;     /* 默认保留少量内边距防止文字贴边 */
    }

    /* 3. 特殊处理：图片查看器 (完全无边距，沉浸式) */
    .image-viewer-card {
        padding: 0 !important;
        border: none;
    }

    /* 4. 特殊处理：表格卡片 (去除内边距，让表格横向滚动条贴边) */
    .table-card {
        padding: 0 !important;
    }
    
    /* 配合表格容器去圆角 */
    .table-container, 
    .table-responsive {
        border-radius: 0;
        box-shadow: none;
        border: none;
    }

    /* 5. 特殊处理：筛选器卡片 (保持适量内边距) */
    .filter-card {
        padding: 15px 10px !important;
    }
    
    /* 6. 特殊处理：底部说明卡 (Info Card) */
    .info-card {
        border-radius: 0;
        margin-top: 0;
        border-top: 1px solid rgba(255,255,255,0.1);
    }
    
    /* 7. PDF容器适配 */
    .pdf-wrapper {
        border-radius: 0;
        box-shadow: none;
        padding: 10px 0; /* 减小左右padding */
    }

    .enmap-container {
        padding: 0; /* 强制去边距 */
        height: calc(100vh - 120px); /* 移动端 Footer 可能更高，留出余量 */
    }
    
    .enmap-container .pdf-wrapper {
        border-radius: 0;
        box-shadow: none;
        padding: 10px 0; /* 仅保留上下间距 */
    }
}

/* 英文地图专用高度修正 */
.enmap-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 100px);
}