:root {
    --primary-color: #3498db;
    --panel-bg: rgba(20, 25, 35, 0.75);
    --text-color: #ffffff;
    --accent-color: #00d2ff;
    --danger-color: #e74c3c;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    background-color: #1a1a1a;
}

#map {
    width: 100%;
    height: 100%;
}

/* === 控制面板 === */
.control-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 280px;
    background: var(--panel-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    color: var(--text-color);
    max-height: 90vh;
    overflow-y: auto;
}

.panel-header {
    margin-bottom: 15px;
}

.panel-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

#update-time {
    display: block;
    font-size: 12px;
    color: #aaa;
    margin-top: 5px;
}

/* 搜索框样式 */
.search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.search-box input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 8px 12px;
    color: white;
    outline: none;
    font-size: 14px;
}

.search-box input:focus {
    border-color: var(--primary-color);
    background: rgba(0, 0, 0, 0.5);
}

.search-box button {
    background: var(--primary-color);
    border: none;
    border-radius: 6px;
    width: 36px;
    color: white;
    cursor: pointer;
    transition: background 0.3s;
}

.search-box button:hover {
    background: var(--accent-color);
}

/* 新增：清除按钮特定样式 */
#clear-btn {
    background: rgba(255, 255, 255, 0.2); /* 默认半透明灰色 */
    margin-left: 5px; /* 与搜索按钮隔开一点 */
}

#clear-btn:hover {
    background: var(--danger-color); /* 悬停变红 */
}

/* 台风信息概览 */
.typhoon-info {
    font-size: 13px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
    border-radius: 6px;
    border-left: 3px solid var(--accent-color);
    margin-bottom: 10px;
}

.divider {
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 15px 0;
}

.button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.layer-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    padding: 10px;
    color: #ccc;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 13px;
}

.layer-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.layer-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: #fff;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
    font-weight: bold;
}

.loading {
    margin-top: 15px;
    text-align: center;
    font-size: 14px;
    color: var(--accent-color);
}

.hidden {
    display: none;
}

/* === 图例面板 === */
.legend-panel {
    position: absolute;
    bottom: 30px;
    left: 20px;
    width: 100px;
    background: var(--panel-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    color: var(--text-color);
    max-height: 400px;
    overflow-y: auto;
}

.legend-panel h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    font-size: 12px;
}

.legend-color {
    width: 20px;
    height: 12px;
    border-radius: 2px;
    margin-right: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* === 弹窗样式 === */
.ol-popup {
    position: absolute;
    background: var(--panel-bg);
    color: var(--text-color);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    bottom: 12px;
    left: -50px;
    min-width: 220px;
    z-index: 2000;
}

.ol-popup:after,
.ol-popup:before {
    top: 100%;
    border: solid transparent;
    content: " ";
    height: 0;
    width: 0;
    position: absolute;
    pointer-events: none;
}

.ol-popup:after {
    border-top-color: white;
    border-width: 10px;
    left: 48px;
    margin-left: -10px;
}

.ol-popup:before {
    border-top-color: #cccccc;
    border-width: 11px;
    left: 48px;
    margin-left: -11px;
}

.ol-popup-closer {
    text-decoration: none;
    position: absolute;
    top: 5px;
    right: 8px;
    color: #999;
    /* 新增下面两行，启用 Font Awesome */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    transition: color 0.3s;
}

.ol-popup-closer:hover {
    color: var(--danger-color); /* 鼠标悬停变红 */
}

.ol-popup-closer:after {
    content: "\f00d"; /* 这是 Font Awesome 的 'X' 图标代码 */
}

.popup-row {
    margin-bottom: 5px;
    font-size: 13px;
    color: #ffffff;
    line-height: 1.4;
}

.popup-row strong {
    color: #ffffff;
}

/* 气象数值样式 */
.popup-val {
    font-size: 20px;
    font-weight: bold;
    color: var(--danger-color);
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    margin-bottom: 5px;
}

/* 台风弹窗样式 */
.popup-header-typhoon {
    border-bottom: 2px solid var(--danger-color);
    margin-bottom: 8px;
    padding-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popup-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: white;
    font-weight: bold;
}

/* === 新增：左侧排行榜面板 === */
.rank-panel {
    position: absolute;
    top: 20px;
    left: 20px; /* 放在左侧 */
    width: 280px;
    background: var(--panel-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    color: var(--text-color);
    max-height: 80vh; /* 防止太长溢出 */
    display: flex;
    flex-direction: column;
}

/* Tab 切换按钮 */
.rank-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 10px;
}

.rank-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: #aaa;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.3s;
}

.rank-tab-btn.active {
    background: var(--primary-color);
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.rank-tab-btn:hover:not(.active) {
    color: white;
    background: rgba(255,255,255,0.05);
}

/* 列表区域 */
.rank-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px; /* 给滚动条留空 */
}

/* 单个排名项 */
.rank-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 13px;
}

.rank-row:last-child {
    border-bottom: none;
}

.rank-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 排名数字徽章 */
.rank-num {
    width: 20px;
    height: 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 11px;
    font-weight: bold;
    color: #ddd;
}

/* 前三名特殊颜色 */
.rank-row.top-1 .rank-num { background: #f1c40f; color: #333; box-shadow: 0 0 8px rgba(241, 196, 15, 0.4); } /* 金 */
.rank-row.top-2 .rank-num { background: #bdc3c7; color: #333; } /* 银 */
.rank-row.top-3 .rank-num { background: #cd7f32; color: #fff; } /* 铜 */

.rank-station {
    color: #eee;
}

.rank-value {
    font-weight: bold;
    font-family: monospace; /* 等宽字体让数字对齐 */
    font-size: 14px;
}

/* --- 基础特殊按钮样式优化 --- */
.special-btn {
    grid-column: span 2;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 2px;
}

.status-text {
    font-size: 10px;
    opacity: 0.7;
    margin-left: 5px;
    font-weight: normal;
}

/* --- 1. 雷达按钮配色 (紫色) --- */
.btn-radar {
    background: rgba(142, 68, 173, 0.2);
    color: #dcd0ff;
    border-color: rgba(155, 89, 182, 0.3);
}
.btn-radar:hover {
    background: rgba(142, 68, 173, 0.4);
    color: #fff;
}
.btn-radar.active {
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
    color: #fff;
    border-color: #fff;
    box-shadow: 0 0 15px rgba(142, 68, 173, 0.5);
}

/* --- 2. 云图按钮配色 (深蓝/灰) --- */
.btn-cloud {
    background: rgba(52, 73, 94, 0.3);
    color: #bdc3c7;
    border-color: rgba(52, 73, 94, 0.4);
}
.btn-cloud:hover {
    background: rgba(52, 73, 94, 0.5);
    color: #fff;
}
.btn-cloud.active {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: #fff;
    border-color: #fff;
    box-shadow: 0 0 15px rgba(44, 62, 80, 0.5);
}

/* --- 3. 预警按钮配色 (红色) --- */
.btn-warning {
    background: rgba(192, 57, 43, 0.2);
    color: #ff9a9a;
    border-color: rgba(231, 76, 60, 0.3);
}
.btn-warning:hover {
    background: rgba(192, 57, 43, 0.4);
    color: #fff;
}
.btn-warning.active {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: #fff;
    border-color: #fff;
    box-shadow: 0 0 15px rgba(192, 57, 43, 0.6);
}

/* --- 4. 用户气象站按钮配色 (青绿色) --- */
.btn-user-station {
    background: rgba(16, 185, 129, 0.2);
    color: #a7f3d0;
    border-color: rgba(16, 185, 129, 0.3);
}
.btn-user-station:hover {
    background: rgba(16, 185, 129, 0.4);
    color: #fff;
}
.btn-user-station.active {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    border-color: #fff;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
}

/* 按钮内图标旋转动画 */
.fa-spin {
    animation: fa-spin 2s infinite linear;
}