/* 主样式文件 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f6fa;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 300;
}

.header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.search-section {
    padding: 40px;
    background: #f8f9fa;
}

.search-form {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 20px;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
}

.form-group input, .form-group select {
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #3498db;
}

.search-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.search-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.results-section {
    padding: 40px;
    min-height: 400px;
}

.loading {
    text-align: center;
    padding: 60px;
    color: #7f8c8d;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.result-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.result-header {
    display: flex;
    justify-content: between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.result-title {
    font-size: 1.3em;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.severity-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.severity-extreme { background: #e74c3c; color: white; }
.severity-high { background: #f39c12; color: white; }
.severity-medium { background: #f1c40f; color: #2c3e50; }
.severity-low { background: #27ae60; color: white; }
.severity-unknown { background: #95a5a6; color: white; }

.result-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 12px;
    color: #7f8c8d;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 4px;
}

.meta-value {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 500;
}

.result-description {
    color: #34495e;
    line-height: 1.6;
    margin-bottom: 15px;
}

.result-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #ecf0f1;
}

.source-link {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

.source-link:hover {
    text-decoration: underline;
}

.confidence {
    font-size: 12px;
    color: #7f8c8d;
}

.no-results {
    text-align: center;
    padding: 60px;
    color: #7f8c8d;
}

.stats {
    background: #ecf0f1;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.stat-card-primary {
    border-left-color: #3498db;
}

.stat-card-success {
    border-left-color: #27ae60;
}

.stat-card-warning {
    border-left-color: #f39c12;
}

.stat-card-danger {
    border-left-color: #e74c3c;
}

.stat-icon {
    font-size: 2em;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 1.8em;
    font-weight: bold;
    color: #2c3e50;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.9em;
    color: #7f8c8d;
    margin-top: 5px;
}

/* 图表区域 */
.dashboard-charts {
    margin-bottom: 30px;
}

.chart-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.chart-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chart-card h3 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 1.1em;
    font-weight: 600;
}

.chart-container {
    position: relative;
    height: 300px;
}

/* 仪表盘内容网格 */
.dashboard-content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ecf0f1;
}

.section-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.1em;
    font-weight: 600;
}

.icon-btn {
    background: #ecf0f1;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: #d5dbdb;
    transform: rotate(90deg);
}

/* 最近事件列表 */
.recent-events-list {
    max-height: 400px;
    overflow-y: auto;
}

.recent-event-item {
    padding: 12px;
    border-bottom: 1px solid #ecf0f1;
    transition: background 0.2s;
    cursor: pointer;
}

.recent-event-item:hover {
    background: #f8f9fa;
}

.recent-event-item:last-child {
    border-bottom: none;
}

.event-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.event-item-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95em;
}

.event-item-date {
    font-size: 0.85em;
    color: #7f8c8d;
}

.event-item-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85em;
    color: #7f8c8d;
}

.event-item-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.loading-placeholder {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

/* 地图区域 */
.dashboard-map-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.dashboard-map-container {
    margin-top: 15px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e1e5e9;
}

.dashboard-map {
    width: 100%;
    height: 0;
    padding-bottom: 55%; /* 高度为宽度的55% */
    position: relative;
}

.dashboard-map > div {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.map-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.country-filter-select {
    padding: 8px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 0.9em;
    background: white;
    color: #2c3e50;
    cursor: pointer;
    transition: border-color 0.2s;
}

.country-filter-select:focus {
    outline: none;
    border-color: #3498db;
}

/* 快速操作 */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.quick-action-btn {
    padding: 15px 20px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
}

.quick-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.quick-action-btn:active {
    transform: translateY(0);
}

.search-info-section {
    padding: 20px 40px;
    background: #e8f4fd;
    border-top: 1px solid #bde0ff;
    margin: 0;
}

.search-info {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #3498db;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.search-info h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.search-info p {
    margin-bottom: 8px;
    color: #34495e;
    font-size: 0.95em;
}

.search-info p:last-child {
    margin-bottom: 0;
}

/* ==================== 多页面布局样式 ==================== */

.app-container {
    display: flex;
    min-height: 100vh;
    background: #f5f6fa;
}

/* 侧边栏样式 */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

/* 确保侧边栏内容可以正确布局，用户信息在底部 */
.sidebar > * {
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-title {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
    color: white;
    line-height: 1.4;
}

.title-icon {
    font-size: 1.3em;
    flex-shrink: 0;
    margin-top: 2px;
}

.title-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.title-line1,
.title-line2 {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95em;
    line-height: 1.3;
}

.title-line1 {
    font-weight: 600;
}

.title-line2 {
    font-weight: 400;
    opacity: 0.9;
    font-size: 0.85em;
}

/* 全局查询区域 */
.global-query-section {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.1);
}

.global-query-section h3 {
    font-size: 1em;
    margin-bottom: 15px;
    color: white;
    font-weight: 600;
}

/* 快速日期选择器（页面上的） */
.quick-date-selector-page {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
}

.quick-date-label {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-right: 5px;
}

.quick-date-btn-page {
    padding: 8px 16px;
    border: 2px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.2s;
}

.quick-date-btn-page:hover {
    background: #e8f4fd;
    border-color: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.2);
}

.quick-date-btn-page:active {
    background: #d4e6f1;
    transform: translateY(0);
}

.query-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.query-form .form-group {
    display: flex;
    flex-direction: column;
}

.query-form label {
    font-size: 0.85em;
    margin-bottom: 5px;
    color: rgba(255,255,255,0.9);
    font-weight: 500;
}

.query-form .form-input {
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 0.9em;
    transition: all 0.3s;
}

.query-form .form-input:focus {
    outline: none;
    border-color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.15);
}

.query-form .form-input::placeholder {
    color: rgba(255,255,255,0.5);
}

.query-btn {
    padding: 10px 16px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 5px;
}

.query-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.query-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
}

.query-status {
    font-size: 0.8em;
    padding: 8px;
    border-radius: 4px;
    margin-top: 5px;
    min-height: 20px;
}

/* 导航菜单 */
.sidebar-nav {
    flex: 1;
    padding: 10px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left-color: #3498db;
    font-weight: 600;
}

.nav-icon {
    font-size: 1.2em;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.nav-text {
    font-size: 0.95em;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 280px;
    background: #f5f6fa;
    min-height: 100vh;
    position: relative;
}

/* 右上角语言切换器 */
.top-language-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    display: flex;
    gap: 8px;
    align-items: center;
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    /* 确保不随页面滚动 */
    position: fixed !important;
}

.page-container {
    padding: 30px;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e1e5e9;
}

.page-header h2 {
    font-size: 1.8em;
    color: #2c3e50;
    margin: 0;
    font-weight: 600;
}

.page-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 8px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.page-body {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* 信息卡片 */
.info-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 25px;
    border-left: 4px solid #3498db;
}

.info-card h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.info-card p {
    color: #7f8c8d;
    line-height: 1.6;
}

/* 参考网站区域样式 */
.reference-sites-section {
    margin-top: 30px;
    padding: 30px 0;
}

.reference-sites-header {
    margin-bottom: 30px;
    text-align: center;
}

.reference-sites-header h3 {
    font-size: 1.8em;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 600;
}

.reference-sites-subtitle {
    color: #7f8c8d;
    font-size: 1em;
    margin: 0;
}

.reference-sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 25px;
}

.reference-site-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #e1e5e9;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.reference-site-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-color: #3498db;
}

.site-card-header {
    padding: 20px 20px 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e1e5e9;
}

.site-icon {
    font-size: 2.5em;
    line-height: 1;
}

.site-category {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reference-site-card[data-category="emergency"] .site-category {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.reference-site-card[data-category="monitoring"] .site-category {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.reference-site-card[data-category="meteorology"] .site-category {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
}

.reference-site-card[data-category="media"] .site-category {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
}

.site-card-body {
    padding: 20px;
    flex-grow: 1;
}

.site-name {
    font-size: 1.2em;
    color: #2c3e50;
    margin: 0 0 12px 0;
    font-weight: 600;
    line-height: 1.4;
}

.site-description {
    color: #7f8c8d;
    font-size: 0.95em;
    line-height: 1.6;
    margin: 0;
}

.site-card-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e1e5e9;
}

.site-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95em;
    transition: all 0.2s;
    padding: 8px 16px;
    border-radius: 6px;
    background: white;
    border: 1px solid #e1e5e9;
}

.site-link:hover {
    color: #2980b9;
    background: #e8f4f8;
    border-color: #3498db;
    transform: translateX(3px);
}

.link-icon {
    font-size: 1.1em;
    transition: transform 0.2s;
}

.site-link:hover .link-icon {
    transform: translate(2px, -2px);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .reference-sites-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .reference-sites-header h3 {
        font-size: 1.5em;
    }
    
    .site-card-header {
        padding: 15px;
    }
    
    .site-card-body {
        padding: 15px;
    }
    
    .site-name {
        font-size: 1.1em;
    }
}

.query-info {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
}

.query-hint {
    background: #e8f4fd;
    border-left: 4px solid #3498db;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    color: #2c3e50;
}

.query-hint p {
    margin: 0;
    font-size: 0.95em;
}

.dashboard-content {
    margin-top: 25px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .page-container {
        padding: 15px;
    }
    
    .global-query-section {
        padding: 15px;
    }
    
    .search-form {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .result-meta {
        grid-template-columns: 1fr;
    }
    
    .result-footer {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .search-info-section {
        padding: 15px 20px;
    }
}

