/* 空气质量监测平台 - 主样式文件 */

/* 引入台风监测模块的基础样式 */
@import url('../typhoon/variables.css');
@import url('../typhoon/layout.css');
@import url('../typhoon/panels.css');
@import url('../typhoon/modals.css');
@import url('../typhoon/animations.css');

/* =====================
   AQI 等级颜色变量
   ===================== */
:root {
    --aqi-excellent: #00e400;      /* 优 0-50 */
    --aqi-good: #ffff00;           /* 良 51-100 */
    --aqi-light: #ff7e00;          /* 轻度污染 101-150 */
    --aqi-moderate: #ff0000;       /* 中度污染 151-200 */
    --aqi-heavy: #99004c;          /* 重度污染 201-300 */
    --aqi-severe: #7e0023;         /* 严重污染 >300 */
}

/* =====================
   标题栏覆盖（空气质量主题）
   ===================== */
.title-bar {
    background: linear-gradient(135deg,
        rgba(10, 15, 26, 0.95) 0%,
        rgba(0, 60, 30, 0.85) 100%
    );
    border-bottom: 2px solid rgba(0, 228, 0, 0.4);
    box-shadow: 0 2px 20px rgba(0, 228, 0, 0.2);
}

.title-bar .title-content i {
    color: #00e400;
    text-shadow: 0 0 15px rgba(0, 228, 0, 0.6);
}

/* =====================
   AQI 站点样式
   ===================== */
.aqi-station-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.aqi-station-label {
    font-size: 11px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8),
                 -1px -1px 2px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
    pointer-events: none;
}

/* =====================
   AQI 信息面板
   ===================== */
.aqi-panel {
    position: absolute;
    top: calc(var(--title-bar-height) + 0.1rem);
    right: 0.1rem;
    width: 17rem;
    max-height: calc(100vh - 10rem);
    background: var(--panel-bg);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(0, 228, 0, 0.3);
    border-radius: var(--border-radius);
    box-shadow: 0 0 30px rgba(0, 228, 0, 0.2), 0 0 50px rgba(0, 228, 0, 0.1);
    z-index: 900;
    transition: transform 0.3s ease;
    overflow: hidden;
}

.aqi-panel.collapsed {
    transform: translateX(calc(100% - 3rem));
}

.aqi-panel .panel-header {
    border-bottom: 1px solid rgba(0, 228, 0, 0.3);
    background: rgba(0, 30, 15, 0.6);
}

.aqi-panel .panel-header i {
    color: #00e400;
    text-shadow: 0 0 10px rgba(0, 228, 0, 0.6);
}

.aqi-panel .panel-header span {
    color: #fff;
}

.aqi-panel .panel-toggle-btn {
    border-color: rgba(0, 228, 0, 0.3);
    color: #00e400;
}

.aqi-panel .panel-toggle-btn:hover {
    background: rgba(0, 228, 0, 0.1);
    box-shadow: 0 0 5px rgba(0, 228, 0, 0.4);
}

/* AQI 等级统计 */
.aqi-level-stats {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(0, 228, 0, 0.1);
}

.aqi-level-stats h5 {
    color: #00e400;
    font-size: 0.85rem;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.aqi-level-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.aqi-level-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
}

.aqi-level-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.aqi-level-dot.excellent { background: var(--aqi-excellent); }
.aqi-level-dot.good      { background: var(--aqi-good); }
.aqi-level-dot.light     { background: var(--aqi-light); }
.aqi-level-dot.moderate  { background: var(--aqi-moderate); }
.aqi-level-dot.heavy     { background: var(--aqi-heavy); }
.aqi-level-dot.severe    { background: var(--aqi-severe); }

.aqi-level-name {
    color: var(--text-secondary);
    flex: 1;
}

.aqi-level-count {
    font-weight: bold;
    color: var(--text-primary);
    min-width: 2rem;
    text-align: right;
}

/* AQI TOP10 列表 */
.aqi-top-list {
    padding: 0.8rem 1rem;
}

.aqi-top-list h5 {
    color: #00e400;
    font-size: 0.85rem;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* 城市列表折叠容器 */
.aqi-city-group {
    overflow: hidden;
    max-height: 500px;
    transition: max-height 0.25s ease;
}

.aqi-city-group.collapsed {
    max-height: 0;
}

/* 省标题行 */
.aqi-prov-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.4rem 0.2rem;
    margin-top: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.78rem;
    transition: background 0.2s;
    border-radius: 4px;
}

.aqi-prov-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.aqi-prov-toggle {
    color: var(--text-secondary);
    font-size: 0.65rem;
    width: 0.8rem;
    flex-shrink: 0;
}

.aqi-prov-name {
    flex: 1;
    color: var(--text-primary);
    font-weight: bold;
    font-size: 0.8rem;
}

.aqi-prov-avg {
    font-weight: bold;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 0.75rem;
}

.aqi-top-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 4px;
    padding: 0.25rem 0.4rem 0.25rem 1rem;
}

.aqi-top-item:hover {
    background: rgba(0, 228, 0, 0.08);
}

.aqi-top-rank {
    width: 1.2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.7rem;
    flex-shrink: 0;
}

.aqi-top-rank.rank-1 { color: #ff4444; font-weight: bold; }
.aqi-top-rank.rank-2 { color: #ff7700; font-weight: bold; }
.aqi-top-rank.rank-3 { color: #ffaa00; font-weight: bold; }

.aqi-top-name {
    flex: 1;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aqi-top-city {
    color: var(--text-secondary);
    font-size: 0.72rem;
    flex-shrink: 0;
}

.aqi-top-value {
    font-weight: bold;
    min-width: 2.5rem;
    text-align: right;
    border-radius: 3px;
    padding: 1px 4px;
    font-size: 0.78rem;
    flex-shrink: 0;
}

.aqi-foreign-toggle {
    margin-top: 0.45rem;
}

.aqi-foreign-header {
    border-bottom-color: rgba(94, 194, 255, 0.3);
}

.aqi-foreign-item {
    padding-left: 1rem;
}

.aqi-country-tag {
    display: inline-block;
    max-width: 5rem;
    margin-right: 0.3rem;
    padding: 1px 5px;
    overflow: hidden;
    border: 1px solid rgba(94, 194, 255, 0.35);
    border-radius: 8px;
    color: #9bd8ff;
    font-size: 0.66rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    vertical-align: middle;
    white-space: nowrap;
}

.aqi-list-empty {
    padding: 1rem 0.5rem;
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-align: center;
}

/* AQI 数值颜色 */
.aqi-value-excellent { color: #000; background: var(--aqi-excellent); }
.aqi-value-good      { color: #000; background: var(--aqi-good); }
.aqi-value-light     { color: #fff; background: var(--aqi-light); }
.aqi-value-moderate  { color: #fff; background: var(--aqi-moderate); }
.aqi-value-heavy     { color: #fff; background: var(--aqi-heavy); }
.aqi-value-severe    { color: #fff; background: var(--aqi-severe); }

/* 数据更新时间 */
.aqi-data-time {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-top: 1px solid rgba(0, 228, 0, 0.1);
    text-align: center;
}

/* =====================
   图层面板 AQI 分组
   ===================== */
.layer-panel .group-header {
    cursor: pointer;
}

/* AQI 要素时间选择器 */
.aqi-element-selector {
    padding: 0.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.aqi-element-label {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: bold;
}

.aqi-element-select {
    width: 100%;
    padding: 5px 8px;
    background: var(--dark-bg);
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.82rem;
    cursor: pointer;
}

.aqi-element-select:hover {
    border-color: var(--primary-color);
    background: rgba(0, 212, 255, 0.05);
}

.aqi-element-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.aqi-element-select option {
    background: var(--dark-bg);
    color: var(--text-primary);
}

/* =====================
   站点详情弹窗
   ===================== */
.aqi-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    display: none;
}

.aqi-modal-overlay.show {
    display: block;
}

.aqi-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 680px;
    max-width: 95vw;
    max-height: 85vh;
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 228, 0, 0.3);
    border-radius: var(--border-radius);
    box-shadow: 0 0 40px rgba(0, 228, 0, 0.2);
    z-index: 2000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.aqi-modal.show {
    display: flex;
}

.aqi-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    background: rgba(0, 30, 15, 0.6);
    border-bottom: 1px solid rgba(0, 228, 0, 0.2);
    flex-shrink: 0;
}

.aqi-modal-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.aqi-modal-title h3 {
    font-size: 1.1rem;
    color: #fff;
    margin: 0;
}

.aqi-modal-title .city-tag {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}

.aqi-modal-close {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.aqi-modal-close:hover {
    background: rgba(255, 80, 80, 0.2);
    border-color: #ff5050;
    color: #ff5050;
}

.aqi-modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 1rem 1.2rem;
}

/* 当前AQI概览 */
.aqi-current-overview {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.aqi-big-number {
    font-size: 3rem;
    font-weight: bold;
    line-height: 1;
    min-width: 5rem;
    text-align: center;
}

.aqi-overview-info {
    flex: 1;
}

.aqi-level-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 0.4rem;
}

.aqi-primary-pollutant {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.aqi-obs-time {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

/* 污染物数据网格 */
.pollutant-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.pollutant-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    text-align: center;
    transition: background 0.2s;
}

.pollutant-card:hover {
    background: rgba(0, 228, 0, 0.06);
    border-color: rgba(0, 228, 0, 0.2);
}

.pollutant-name {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.pollutant-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-primary);
}

.pollutant-unit {
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-top: 0.1rem;
}

/* 历史图表区域 */
.aqi-history-section {
    margin-top: 0.5rem;
}

.aqi-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.aqi-history-section h4 {
    font-size: 0.9rem;
    color: #00e400;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.aqi-time-range-btns {
    display: flex;
    gap: 0.3rem;
}

.aqi-range-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(0,228,0,0.25);
    color: #aaa;
    font-size: 0.75rem;
    padding: 2px 9px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.aqi-range-btn:hover {
    border-color: rgba(0,228,0,0.6);
    color: #fff;
}

.aqi-range-btn.active {
    background: rgba(0,228,0,0.18);
    border-color: #00e400;
    color: #00e400;
}

.aqi-chart-container {
    width: 100%;
    height: 220px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

.aqi-pollutant-chart-container {
    width: 100%;
    height: 220px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

/* 加载状态 */
.aqi-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1rem;
    color: var(--text-secondary);
}

.aqi-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(0, 228, 0, 0.2);
    border-top-color: #00e400;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* =====================
   图例面板 AQI 扩展
   ===================== */
.aqi-legend-bar {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.3rem;
}

.aqi-legend-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
}

.aqi-legend-color {
    width: 28px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.aqi-legend-label {
    color: var(--text-secondary);
    flex: 1;
}

.aqi-legend-range {
    color: var(--text-secondary);
    font-size: 0.7rem;
    min-width: 3.5rem;
    text-align: right;
}

/* =====================
   火点图层控制
   ===================== */
.fire-time-selector {
    width: 100%;
    padding: 5px 8px;
    background: var(--dark-bg);
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.8rem;
    margin-top: 0.3rem;
    cursor: pointer;
}

.fire-time-selector:focus {
    outline: none;
    border-color: var(--primary-color);
}

.fire-time-selector option {
    background: var(--dark-bg);
    color: var(--text-primary);
}

.fire-scale-btns {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.4rem;
}

.fire-scale-btn {
    flex: 1;
    padding: 3px 0;
    background: var(--dark-bg);
    border: 1px solid var(--panel-border);
    border-radius: 3px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.fire-scale-btn.active,
.fire-scale-btn:hover {
    background: rgba(255, 100, 0, 0.2);
    border-color: #ff6400;
    color: #ff6400;
}

/* =====================
   响应式：小屏适配
   ===================== */
@media (max-width: 768px) {
    .aqi-modal {
        width: 95vw;
        max-height: 90vh;
    }

    .pollutant-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .aqi-current-overview {
        flex-direction: column;
        text-align: center;
    }
}
