* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'SimHei', 'Arial', sans-serif;
    background-color: #f8f9fa;
    color: #2c3e50;
    line-height: 1.6;
}

a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #1a252f;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.navbar {
    background-color: #ffffff;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    padding: 12px 0;
}

.navbar-brand {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c3e50;
    letter-spacing: 0.5px;
}

.navbar-brand:hover {
    color: #1a252f;
}

.nav-link {
    color: #5a6c7d;
    font-weight: 400;
    padding: 8px 16px;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.nav-link:hover {
    color: #2c3e50;
    background-color: #ecf0f1;
}

.nav-link.active {
    color: #2c3e50;
    background-color: #ecf0f1;
    font-weight: 500;
}

.card {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    margin-bottom: 24px;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 18px 22px;
    font-weight: 600;
    color: #2c3e50;
    letter-spacing: 0.5px;
}

.card-body {
    padding: 24px 22px;
}

.btn {
    border: none;
    border-radius: 6px;
    padding: 10px 22px;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-primary {
    background-color: #2c3e50;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #1a252f;
    color: #ffffff;
}

.btn-secondary {
    background-color: #95a5a6;
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
    color: #ffffff;
}

.btn-info {
    background-color: #2c3e50;
    color: #ffffff;
}

.btn-info:hover {
    background-color: #1a252f;
    color: #ffffff;
}

.btn-danger {
    background-color: #e74c3c;
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #c0392b;
    color: #ffffff;
}

.btn-success {
    background-color: #27ae60;
    color: #ffffff;
}

.btn-success:hover {
    background-color: #1e8449;
    color: #ffffff;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid #2c3e50;
    color: #2c3e50;
}

.btn-outline:hover {
    background-color: #2c3e50;
    color: #ffffff;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
}

.upload-area {
    border: 2px dashed #dfe6e9;
    border-radius: 6px;
    padding: 50px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fafbfc;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #2c3e50;
    background-color: #ecf0f1;
}

.upload-placeholder i {
    font-size: 56px;
    color: #95a5a6;
    margin-bottom: 18px;
}

.upload-placeholder p {
    font-size: 15px;
    margin-bottom: 8px;
    color: #5a6c7d;
    font-weight: 400;
}

.upload-placeholder .hint {
    font-size: 13px;
    color: #7f8c8d;
}

.result-placeholder {
    min-height: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fafbfc;
    border-radius: 6px;
    padding: 35px;
    border: 1px solid #e9ecef;
}

.loading-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.loading-content {
    background-color: #ffffff;
    padding: 45px 55px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.loading-content p {
    margin-top: 18px;
    font-size: 15px;
    color: #5a6c7d;
    font-weight: 400;
}

.spinner-border {
    width: 38px;
    height: 38px;
    border-color: #3498db;
    border-right-color: transparent;
}

.table {
    background-color: #ffffff;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    color: #2c3e50;
    font-weight: 600;
    padding: 14px;
    text-align: left;
    font-size: 0.9rem;
}

.table tbody td {
    border-bottom: 1px solid #e9ecef;
    padding: 14px;
    color: #5a6c7d;
    font-size: 0.95rem;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.badge {
    font-size: 0.8em;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.alert {
    border-radius: 8px;
    padding: 14px 18px;
    border: none;
    font-weight: 400;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.form-control,
.form-select {
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 11px 14px;
    font-size: 0.95rem;
    color: #2c3e50;
    background-color: #ffffff;
    transition: border-color 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: #2c3e50;
    outline: none;
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.modal-content {
    border-radius: 10px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    padding: 22px 26px;
    background-color: #f8f9fa;
}

.modal-body {
    padding: 26px;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 18px 26px;
}

.nav-tabs {
    border-bottom: 2px solid #e9ecef;
}

.nav-tabs .nav-link {
    border: none;
    color: #5a6c7d;
    padding: 11px 22px;
    font-weight: 400;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    color: #2c3e50;
    background-color: transparent;
}

.nav-tabs .nav-link.active {
    color: #2c3e50;
    background-color: transparent;
    border-bottom: 2px solid #2c3e50;
    font-weight: 600;
}

.pagination {
    margin-top: 26px;
}

.page-link {
    color: #2c3e50;
    border: 1px solid #dee2e6;
    padding: 7px 14px;
    transition: all 0.3s ease;
}

.page-link:hover {
    background-color: #ecf0f1;
    border-color: #2c3e50;
    color: #2c3e50;
}

.page-item.active .page-link {
    background-color: #2c3e50;
    border-color: #2c3e50;
    color: #ffffff;
}

.stat-card {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 22px;
    text-align: center;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

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

.stat-card .stat-value {
    font-size: 2.3rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.stat-card .stat-label {
    font-size: 0.9rem;
    color: #7f8c8d;
    letter-spacing: 0.5px;
}

.analysis-result {
    background-color: #fafbfc;
    border-radius: 8px;
    padding: 22px;
    margin-bottom: 18px;
    border: 1px solid #e9ecef;
}

.analysis-result h4 {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 18px;
    letter-spacing: 0.5px;
}

.analysis-result .result-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
}

.analysis-result .result-item:last-child {
    border-bottom: none;
}

.analysis-result .result-label {
    color: #5a6c7d;
    font-weight: 400;
}

.analysis-result .result-value {
    color: #2c3e50;
    font-weight: 600;
}

.light-type-item {
    display: flex;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #e9ecef;
}

.light-type-item:last-child {
    border-bottom: none;
}

.light-type-icon {
    width: 38px;
    height: 38px;
    background-color: #ecf6fd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
    color: #3498db;
}

.light-type-info {
    flex: 1;
}

.light-type-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.light-type-count {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.pollution-level {
    display: inline-block;
    padding: 7px 18px;
    border-radius: 18px;
    font-size: 0.9rem;
    font-weight: 500;
}

.pollution-level.低风险, .pollution-badge.低风险, .progress-bar-fill.低风险 {
    background-color: #10b981;
    color: #ffffff;
}

.pollution-level.轻度, .pollution-badge.轻度, .progress-bar-fill.轻度 {
    background-color: #3498db;
    color: #ffffff;
}

.pollution-level.中度, .pollution-badge.中度, .progress-bar-fill.中度 {
    background-color: #f59e0b;
    color: #ffffff;
}

.pollution-level.较高, .pollution-badge.较高, .progress-bar-fill.较高 {
    background-color: #ef4444;
    color: #ffffff;
}

.pollution-level.高风险, .pollution-badge.高风险, .progress-bar-fill.高风险 {
    background-color: #8e44ad;
    color: #ffffff;
}

.history-item {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 18px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
    border-color: #3498db;
    transform: translateY(-1px);
}

.history-item .history-time {
    color: #7f8c8d;
    font-size: 0.8rem;
    margin-bottom: 7px;
}

.history-item .history-filename {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 9px;
}

.history-item .history-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.history-status.analyzed {
    background-color: #d4edda;
    color: #155724;
}

.history-status.pending {
    background-color: #fff3cd;
    color: #856404;
}

footer {
    background-color: #ffffff;
    border-top: 1px solid #e9ecef;
    padding: 26px 0;
    margin-top: 50px;
    text-align: center;
    color: #7f8c8d;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .card-body {
        padding: 18px 15px;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .stat-card {
        margin-bottom: 18px;
    }
}

.hero-section {
    background: #2c3e50;
    padding: 60px 0 50px;
    margin-bottom: 30px;
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 400;
    color: #ffffff;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.hero-subtitle {
    font-size: 1rem;
    color: #bdc3c7;
    font-weight: 300;
    letter-spacing: 1px;
}

/* 搜索结果样式 */
#searchResults {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

#searchResults.poi-more {
    display: none !important;
}

/* 天地图搜索结果样式 */
#searchResults.tianditu_lib_placeSearch {
    border: none !important;
    background: white !important;
    padding: 0 !important;
}

#searchResults.tianditu_lib_placeSearch_list {
    max-height: 300px !important;
    overflow-y: auto !important;
}

#searchResults.tianditu_lib_placeSearch .poibox {
    border-bottom: 1px solid #e9ecef !important;
    padding: 12px 15px !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease !important;
}

#searchResults.tianditu_lib_placeSearch .poibox:hover {
    background-color: #f8f9fa !important;
}

#searchResults.tianditu_lib_placeSearch .poibox.selected {
    background-color: #e3f2fd !important;
    border-left: 3px solid #2196f3 !important;
}

#searchResults.tianditu_lib_placeSearch .poibox .poi-title {
    font-weight: 500 !important;
    color: #333 !important;
    margin-bottom: 4px !important;
}

#searchResults.tianditu_lib_placeSearch .poibox .poi-info {
    font-size: 13px !important;
    color: #666 !important;
}

#searchResults.amap_lib_placeSearch_list {
    max-height: 300px !important;
    overflow-y: auto !important;
}

#searchResults.amap_lib_placeSearch .poibox {
    border-bottom: 1px solid #e9ecef !important;
    padding: 12px 15px !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease !important;
}

#searchResults.amap_lib_placeSearch .poibox:hover {
    background-color: #f8f9fa !important;
}

#searchResults.amap_lib_placeSearch .poibox.selected {
    background-color: #e3f2fd !important;
}

#searchResults.amap_lib_placeSearch .poibox .poi-title {
    color: #2c3e50 !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    margin-bottom: 4px !important;
}

#searchResults.amap_lib_placeSearch .poibox .poi-info {
    color: #7f8c8d !important;
    font-size: 0.85rem !important;
}

/* ========== 移动端适配 ========== */

/* 移动端基础样式 */
@media (max-width: 768px) {
    /* 容器和布局 */
    .container {
        padding: 0 12px;
    }
    
    /* 导航栏 */
    .navbar {
        padding: 8px 0;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-toggler {
        padding: 6px 10px;
    }
    
    /* 按钮和表单元素 - 增大触摸目标 */
    .btn {
        padding: 12px 20px;
        min-height: 44px;
        font-size: 1rem;
    }
    
    .btn-sm {
        padding: 8px 16px;
        min-height: 36px;
        font-size: 0.9rem;
    }
    
    .form-control,
    .form-select {
        padding: 12px 14px;
        font-size: 1rem;
        min-height: 44px;
    }
    
    /* 卡片 */
    .card {
        margin-bottom: 16px;
    }
    
    .card-header {
        padding: 14px 16px;
        font-size: 1rem;
    }
    
    .card-body {
        padding: 16px;
    }
    
    /* 上传区域 */
    .upload-area {
        padding: 40px 20px;
        min-height: 300px;
    }
    
    .upload-placeholder i {
        font-size: 48px;
        margin-bottom: 14px;
    }
    
    .upload-placeholder p {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .upload-placeholder .hint {
        font-size: 12px;
    }
    
    /* 历史记录 */
    .history-item {
        padding: 14px;
        margin-bottom: 10px;
    }
    
    .history-item .history-time {
        font-size: 0.75rem;
        margin-bottom: 6px;
    }
    
    .history-item .history-filename {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }
    
    /* 统计卡片 */
    .stat-card {
        padding: 18px;
        margin-bottom: 14px;
    }
    
    .stat-card .stat-value {
        font-size: 1.8rem;
        margin-bottom: 6px;
    }
    
    .stat-card .stat-label {
        font-size: 0.85rem;
    }
    
    /* 页脚 */
    footer {
        padding: 20px 0;
        margin-top: 30px;
        font-size: 0.85rem;
    }
    
    /* Hero区域 */
    .hero-section {
        padding: 40px 0 30px;
        margin-bottom: 20px;
    }
    
    .hero-title {
        font-size: 1.6rem;
        letter-spacing: 1px;
        margin-bottom: 8px;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
        letter-spacing: 0.5px;
    }
    
    /* 模态框 */
    .modal-content {
        margin: 10px;
    }
    
    .modal-header {
        padding: 16px 18px;
    }
    
    .modal-body {
        padding: 18px;
    }
    
    .modal-footer {
        padding: 14px 18px;
    }
    
    /* 标签页 */
    .nav-tabs .nav-link {
        padding: 8px 14px;
        font-size: 0.9rem;
    }
    
    /* 分页 */
    .pagination {
        margin-top: 20px;
    }
    
    .page-link {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
    
    /* 徽章 */
    .badge {
        font-size: 0.75rem;
        padding: 3px 8px;
    }
    
    /* 分析结果 */
    .analysis-result {
        padding: 16px;
        margin-bottom: 14px;
    }
    
    .analysis-result h4 {
        font-size: 1rem;
        margin-bottom: 14px;
    }
    
    /* 灯光类型项 */
    .light-type-item {
        padding: 12px 0;
    }
    
    .light-type-icon {
        width: 34px;
        height: 34px;
        margin-right: 12px;
    }
    
    .light-type-name {
        font-size: 0.95rem;
    }
    
    .light-type-count {
        font-size: 0.85rem;
    }
    
    /* 污染等级 */
    .pollution-level {
        padding: 6px 14px;
        font-size: 0.85rem;
    }
}

/* 小屏幕手机 (≤480px) */
@media (max-width: 480px) {
    /* 容器 */
    .container {
        padding: 0 10px;
    }
    
    /* 导航栏 */
    .navbar-brand {
        font-size: 1rem;
    }
    
    /* 按钮全宽 */
    .btn {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .btn-sm {
        width: auto;
        margin-bottom: 0;
    }
    
    /* 表单全宽 */
    .form-control,
    .form-select {
        width: 100%;
    }
    
    /* 上传区域 */
    .upload-area {
        padding: 30px 15px;
        min-height: 250px;
    }
    
    .upload-placeholder i {
        font-size: 40px;
    }
    
    .upload-placeholder p {
        font-size: 13px;
    }
    
    /* 卡片 */
    .card {
        margin-bottom: 12px;
    }
    
    .card-header {
        padding: 12px 14px;
    }
    
    .card-body {
        padding: 14px;
    }
    
    /* 统计卡片 */
    .stat-card {
        padding: 16px;
        margin-bottom: 12px;
    }
    
    .stat-card .stat-value {
        font-size: 1.6rem;
    }
    
    /* 历史记录 */
    .history-item {
        padding: 12px;
        margin-bottom: 8px;
    }
    
    /* 污染等级 */
    .pollution-level {
        padding: 5px 12px;
        font-size: 0.8rem;
    }
    
    /* 模态框 */
    .modal-content {
        margin: 5px;
    }
    
    .modal-header {
        padding: 14px 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    /* 表格 */
    .table {
        font-size: 0.85rem;
    }
    
    .table thead th {
        padding: 8px 6px;
        font-size: 0.8rem;
    }
    
    .table tbody td {
        padding: 8px 6px;
        font-size: 0.85rem;
    }
    
    /* 页脚 */
    footer {
        padding: 16px 0;
        font-size: 0.8rem;
    }
    
    /* Hero区域 */
    .hero-section {
        padding: 30px 0 25px;
    }
    
    .hero-title {
        font-size: 1.4rem;
    }
    
    .hero-subtitle {
        font-size: 0.85rem;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 增大触摸目标 */
    .btn,
    .nav-link,
    .history-item,
    .poibox,
    .page-link {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* 移除悬停效果 */
    .btn:hover,
    .nav-link:hover,
    .history-item:hover,
    .card:hover,
    .stat-card:hover {
        transform: none;
    }
    
    /* 添加触摸反馈 */
    .btn:active,
    .nav-link:active,
    .history-item:active {
        opacity: 0.7;
    }
}

/* 横屏手机 */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        padding: 20px 0 15px;
        margin-bottom: 15px;
    }
    
    .hero-title {
        font-size: 1.4rem;
    }
    
    .hero-subtitle {
        font-size: 0.85rem;
    }
    
    .upload-area {
        padding: 25px 15px;
        min-height: 200px;
    }
    
    .navbar {
        padding: 5px 0;
    }
    
    .container {
        padding: 0 12px;
    }
}

/* 搜索结果移动端优化 */
@media (max-width: 768px) {
    #searchResults {
        max-height: 250px;
        font-size: 0.9rem;
    }
    
    #searchResults > div {
        padding: 10px 12px;
    }
    
    #searchResults > div > div {
        font-size: 0.95rem;
    }
    
    #searchResults > div > div:last-child {
        font-size: 0.8rem;
    }
}

/* 地图容器移动端优化 */
@media (max-width: 768px) {
    #locationMap,
    #mapContainer {
        min-height: 300px;
        height: 300px;
    }
    
    #locationMap,
    #mapContainer {
        min-height: 350px;
        height: 350px;
    }
}

/* 加载动画移动端优化 */
@media (max-width: 768px) {
    .loading-content {
        padding: 35px 45px;
        max-width: 90%;
    }
    
    .loading-content p {
        font-size: 14px;
        margin-top: 14px;
    }
    
    .spinner-border {
        width: 32px;
        height: 32px;
    }
}

/* 表格移动端优化 */
@media (max-width: 768px) {
    .table {
        font-size: 0.85rem;
    }
    
    .table thead th {
        padding: 10px 6px;
        font-size: 0.8rem;
    }
    
    .table tbody td {
        padding: 10px 6px;
        font-size: 0.85rem;
    }
}

/* 防止移动端文本溢出 */
@media (max-width: 768px) {
    * {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .card-header,
    .result-card-title,
    .section-title {
        white-space: normal;
        word-break: break-word;
    }
}

/* 移动端输入框聚焦优化 */
@media (max-width: 768px) {
    input:focus,
    textarea:focus,
    select:focus {
        font-size: 16px; /* 防止iOS自动缩放 */
    }
}

/* 移动端滚动优化 */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }
    
    ::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
    
    ::-webkit-scrollbar-thumb {
        background: #bdc3c7;
        border-radius: 2px;
    }
}
