/* 全球实时地震地图 /dizhen：对齐 map.css 工作区风格 + 站点主题变量 */

.eq-workspace {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: clamp(540px, calc(100vh - 210px), 820px);
    min-height: clamp(540px, calc(100vh - 210px), 820px);
    background: #f7f7f7;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 0;
}

/* 头部：两行紧凑布局（行1 状态+视图切换；行2 统计卡+筛选工具栏，搜索框弹性填满剩余空间） */
.eq-workspace .ai-chat-header.eq-header {
    margin: 0;
    padding: 0.55rem 0.85rem;
}

.eq-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.eq-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    /* 工具栏统一高度变量：统计卡与所有筛选控件共同锁定，垂直居中一致 */
    --eq-ctl-h: 42px;
}

.eq-toolbar-divider {
    width: 1px;
    align-self: stretch;
    background: #e9ecef;
    margin: 0 0.1rem;
}

.eq-toolbar-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    flex: 1;
    min-width: 250px;
}

.eq-refresh-btn {
    padding: 0.2rem 0.55rem;
    flex-shrink: 0;
    /* 全站 .btn 默认 margin-bottom:6px，在工具栏里会破坏垂直对齐 */
    margin-bottom: 0;
}

/* 筛选控件统一高度 + 垂直居中：与左侧统计卡完全对齐 */
.eq-toolbar-controls .eq-select,
.eq-toolbar-controls .eq-search,
.eq-toolbar-controls .eq-refresh-btn {
    height: var(--eq-ctl-h, 42px);
}

.eq-toolbar-controls .eq-select,
.eq-toolbar-controls .eq-search {
    line-height: calc(var(--eq-ctl-h, 42px) - 2px);
    padding-top: 0;
    padding-bottom: 0;
}

.eq-toolbar-controls .eq-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.eq-toolbar-controls .eq-refresh-btn i {
    font-size: 1.25rem;
    line-height: 1;
}

.eq-update-line {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.5rem;
    font-size: 0.76rem;
}

/* 实时状态点：绿色呼吸；stale 时转橙放缓 */
.eq-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #22c55e;
    flex-shrink: 0;
    animation: eqPulse 2s ease-out infinite;
}

@keyframes eqPulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
    70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.eq-update-line.stale .eq-live-dot {
    background: #f59e0b;
    animation: eqPulseStale 4s ease-out infinite;
}

@keyframes eqPulseStale {
    0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.45); }
    70% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.eq-live-label {
    color: #198754;
    font-weight: 600;
}

.eq-update-line.stale .eq-live-label {
    color: #b45309;
}

.eq-update-sep {
    color: #ced4da;
}

.eq-update-time {
    color: #6c757d;
    font-variant-numeric: tabular-nums;
}

.eq-stale-badge {
    display: inline-block;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    font-size: 0.7rem;
    line-height: 1.5;
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
    font-weight: 600;
}

/* 统计卡：内容自适应宽度，紧贴工具栏左侧 */
.eq-stats-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.eq-stat {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: var(--eq-ctl-h, 42px);
    background: #fff;
    border: 1px solid rgba(var(--bs-primary-rgb, 33, 99, 232), 0.14);
    border-radius: 0.625rem;
    padding: 0.3rem 0.62rem;
    min-width: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.eq-stat:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.07);
    border-color: rgba(var(--bs-primary-rgb, 33, 99, 232), 0.32);
}

.eq-stat-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 0.55rem;
    background: rgba(var(--bs-primary-rgb, 33, 99, 232), 0.1);
    color: var(--bs-primary, #2163e8);
    font-size: 1.25rem;
    line-height: 1;
}

.eq-stat-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.eq-stat b {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: #212529;
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 仅标签文字（在 eq-stat-body 内）——不能写成 .eq-stat span，会误伤图标容器 .eq-stat-icon */
.eq-stat-body span {
    display: block;
    color: #98a2ab;
    font-size: 0.7rem;
    margin-top: 0.1rem;
}

/* 最大震级警示色（JS 按档位注入，M4+ 才着色） */
.eq-stat b.eq-mag-warn {
    font-weight: 800;
}

.eq-view-switch .btn {
    padding: 0.2rem 0.7rem;
    font-size: 0.8rem;
    margin-bottom: 0;
}

.eq-select {
    width: auto;
    min-width: 88px;
    max-width: 168px;
    font-size: 0.8rem;
}

.eq-select#eqFeed {
    min-width: 142px;
}

/* 搜索框：弹性填满工具栏剩余空间（消灭留白的核心） */
.eq-search {
    flex: 1 1 120px;
    width: auto;
    min-width: 110px;
    font-size: 0.8rem;
}

.eq-workspace-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(290px, 32%);
    gap: 0;
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    background: #fff;
    align-items: stretch;
}

.eq-chart-wrap {
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid #e5e5e5;
    position: relative;
    margin: 0;
}

.eq-chart-inner {
    flex: 1;
    min-height: 0;
    height: 100%;
    padding: 0.5rem;
    position: relative;
}

#eqChart {
    width: 100%;
    height: 100%;
    min-height: 0;
}

.eq-legend-hint {
    position: absolute;
    left: 12px;
    bottom: 10px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.375rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.74rem;
    color: #6c757d;
    flex-wrap: wrap;
    max-width: 92%;
}

.eq-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    margin-right: 0.25rem;
    vertical-align: -1px;
}

.eq-dot[data-mag="lt4"] { background: #8aa0b7; }
.eq-dot[data-mag="4"] { background: #37d67a; }
.eq-dot[data-mag="5"] { background: #ffd43b; }
.eq-dot[data-mag="6"] { background: #ff8f1f; }
.eq-dot[data-mag="7"] { background: #ff3b30; }

.eq-mobile-toggle {
    position: absolute;
    right: 12px;
    bottom: 10px;
    z-index: 3;
    background: rgba(255, 255, 255, 0.92);
}

.eq-side-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
    min-height: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    background: #fff;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* 侧栏统一标题栏：震情列表 / 政策文档（与列表同宽同边距，左侧色条用 inset 不占布局空隙） */
.eq-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-shrink: 0;
    margin: 0;
    padding: 0.55rem 0.85rem;
    background-color: #eef4ff;
    background-image: linear-gradient(
        90deg,
        rgba(var(--bs-primary-rgb, 33, 99, 232), 0.14) 0%,
        #f7f9fc 100%
    );
    border: 0;
    border-bottom: 1px solid #e5e5e5;
    box-shadow: inset 3px 0 0 var(--bs-primary, #2163e8);
}

.eq-panel-head-main {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.eq-panel-head-icon {
    flex-shrink: 0;
    width: 1.15rem;
    text-align: center;
    color: var(--bs-primary, #2163e8);
    font-size: 0.82rem;
}

.eq-panel-head-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: 0.01em;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.eq-panel-head-link {
    flex-shrink: 0;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--bs-primary, #2163e8);
    text-decoration: none;
    white-space: nowrap;
}

.eq-panel-head-link:hover {
    text-decoration: underline;
}

/* 兼容旧类名（若缓存未刷新） */
.eq-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid #ececec;
    font-size: 0.88rem;
    font-weight: 700;
}

.eq-map-link {
    font-size: 0.74rem;
    color: var(--bs-primary);
    text-decoration: none;
    font-weight: 600;
}

.eq-map-link:hover {
    text-decoration: underline;
}

/* 震点悬停详情（ECharts tooltip html） */
.eq-echarts-tooltip .eq-tip {
    line-height: 1.45;
    min-width: 160px;
}

.eq-echarts-tooltip .eq-tip-place {
    font-weight: 700;
    font-size: 13px;
    color: #212529;
    margin-bottom: 4px;
}

.eq-echarts-tooltip .eq-tip-sub {
    font-size: 11px;
    color: #6c757d;
    margin: -2px 0 6px;
}

.eq-echarts-tooltip .eq-tip-mag {
    font-size: 12.5px;
    color: #343a40;
    margin-bottom: 2px;
}

.eq-echarts-tooltip .eq-tip-mag b {
    color: #c2410c;
}

.eq-echarts-tooltip .eq-tip-time {
    font-size: 12px;
    color: #495057;
}

.eq-echarts-tooltip .eq-tip-ago {
    color: #6c757d;
    margin-left: 2px;
}

.eq-echarts-tooltip .eq-tip-tsunami {
    margin-top: 6px;
    padding-top: 5px;
    border-top: 1px dashed rgba(180, 83, 9, 0.35);
    color: #b45309;
    font-size: 12px;
    font-weight: 600;
}

.eq-list {
    /* 不参与 flex 伸缩：按内容自然高度；侧栏整体滚动由 .eq-side-panel 承担 */
    flex: none;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
}

.eq-item {
    display: block;
    margin: 0;
    padding: 0.55rem 0.85rem;
    border: 0;
    border-bottom: 1px solid #eef0f2;
    background: #fff;
    cursor: pointer;
    transition: background 0.15s ease;
}

.eq-list .eq-item:last-child {
    border-bottom: 0;
}

.eq-item:hover {
    background: #f8f9fa;
}

/* 选中态与标题栏区分：不用左侧色条 / 主题渐变，仅浅灰底 + 右侧震级强调 */
.eq-item.active {
    background: #f3f4f6;
}

.eq-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.eq-item-place {
    font-size: 0.82rem;
    font-weight: 500;
    color: #374151;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.eq-item-en {
    display: block;
    color: #98a2ab;
    font-size: 0.7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 400;
}

.eq-mag-badge {
    flex-shrink: 0;
    display: inline-block;
    min-width: 44px;
    text-align: center;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
}

.eq-item-meta {
    display: flex;
    gap: 0.6rem;
    color: #6c757d;
    font-size: 0.72rem;
    margin-top: 0.2rem;
    flex-wrap: wrap;
}

.eq-item-meta .eq-tsunami {
    color: #b45309;
    font-weight: 600;
}

.eq-detail {
    margin: 0;
    border: 0;
    border-bottom: 1px solid #e5e5e5;
    padding: 0.65rem 0.85rem;
    background: rgba(var(--bs-primary-rgb, 33, 99, 232), 0.04);
    /* 不被 flex 压缩：压缩后内容溢出会与下方列表/文档面板视觉重叠 */
    flex-shrink: 0;
    min-height: 0;
    overflow-y: auto;
}

.eq-detail-title {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.eq-detail-title .eq-mag-badge {
    font-size: 0.85rem;
}

.eq-detail-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: #495057;
    padding: 0.1rem 0;
}

.eq-detail-row .k {
    color: #6c757d;
    flex-shrink: 0;
}

.eq-detail-row .v {
    text-align: right;
    word-break: break-all;
}

.eq-detail-row a {
    color: var(--bs-primary);
    text-decoration: none;
}

.eq-detail-row a:hover {
    text-decoration: underline;
}

.eq-doc-panel {
    margin: 0;
    padding: 0;
    flex-shrink: 0;
    border: 0;
    border-top: 1px solid #e5e5e5;
    /* 不限高度：随文档条数自然撑开 */
}

.eq-doc-panel .eq-panel-head {
    /* 与上方列表仅一条分隔线，避免标题再叠一条 top border */
    border-top: 0;
}

.eq-doc-body {
    margin: 0;
    padding: 0.45rem 0.85rem 0.7rem;
    border: 0;
}

.eq-doc-panel h3,
.eq-doc-panel h5 {
    display: none; /* 已改用 .eq-panel-head */
}

.eq-doc-item {
    display: block;
    padding: 0.3rem 0;
    font-size: 0.78rem;
    color: var(--bs-primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.eq-doc-item:hover {
    text-decoration: underline;
}

.eq-doc-meta {
    display: block;
    color: #98a2ab;
    font-size: 0.7rem;
    font-weight: 400;
}

.eq-doc-more {
    display: inline-block;
    margin-top: 0.25rem;
    font-size: 0.74rem;
    color: var(--bs-primary);
    text-decoration: none;
}

.eq-source-line {
    padding: 0.45rem 0.9rem;
    background: #fafafa;
    border-top: 1px solid #ececec;
    color: #98a2ab;
    font-size: 0.72rem;
    text-align: center;
}

.eq-source-line a {
    color: #6c757d;
}

/* 响应式：md 以下侧栏转抽屉（对齐 iPad 规范） */
@media (max-width: 991.98px) {
    .eq-workspace {
        height: calc(100vh - 170px);
        min-height: 520px;
    }

    .eq-workspace-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .eq-side-panel {
        position: absolute;
        inset: 0 0 0 auto;
        width: min(86%, 380px);
        z-index: 5;
        transform: translateX(100%);
        transition: transform 0.25s ease;
        box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
    }

    .eq-workspace-body.eq-show-list .eq-side-panel {
        transform: translateX(0);
    }

    /* 窄屏：统计卡满宽一行，隐藏分隔线，筛选控件独占下一行 */
    .eq-stats-row {
        width: 100%;
    }

    .eq-stats-row .eq-stat {
        flex: 1;
    }

    .eq-toolbar-divider {
        display: none;
    }

    .eq-toolbar-controls {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .eq-toolbar {
        --eq-ctl-h: 38px;
    }

    .eq-stats-row {
        gap: 0.35rem;
    }

    .eq-stat {
        padding: 0.32rem 0.45rem;
        gap: 0.4rem;
        border-radius: 0.5rem;
    }

    .eq-stat-icon {
        width: 28px;
        height: 28px;
        border-radius: 0.45rem;
        font-size: 1.05rem;
    }
    .eq-stat b {
        font-size: 0.9rem;
    }

    .eq-stat-body span {
        font-size: 0.66rem;
    }

    .eq-live-label {
        display: none;
    }

    .eq-update-sep {
        display: none;
    }

    .eq-select#eqFeed {
        min-width: 128px;
    }

    .eq-legend-hint {
        font-size: 0.68rem;
        gap: 0.45rem;
    }
}
