/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 隐藏不必要的面板区域，改为气泡弹窗显示 */
#annotationForm, 
#annotationDetail {
    display: none;
}

/* 隐藏Leaflet水印 */
.leaflet-control-attribution {
    display: none !important;
}

/* 悬浮提示样式 */
.tooltip-trigger {
    position: relative;
    cursor: pointer;
    margin-left: 6px;
    font-size: 0.95em;
    color: #666;
}

.tooltip-trigger:hover {
    color: #333;
}

.tooltip-content {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
    padding: 12px 15px;
    min-width: 200px;
    max-width: 350px;
    margin-top: 8px;
    display: none;
    font-size: 0.9em;
    color: #444;
    line-height: 1.5;
}

.tooltip-trigger:hover .tooltip-content {
    display: block;
}

.tooltip-content ul {
    list-style-type: disc;
    margin-left: 22px;
    padding: 0;
}

.tooltip-content li {
    margin-bottom: 8px;
    font-size: 0.9em;
    color: #555;
}

.tooltip-content li:last-child {
    margin-bottom: 0;
}

/* 调整h2标题中的图标垂直对齐 */
h2 i {
    vertical-align: middle;
    margin-right: 8px;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 头部样式 */
header {
    position: relative;
    background: linear-gradient(135deg, #2c3e50, #4a6491);
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.2rem;
    margin-bottom: 8px;
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 主要内容区域 */
.main-content {
    display: flex;
    flex: 1;
    padding: 20px;
    gap: 20px;
    min-height: 0;
}

/* 左侧面板 */
.left-panel {
    width: 350px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto; /* 允许内容垂直滚动 */
    max-height: calc(100vh - 100px); /* 基于屏幕高度的最大限制 */
}

/* 通用面板区域样式 */
.panel-section {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

/* 左侧面板内容区域 */
.left-panel .panel-section {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* 标注信息表单区域 */
.left-panel .panel-section:has(.annotation-form) {
    flex: 1;
    overflow: hidden;
}

/* 标注表单内容区域 */
.left-panel .panel-section:has(.annotation-form) > .annotation-form {
    overflow-y: auto;
    min-height: 0;
    margin-bottom: 20px;
}

/* 已添加的标注列表区域 */
.left-panel .panel-section:has(.annotation-form) > .annotations-list {
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.left-panel .panel-section:has(.annotation-form) > .annotations-list::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

/* 确保h2标题保持正常高度 */
.panel-section h2 {
    color: #2c3e50;
    font-size: 1.4rem;
    border-bottom: 2px solid #4a6491;
    padding-bottom: 8px;
    margin: 0 0 20px 0;
    flex-shrink: 0;
}

/* 确保h3标题保持正常高度 */
.panel-section h3 {
    color: #34495e;
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-section h2 {
    color: #2c3e50;
    font-size: 1.4rem;
    border-bottom: 2px solid #4a6491;
    padding-bottom: 8px;
    margin: 0;
    flex: 1;
}

.collapse-btn {
    background: none;
    border: none;
    color: #3498db;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    transition: all 0.3s ease;
    border-radius: 4px;
    margin-left: 10px;
}

.collapse-btn:hover {
    background-color: #f0f8ff;
    color: #2980b9;
}

.panel-content {
    transition: all 0.3s ease;
    overflow: hidden;
    max-height: 1000px;
}

.panel-section.collapsed .panel-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
    opacity: 0;
}

.panel-section.collapsed .collapse-btn {
    transform: rotate(180deg);
}

.model-list-container {
    margin-top: 15px;
}

.model-list-container h3 {
    font-size: 1rem;
    margin-bottom: 10px;
}

.selected-model-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 15px;
    padding: 10px;
    background-color: #e3f2fd;
    border-radius: 6px;
    border-left: 3px solid #2196f3;
}

.selected-model-name {
    font-weight: 600;
    color: #1976d2;
    font-size: 0.95rem;
}

.change-model-btn {
    color: #2196f3;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.change-model-btn:hover {
    background-color: #2196f3;
    color: white;
}

.panel-section h3 {
    color: #34495e;
    margin: 15px 0 10px;
    font-size: 1.1rem;
}

/* 上传区域 */
.upload-area {
    border: 2px dashed #3498db;
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

/* 2D上传页面特定样式 - 修复实线虚线重叠问题 */
/* 这个选择器只会影响index.html中的上传区域，不会影响index_cesium.html */
.left-panel .panel-section:nth-child(1) .upload-area {
    margin-top: 20px;
}

.upload-area:hover {
    background-color: #f0f8ff;
    border-color: #2980b9;
}

.upload-icon {
    font-size: 48px;
    color: #3498db;
    margin-bottom: 15px;
}

.upload-hint {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-top: 5px;
}

/* 蓝图列表 */
.blueprint-items {
    max-height: 200px;
    overflow-y: auto;
}

.blueprint-item {
    padding: 10px;
    border: 1px solid #ecf0f1;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.blueprint-item:hover {
    background-color: #f8f9fa;
    border-color: #3498db;
}

.blueprint-item.active {
    background-color: #e3f2fd;
    border-color: #2196f3;
}

.blueprint-icon {
    color: #3498db;
    font-size: 1.2rem;
}

.blueprint-info {
    flex: 1;
    cursor: pointer;
}

.blueprint-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-all;
    font-size: clamp(0.8rem, 2vw, 1rem);
}

.blueprint-size {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.blueprint-actions {
    display: flex;
    gap: 5px;
}

.delete-blueprint-btn {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.delete-blueprint-btn:hover {
    background-color: #ffeaea;
}

.rename-blueprint-btn {
    background: none;
    border: none;
    color: #3498db;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.rename-blueprint-btn:hover {
    background-color: #e3f2fd;
}

.blueprint-name-input {
    width: 100%;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-top: 5px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    background: #f8fafc;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary-color);
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    resize: vertical;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-right: 12px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: #2c3e50;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 14px;
    padding: 4px 8px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 8px;
    color: #fff;
    font-size: 0.75rem;
    margin-left: 6px;
}

.pdf-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #3498db;
    font-size: 0.95rem;
}

/* 照片上传 */
.photo-upload {
    border: 2px dashed #e74c3c;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 10px;
}

.photo-upload:hover {
    background-color: #fff5f5;
    border-color: #c0392b;
}

.photo-icon {
    font-size: 36px;
    color: #e74c3c;
    margin-bottom: 10px;
}

.photo-preview {
    margin-top: 10px;
}

.photo-preview-container {
    position: relative;
    width: 100%;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #ddd;
}

.photo-preview-container img {
    width: 100%;
    height: auto;
    display: block;
}

.delete-photo-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(231, 76, 60, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.delete-photo-btn:hover {
    background-color: rgba(192, 57, 43, 0.9);
}

/* 标注列表 */
.annotations-items {
    max-height: calc((100vh - 200px) * 0.65);
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.annotations-items::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.annotation-item {
    padding: 12px;
    border: 1px solid #ecf0f1;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.annotation-item:hover {
    background-color: #f8f9fa;
    border-color: #3498db;
}

.annotation-item.active {
    background-color: #e3f2fd;
    border-color: #2196f3;
}

.annotation-item.selected {
    background-color: #fffbeb;
    border-left: 4px solid #fbbf24;
    border-color: #fbbf24;
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.3);
}

.annotation-info {
    flex: 1;
    cursor: pointer;
}

.annotation-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.annotation-position {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.annotation-actions {
    display: flex;
    gap: 5px;
}

.delete-annotation-btn {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.delete-annotation-btn:hover {
    background-color: #ffeaea;
}

/* 右侧面板 */
.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: calc(100vh - 100px); /* 基于屏幕高度的最大限制，与左侧面板保持一致 */
    overflow: hidden;
}

/* 地图容器 */
.map-container {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 400px;
}

/* Cesium容器样式 */
#cesiumContainer {
    flex: 1;
    border-radius: 8px;
    overflow: hidden;
    min-height: 0;
    max-height: calc(100vh - 200px); /* 基于屏幕高度的最大限制 */
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.map-controls {
    display: flex;
    gap: 10px;
}

#map {
    flex: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #ddd;
    min-height: 0;
}

.map-instructions {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    font-size: 0.9rem;
}

.map-instructions ul {
    padding-left: 20px;
    margin-top: 8px;
}

.map-instructions li {
    margin-bottom: 4px;
}

/* 缺陷详情 */
.annotation-detail {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.detail-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
}

.detail-content h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.detail-photo {
    margin: 20px 0;
}

.detail-photo h4 {
    margin-bottom: 10px;
    color: #34495e;
}

.detail-photo img {
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: transform 0.2s;
}

.detail-photo img:hover {
    transform: scale(1.02);
}

/* 图片查看器模态框 */
.image-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-viewer-modal.show {
    opacity: 1;
}

.image-viewer-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-viewer-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: grab;
    user-select: none;
    -webkit-user-drag: none;
    will-change: transform;
}

.image-viewer-img:active {
    cursor: grabbing;
}

/* 控制按钮 */
.image-viewer-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 12px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.image-viewer-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.image-viewer-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.image-viewer-btn:active {
    transform: scale(0.95);
}

/* 关闭按钮 */
.image-viewer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.2s ease;
}

.image-viewer-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* 信息显示 */
.image-viewer-info {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
}

/* 图片文件名显示 */
.image-viewer-filename {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    max-width: 80%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.detail-meta {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
}

.detail-meta p {
    margin-bottom: 8px;
}

/* 按钮样式 */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:active {
    transform: scale(0.96);
}

.primary-btn {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.25);
}

.primary-btn:hover {
    background: linear-gradient(135deg, #357abd, #2c67a3);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(74, 144, 226, 0.35);
}

.primary-btn.active {
    background: linear-gradient(135deg, #2980b9, #1f5a8a);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.secondary-btn {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.secondary-btn:hover {
    background: linear-gradient(135deg, #7f8c8d, #6c7a7b);
    transform: translateY(-1px);
}

.danger-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.danger-btn:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.35);
}

/* 控制按钮 - 统一3D页面风格 */
.control-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: #f3f4f6;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.control-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

.control-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 分享按钮 - 绿色渐变 */
.share-btn {
    width: auto;
    padding: 8px 16px;
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
    font-weight: 600;
    gap: 6px;
}

.share-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669, #047857) !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.share-btn.success {
    background: linear-gradient(135deg, #10b981, #059669) !important;
}

/* 添加标注按钮 - 主色渐变 */
.add-marker-btn {
    width: auto;
    padding: 8px 16px;
    font-weight: 600;
    gap: 6px;
}

.add-marker-btn.active {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

/* 按钮成功状态（学习3D页面） */
.btn.success {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25) !important;
}

.btn.success:hover {
    background: linear-gradient(135deg, #059669, #047857) !important;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35) !important;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* 加载动画 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #3498db;
    padding: 20px;
}

.fa-spinner {
    font-size: 24px;
    margin-bottom: 10px;
}

/* 页脚 */
footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 15px;
    margin-top: 20px;
}

/* 切换面板按钮样式 */
#togglePanelBtn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    z-index: 100;
}

#togglePanelBtn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

/* 确保按钮在所有设备上都可见 */
.mobile-toggle-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
    }

    .left-panel {
        width: 100%;
    }

    #map {
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .map-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .map-controls {
        width: 100%;
        flex-wrap: wrap;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .panel-section {
        padding: 15px;
    }
}

/* 气泡弹窗样式 */
.bubble-popup {
    position: absolute;
    background: var(--bg-overlay);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-medium);
    border: 1px solid rgba(255, 255, 255, 0.6);
    z-index: 1000;
    width: 380px;
    max-width: 90vw;
    display: none;
    overflow: hidden;
}

.bubble-popup.show {
    display: block;
    animation: popupSlideIn 0.3s ease;
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
    border-bottom: 1px solid rgba(37, 99, 235, 0.1);
}

.popup-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.popup-close {
    background: rgba(255, 255, 255, 0.8);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.popup-close:hover {
    background: var(--danger-color);
    color: white;
}

.popup-content {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.popup-content::-webkit-scrollbar {
    width: 6px;
}

.popup-content::-webkit-scrollbar-track {
    background: transparent;
}

.popup-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.popup-arrow {
    position: absolute;
    left: 50%;
    bottom: -10px;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid white;
}

/* 弹窗内表单样式 */
.bubble-popup .form-group {
    margin-bottom: 15px;
}

.bubble-popup .form-group label {
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.bubble-popup .form-group input,
.bubble-popup .form-group textarea,
.bubble-popup .form-group select {
    font-size: 0.9rem;
    padding: 8px 10px;
}

.bubble-popup .photo-upload {
    padding: 15px;
}

.bubble-popup .photo-icon {
    font-size: 28px;
}

.bubble-popup .form-actions {
    margin-top: 15px;
    gap: 8px;
}

.bubble-popup .btn {
    padding: 8px 12px;
    font-size: 0.9rem;
}

/* 弹窗内详情样式 */
.bubble-popup .detail-content h3 {
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.bubble-popup .detail-content p {
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.bubble-popup .detail-photo,
.bubble-popup .detail-photo-popup {
    margin: 15px 0;
}

.bubble-popup .detail-photo h4,
.bubble-popup .detail-photo-popup h4 {
    margin-bottom: 8px;
    font-size: 1rem;
}

.bubble-popup .detail-photo img,
.bubble-popup .detail-photo-popup img {
    max-height: 200px;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.bubble-popup .detail-photo img:hover,
.bubble-popup .detail-photo-popup img:hover {
    transform: scale(1.02);
}

/* 可点击照片样式 */
.clickable-photo {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.clickable-photo:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bubble-popup .detail-meta {
    padding: 10px;
    margin: 15px 0;
}

.bubble-popup .detail-meta p {
    margin-bottom: 5px;
    font-size: 0.85rem;
}

/* =========================================
   UI 美化升级 (通用)
   ========================================= */

/* 移动端触摸反馈优化 */
@media (hover: none) {
    .btn,
    .control-btn,
    .popup-close,
    .image-viewer-btn,
    .image-viewer-close {
        -webkit-tap-highlight-color: transparent;
    }

    .btn:active,
    .control-btn:active,
    .popup-close:active,
    .image-viewer-btn:active,
    .image-viewer-close:active {
        transform: scale(0.96);
    }
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --bg-overlay: rgba(255, 255, 255, 0.95);
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
}

/* 更现代的卡片风格 */ 
.panel-section, .bubble-popup { 
    background: var(--bg-overlay); 
    backdrop-filter: blur(10px); /* 毛玻璃效果 */ 
    border: 1px solid rgba(255, 255, 255, 0.5); 
    box-shadow: var(--shadow-soft); 
    border-radius: var(--radius-lg); 
}

/* 按钮美化 */ 
.btn { 
    border-radius: 8px; 
    font-weight: 600; 
    transition: all 0.2s; 
    border: none; 
}
.btn:active { transform: scale(0.96); }

/* 输入框美化 */ 
.form-group input, .form-group select, .form-group textarea { 
    border: 1px solid #e2e8f0; 
    border-radius: 8px; 
    background: #f8fafc; 
    padding: 10px; 
}
.form-group input:focus { 
    border-color: var(--primary-color); 
    background: #fff; 
    outline: none; 
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); 
}

/* ========================================= 
   移动端交互优化核心：底部抽屉模式 
   ========================================= */ 
@media (max-width: 768px) { 
    
    /* 1. 布局调整：地图全屏，面板折叠 */ 
    .main-content { 
        flex-direction: column; 
        height: calc(100vh - 60px); 
    } 
    
    /* 移动端左侧面板处理 */
    .left-panel {
        width: 100%;
        height: auto;
        padding: 10px;
        order: 2;
        background: white;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 80vh;
        overflow-y: auto;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
        z-index: 9998;
    }
    
    /* 显示左侧面板的类 */
    .left-panel.show {
        transform: translateY(0);
    }
    
    /* 移动端地图高度调整 */
    .map-container {
        height: calc(100vh - 60px);
    } 

    /* 2. 弹窗变身：强制变为底部抽屉 */ 
    .bubble-popup { 
        position: fixed !important; /* 强制覆盖 JS 计算的 top/left */ 
        top: auto !important; 
        left: 0 !important; 
        right: 0 !important; 
        bottom: 0 !important; 
        
        width: 100%; 
        max-width: 100%; 
        height: auto; 
        max-height: 80vh; /* 最多占据 80% 高度 */ 
        overflow-y: auto; 
        
        transform: translateY(110%); /* 默认隐藏在屏幕下方 */ 
        transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); 
        
        border-radius: 20px 20px 0 0; /* 只有上面是圆角 */ 
        margin: 0; 
        z-index: 9999; 
        padding-bottom: 30px; /* 给底部留安全距离 */ 
    } 

    /* 移动端Cesium容器高度修复 */
    .right-panel,
    .map-container,
    #cesiumContainer {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }
    
    #cesiumContainer {
        max-height: none !important; /* 覆盖之前的最大高度限制 */
    }

    /* 当弹窗显示时的类 (需要 JS 配合) */ 
    .bubble-popup.show { 
        display: block !important; 
        transform: translateY(0); 
    } 

    /* 隐藏原来指向地图的小箭头 */ 
    .popup-arrow { 
        display: none !important; 
    } 

    /* 增加一个顶部“把手”指示条 */ 
    .popup-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: #cbd5e1;
        border-radius: 2px;
    }

    /* 放大关闭按钮，方便手指点击 */
    .popup-close {
        padding: 10px;
        font-size: 1.2rem;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 50%;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .popup-close:hover {
        background: var(--danger-color);
        color: white;
    }

    /* 移动端Header优化 */
    header {
        padding: 12px 16px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: linear-gradient(135deg, #2c3e50, #4a6491);
    }

    header h1 {
        font-size: 1.2rem;
        margin: 0;
        font-weight: 600;
    }

    header .subtitle {
        display: none; /* 手机上隐藏副标题 */
    }

    /* 移动端面板切换按钮 */
    #togglePanelBtn.mobile-toggle-btn {
        background: var(--primary-color);
        color: white;
        border: none;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        font-size: 1.2rem;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
        transition: all 0.2s ease;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    #togglePanelBtn.mobile-toggle-btn:hover {
        background: var(--primary-hover);
        transform: scale(1.05);
        box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
    }

    #togglePanelBtn.mobile-toggle-btn:active {
        transform: scale(0.95);
    }

    .map-controls {
        bottom: 20px;
        right: 15px;
        gap: 8px;
    }

    .map-controls .control-btn {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.95);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    .map-controls .control-btn:hover {
        background: var(--primary-color);
        color: white;
    }
}


