/* 文档地图：与 /ai 同 container + ai-chat-header 风格 */

.map-workspace {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: clamp(520px, calc(100vh - 220px), 780px);
    min-height: clamp(520px, calc(100vh - 220px), 780px);
    background: #f7f7f7;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 0;
}

.map-workspace .ai-chat-header {
    margin: 0;
}

.map-workspace .ai-chat-header-content {
    max-width: none;
    gap: 0.75rem;
}

.map-header-left {
    flex: 1;
    min-width: 0;
}

.map-header-right {
    flex-shrink: 0;
}

.map-category-filter {
    min-width: 160px;
    max-width: 220px;
    font-size: 0.85rem;
}

.map-category-filter .category-option.level-1 {
    font-weight: 600;
}

.map-breadcrumb {
    font-size: 0.875rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
}

.map-breadcrumb .breadcrumb-item a {
    cursor: pointer;
    text-decoration: none;
    color: #0d6efd;
}

.map-breadcrumb .breadcrumb-item.active {
    color: #666;
}

.map-workspace-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 34%);
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    background: #f7f7f7;
    align-items: stretch;
}

.map-chart-wrap {
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid #e5e5e5;
}

.map-chart-inner {
    flex: 1;
    min-height: 0;
    height: 100%;
    padding: 0.5rem;
}

#mapChart {
    width: 100%;
    height: 100%;
    min-height: 0;
}

.map-geo-hint {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.375rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.78rem;
    color: #6c757d;
    max-width: 90%;
}

.map-doc-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    background: #fff;
    overflow: hidden;
}

.map-doc-panel-head {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid #e5e5e5;
    background: #fff;
    flex-shrink: 0;
}

.map-sub-charts {
    flex-shrink: 0;
    border-bottom: 1px solid #e5e5e5;
    background: #fafafa;
    padding: 0.35rem 0.5rem 0;
}

.map-sub-chart {
    width: 100%;
    height: 150px;
    min-height: 150px;
}

@media (max-width: 991.98px) {
    .map-sub-charts {
        display: none;
    }
}

.map-doc-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.map-doc-item {
    display: block;
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.map-doc-item:hover {
    background: rgba(13, 110, 253, 0.06);
    color: inherit;
}

.map-doc-item-title {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0.25rem;
}

.map-doc-pager {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding: 0.5rem 0.75rem;
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.map-doc-pager .page-link {
    font-size: 0.8rem;
    padding: 0.2rem 0.55rem;
}

/* 平板及以下：地图与文档上下排列 */
@media (max-width: 991.98px) {
    .map-workspace {
        margin: 0 0.5rem 1rem;
        height: calc(100vh - 200px);
        height: calc(100dvh - 200px);
        min-height: 520px;
        max-height: none;
        border-radius: 8px;
    }

    .map-workspace .ai-chat-header {
        padding: 0.5rem 0.75rem;
    }

    .map-workspace .ai-chat-header-content {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .map-header-left {
        order: 1;
        flex: 1 1 auto;
        min-width: 0;
    }

    .map-header-right {
        order: 2;
        flex-shrink: 0;
        margin-left: auto;
    }

    .map-breadcrumb {
        font-size: 0.8rem;
        -webkit-overflow-scrolling: touch;
    }

    .map-category-filter {
        font-size: 0.75rem;
        padding: 0.2rem 1.75rem 0.2rem 0.5rem;
        line-height: 1.3;
        min-height: 1.85rem;
    }

    .map-category-filter option,
    .map-category-filter .category-option {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
        line-height: 1.35;
    }

    .map-category-filter .category-option.level-1 {
        font-weight: 600;
        font-size: 0.76rem;
    }

    .map-category-filter .category-option.level-2 {
        font-size: 0.74rem;
    }

    .map-category-filter .category-option.level-3 {
        font-size: 0.72rem;
    }

    .map-workspace-body {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 34vh) minmax(280px, 1.35fr);
    }

    .map-chart-wrap {
        border-right: none;
        border-bottom: 1px solid #e5e5e5;
        min-height: 0;
    }

    .map-chart-inner {
        min-height: 0;
        padding: 0.35rem;
    }

    #mapChart {
        min-height: 0;
    }

    .map-geo-hint {
        top: 8px;
        bottom: auto;
        left: 8px;
        font-size: 0.72rem;
        max-width: calc(100% - 16px);
    }

    .map-doc-panel {
        min-height: 0;
    }

    .map-doc-panel-head {
        padding: 0.55rem 0.75rem;
    }

    .map-doc-panel-head .h6 {
        font-size: 0.9rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .map-doc-list {
        max-height: none;
        -webkit-overflow-scrolling: touch;
    }

    .map-doc-item {
        padding: 0.65rem 0.75rem;
        -webkit-tap-highlight-color: rgba(13, 110, 253, 0.1);
    }

    .map-doc-item-title {
        font-size: 0.85rem;
    }

    .map-doc-pager .page-link {
        min-height: 2rem;
        display: inline-flex;
        align-items: center;
    }

    .map-workspace .ai-chat-header-center {
        display: none !important;
    }
}

/* 手机竖屏 */
@media (max-width: 575.98px) {
    .map-workspace {
        margin: 0 0.25rem 0.5rem;
        height: calc(100vh - 140px);
        height: calc(100dvh - 140px);
        min-height: 520px;
    }

    .map-workspace .ai-chat-header {
        padding: 0.45rem 0.5rem;
    }

    .map-workspace .ai-chat-header-content {
        flex-direction: column;
        align-items: stretch;
    }

    .map-header-left,
    .map-header-right {
        order: unset;
        width: 100%;
        margin-left: 0;
    }

    .map-category-filter {
        min-width: 0;
        max-width: none;
        width: 100%;
        font-size: 0.7rem;
        padding: 0.18rem 1.6rem 0.18rem 0.45rem;
        min-height: 1.75rem;
    }

    .map-category-filter option,
    .map-category-filter .category-option {
        font-size: 0.7rem;
        padding: 0.15rem 0.35rem;
    }

    .map-category-filter .category-option.level-1 {
        font-size: 0.71rem;
    }

    .map-category-filter .category-option.level-2 {
        font-size: 0.69rem;
    }

    .map-category-filter .category-option.level-3 {
        font-size: 0.67rem;
    }

    .map-breadcrumb {
        font-size: 0.75rem;
    }

    .map-workspace-body {
        grid-template-rows: minmax(0, 28vh) minmax(300px, 1.6fr);
    }

    .map-doc-panel-head {
        padding: 0.45rem 0.6rem;
    }

    .map-doc-pager {
        padding: 0.4rem 0.5rem;
    }

    .map-doc-panel-head small {
        font-size: 0.72rem;
    }

    .map-doc-item-title {
        font-size: 0.82rem;
        line-height: 1.35;
    }

    .map-doc-item .small {
        font-size: 0.72rem;
    }
}
