/* ===== 基础重置和通用样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body,
html {
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

/* ===== 通用按钮和交互元素样式 ===== */
button {
    padding: 10px;
    background: #4a86e8;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

button:hover {
    background: #3a76d8;
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

button.secondary {
    background: #6c757d;
}

button.secondary:hover {
    background: #5a6268;
}

button.danger {
    background: #e74c3c;
}

button.danger:hover {
    background: #c0392b;
}

/* 图标按钮 */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.icon-btn.delete,
.icon-btn.clear {
    color: #e74c3c;
}

.icon-btn.delete:hover,
.icon-btn.clear:hover {
    background: rgba(231, 76, 60, 0.1);
}

.icon-btn.minimize {
    color: #4a86e8;
}

.icon-btn.minimize:hover {
    background: rgba(74, 134, 232, 0.1);
}

.icon-btn.export {
    color: #2ecc71;
}

.icon-btn.export:hover {
    background: rgba(46, 204, 113, 0.1);
}

.icon-btn.edit {
    color: #9C27B0;
}

.icon-btn.edit:hover {
    background: rgba(156, 39, 176, 0.1);
}

/* 调整开关组件在单行中的尺寸，稍微缩小一点以适应单行 */
.switch {
    position: relative;
    display: inline-block;
    width: 30px; /* 稍微宽一点让圆点移动 */
    height: 20px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

/* 修改开关选中状态的背景色为轨迹颜色 */
.track-item input:checked+.slider {
    background-color: var(--track-color);
}

input:checked+.slider {
    background-color: #4CAF50;
}

input:checked+.slider:before {
    transform: translateX(10px);
}

/* ===== 动画定义 ===== */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(52, 168, 83, 0.7);
    }

    50% {
        transform: scale(1.2);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(52, 168, 83, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(52, 168, 83, 0);
    }
}

/* ===== 地图和主要布局 ===== */
#map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* ===== 上传按钮区域 ===== */
.upload-button-container {
    position: absolute;
    top: 20px;
    left: 50px;
    z-index: 1000;
    background: #ffffff;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.upload-button {
    background: #4a86e8;
    color: #ffffff;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.upload-button:hover {
    background: #4a86e8;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

#file-input {
    display: none;
}

/* ===== 面板通用样式 ===== */
.control-panel,
.style-controls-panel,
.elevation-chart-window {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    transition: all 0.3s ease;
    will-change: transform;
    transform: translateZ(0);
}

/* 轨迹管理面板 */
.control-panel {
    top: 20px;
    right: 20px;
    width: 700px; /* 从 360px 改为 700px，加宽面板 */
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

/* 海拔图表 */
.elevation-chart-window {
    padding: 0px;
    /* 重要 */
    bottom: 20px;
    left: 20px;
    width: 500px;
    height: 300px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* 超出圆角边框部分切掉 */
    min-width: 280px;
    min-height: 220px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 140px);
}

/* 轨迹样式面板 */
.style-controls-panel {
    bottom: 20px;
    right: 20px;
    font-size: 14px;
    width: 150px;
}

/* 面板最小化状态 */
.control-panel.minimized,
.style-controls-panel.minimized,
.elevation-chart-window.minimized {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0px;
    /* 重要 */
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-panel.minimized .panel-content,
.style-controls-panel.minimized .style-panel-content,
.elevation-chart-window.minimized .chart-header,
.elevation-chart-window.minimized .chart-container,
.elevation-chart-window.minimized .chart-stats {
    display: none;
}

/* 确保内容区域高度自适应，不被挤压 */
.panel-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.control-panel.minimized:hover,
.style-controls-panel.minimized:hover,
.elevation-chart-window.minimized:hover {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* 面板按钮图标 */
.control-panel-icon,
.style-controls-icon,
.elevation-chart-icon {
    display: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #4a86e8;
    color: white;
    font-size: 18px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.control-panel.minimized .control-panel-icon,
.style-controls-panel.minimized .style-controls-icon,
.elevation-chart-window.minimized .elevation-chart-icon {
    display: flex;
}

/* 面板标题 */
.control-panel h2,
.style-controls-panel h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.control-panel.minimized h2,
.style-controls-panel.minimized h3 {
    display: none;
}

.title-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== 轨迹列表和项目 ===== */
.panel-section {
    border-bottom: 1px solid #eee;
}

.panel-section:last-child {
    border-bottom: none;
}

.panel-section h3 {
    margin-bottom: 12px;
    color: #555;
    font-size: 16px;
}

.track-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 5px;
    padding: 5px;
}

.track-list::-webkit-scrollbar {
    width: 6px;
}

.track-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.track-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.track-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.track-item {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 5px;
    transition: all 0.3s;
    --track-color: #4a86e8;
    gap: 5px;
}

.track-item:hover {
    background: #e9ecef;
}

.track-item.active {
    background: #e3f2fd;
    border-left: 4px solid #4a86e8;
}

.track-info {
    flex: 1;
    margin-left: 0;
}

.track-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 3px;
}

.track-details {
    font-size: 12px;
    color: #777;
}

.track-controls {
    display: flex;
    gap: 5px;
    align-items: center;
}

.track-controls button {
    padding: 5px 8px;
    font-size: 12px;
}

.no-tracks {
    text-align: center;
    padding: 20px;
    color: #777;
    font-style: italic;
}

/* ===== 信息面板和统计 ===== */
.info-panel {
    margin-top: 10px;
    font-size: 14px;
    color: #555;
}

.info-panel p {
    margin: 5px 0;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

.track-stats {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.stat-box {
    flex: 1;
    min-width: 100px;
    text-align: center;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 5px;
    margin-bottom: 5px;
}

.stat-value {
    font-weight: bold;
    font-size: 14px;
    color: #4a86e8;
}

.stat-label {
    font-size: 11px;
    color: #777;
}

/* ===== 底部控制栏 ===== */
.bottom-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 5px;
    border-radius: 50px;
    z-index: 1000;
    display: flex;
    gap: 5px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.bottom-controls button {
    padding: 10px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #4a86e8;
    color: white;
    transition: all 0.3;
    font-size: 18px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.bottom-controls button:hover {

    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

/* 按钮激活状态 */
#my-location.active {
    background: #34A853 !important;
    animation: pulse 2s infinite;
}

#map-toggle.active {
    background: #FF9800 !important;
}

#draw-track.active {
    background: #FF5722 !important;
    animation: pulse 1.5s infinite;
}

#edit-track.active {
    background: #9C27B0 !important;
    animation: pulse 1.5s infinite;
}

#route-planning.active {
    background: #9C27B0 !important;
    animation: pulse 1.5s infinite;
}

/* ===== 全局控制区域 - 修改为单行 ===== */
.global-controls {
    display: flex;
    flex-direction: row; /* 强制横向排列 */
    flex-wrap: nowrap;   /* 不换行 */
    align-items: center;
    justify-content: space-between; /* 两端对齐或使用 gap */
    gap: 15px;
    /* margin-bottom: 10px; */
    padding-bottom: 10px;
    /* border-bottom: 1px solid #eee; */
    overflow-x: auto; /* 防止窄屏溢出 */
}

.global-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
    gap: 8px; /* 文字和开关之间的间距 */
}

.global-toggle span {
    font-size: 13px;
    color: #555;
    white-space: nowrap;
}

/* ===== 拖拽和上传相关 ===== */
.drop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(5px);
    background: rgba(74, 134, 232, 0.8);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 24px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.drop-overlay.active {
    opacity: 1;
    visibility: visible;
}

.drop-icon {
    font-size: 72px;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.drop-text {
    text-align: center;
    max-width: 400px;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.upload-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 15px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    display: none;
    align-items: center;
    gap: 10px;
}

.upload-indicator.active {
    display: flex;
}

.upload-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4a86e8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===== 照片查看器 ===== */
.photo-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.photo-modal.active {
    opacity: 1;
    visibility: visible;
}

.photo-modal-header {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    display: flex;
    gap: 10px;
}

.photo-modal-close {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: white;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
}

.photo-modal-close:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.photo-modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90%;
    max-height: 90%;
    width: auto;
    position: relative;
}

.photo-image-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    max-width: 100%;
    max-height: 100%;
}

.photo-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.photo-nav {
    position: fixed; /* 修改为 fixed，使其固定在屏幕窗口 */
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: white;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
    z-index: 20; /* 确保在图片和其他元素之上 */
}

.photo-nav:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: translateY(-50%) scale(1.1); /* 保持垂直居中同时放大 */
}

.photo-nav.prev {
    left: 30px; /* 距离屏幕左侧固定距离 */
}

.photo-nav.next {
    right: 30px; /* 距离屏幕右侧固定距离 */
}

.photo-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.photo-nav:disabled:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: translateY(-50%) scale(1);
}

.photo-info-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    color: white;
    padding: 15px 20px;
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    gap: 15px;
    z-index: 10;
    box-sizing: border-box;
}

.photo-info-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
    min-width: 0;
}

.photo-info-label {
    font-size: 13px;
    color: #ccc;
    margin-bottom: 4px;
    font-weight: 500;
}

.photo-info-value {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.photo-name-item {
    width: 100%;
    margin-bottom: 10px;
}

.photo-name-value {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.photo-counter {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    backdrop-filter: blur(5px);
    z-index: 5;
}

/* ===== 海拔图表面板 ===== */
.chart-header {
    padding: 10px 12px;
    background: #4a86e8;
    color: white;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    flex-shrink: 0;
    min-height: 44px;
    contain: layout style paint;
}

.chart-title {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.chart-controls {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
    cursor: default;
}

.chart-controls button {
    padding: 4px;
    width: 26px;
    height: 26px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    position: relative;
    z-index: 10;
}

.chart-controls button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chart-container {
    flex: 1;
    position: relative;
    padding: 8px;
    min-height: 120px;
    overflow: hidden;
    contain: layout style paint;
}

.chart-canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.no-chart-data {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #777;
    font-style: italic;
    text-align: center;
    padding: 20px;
    font-size: 14px;
}

.chart-stats {
    padding: 8px 12px;
    background: #f8f9fa;
    font-size: 12px;
    color: #555;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
    min-height: 40px;
}

.chart-stats-info {
    flex: 1;
    min-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-legend {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
}

.chart-legend-color {
    width: 10px;
    height: 2px;
    flex-shrink: 0;
}

/* ===== 样式控制滑块 ===== */
.slider-control {
    margin-bottom: 12px;
}

.slider-control label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 14px;
    color: #555;
}

.slider-control .value {
    font-weight: bold;
    color: #4a86e8;
    min-width: 40px;
    text-align: right;
}

.slider-control input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

.slider-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4a86e8;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4a86e8;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ===== 搜索功能 ===== */
.search-container {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    min-width: 280px;
    max-width: 80%;
    border-radius: 50%;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-input-container {
    display: flex;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: all 0.3s ease;
    align-items: center;
    height: 44px;
}

.search-input-container:focus-within {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

#search-input {
    flex: 1;
    border: none;
    padding: 12px 20px;
    font-size: 14px;
    background: transparent;
    outline: none;
    color: #333;
    height: 100%;
    min-width: 0;
}

#search-input::placeholder {
    color: #999;
}

.search-button {
    background: #4a86e8;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 0 30px 30px 0;
    cursor: pointer;
    color: white;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin: 0;
}

.search-button svg {
    width: 20px;
    height: 20px;
}

.search-button:hover {
    background: #3a76d8;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 8px;
    margin-top: 5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1001;
}

.search-suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: all 0.3s;
    font-size: 14px;
}

.search-suggestion-item:hover {
    background: #f5f5f5;
}

.search-suggestion-item:last-child {
    border-bottom: none;
}

.search-suggestion-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.search-suggestion-address {
    font-size: 12px;
    color: #666;
}

.search-suggestion-poi {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ===== 路线规划面板 ===== */
.route-planning-panel {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.98);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    width: 400px;
    max-height: 70vh;
    overflow-y: auto;
    display: none;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.route-planning-panel.compact.no-header {
    width: 400px;
    padding: 10px;
    bottom: 70px;
    z-index: 2000;
    margin-top: 0;
}

.route-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #4a86e8;
}

.route-header h3 {
    margin: 0;
    color: #333;
    font-size: 20px;
    font-weight: 600;
}

.close-route {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.close-route:hover {
    background: rgba(231, 76, 60, 0.2);
}

.route-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.route-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0;
    height: 36px;
    align-items: center;
}

.route-input-group {
    position: relative;
}

.route-input-group.compact {
    flex: 1;
    position: relative;
    min-width: 0;
}

.route-input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.route-input-group.compact label {
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.route-input-group .search-input-container {
    display: flex;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.route-input-group.compact .search-input-container.compact {
    border-radius: 5px;
    border: 1px solid #e9ecef;
    height: 36px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    align-items: center;
}

.route-input-group .search-input-container:focus-within {
    border-color: #4a86e8;
    background: white;
    box-shadow: 0 0 0 3px rgba(74, 134, 232, 0.1);
}

.route-input-group.compact .search-input-container.compact:focus-within {
    box-shadow: 0 0 0 2px rgba(74, 134, 232, 0.1);
}

.route-input-group input {
    flex: 1;
    border: none;
    padding: 12px 16px;
    font-size: 14px;
    background: transparent;
    outline: none;
    color: #333;
}

.route-input-group.compact input {
    padding: 5px 7px;
    height: 100%;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    line-height: 1.4;
}

.route-input-group input::placeholder {
    color: #999;
}

.route-input-group.compact input::placeholder {
    font-size: 14px;
}

.route-search-btn {
    background: #4a86e8;
    border: none;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    color: white;
    padding: 0;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.route-input-group.compact .route-search-btn.compact {
    border-radius: 0 4px 4px 0;
    width: 24px;
    height: 100%;
    flex-shrink: 0;
    min-height: 0;
}

.route-input-group.compact .route-search-btn.compact svg {
    width: 18px;
    height: 18px;
}

.route-search-btn:hover {
    background: #3a76d8;
}

.route-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 8px;
    margin-top: 5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 1001;
    border: 1px solid #e9ecef;
}

.route-input-group.compact .route-suggestions.compact {
    border-radius: 5px;
    margin-top: 2px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    max-height: 150px;
    z-index: 2020;
    width: 100%;
    box-sizing: border-box;
    pointer-events: auto;
    font-size: 14px;
}

.route-suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f1f3f4;
    transition: all 0.3s;
    font-size: 14px;
}

.route-input-group.compact .route-suggestion-item {
    padding: 6px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: auto;
}

.route-suggestion-item:hover {
    background: #f8f9fa;
}

.route-input-group.compact .route-suggestion-item:hover {
    background: #f5f5f5;
}

.route-suggestion-item:last-child {
    border-bottom: none;
}

.route-suggestion-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.route-input-group.compact .route-suggestion-name {
    margin-bottom: 2px;
    font-size: 14px;
}

.route-suggestion-address {
    font-size: 12px;
    color: #666;
}

.route-input-group.compact .route-suggestion-address {
    font-size: 14px;
}

/* 交通方式选择 */
.transport-modes label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.transport-modes.compact label {
    margin-bottom: 5px;
}

.mode-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.mode-buttons.compact {
    display: flex;
    gap: 4px;
}

.mode-btn {
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
    text-align: center;
}

.mode-btn.compact {
    flex: 1;
    padding: 6px 4px;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    background: white;
    color: #333;
    font-size: 14px;
    min-height: auto;
}

.mode-btn:hover {
    border-color: #4a86e8;
    background: #f8f9fa;
}

.mode-btn.compact:hover {
    border-color: #4a86e8;
    background: #f8f9fa;
}

.mode-btn.active {
    border-color: #4a86e8;
    background: #4a86e8;
    color: white;
}

.mode-btn.compact.active {
    border-color: #4a86e8;
    background: #4a86e8;
    color: white;
}

/* 路线操作按钮 */
.route-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.route-actions.compact {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    justify-content: center;
    align-items: center;
    height: 36px;
}

.route-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.route-btn.icon-btn {
    width: auto;
    min-width: 80px;
    height: 36px;
    padding: 0 12px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
    gap: 6px;
}

.route-btn.icon-btn svg {
    width: 18px;
    height: 18px;
}

.route-btn.icon-btn span {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.route-btn.primary,
.route-btn.icon-btn.primary {
    background: #4a86e8;
    color: white;
}

.route-btn.primary:hover:not(:disabled),
.route-btn.icon-btn.primary:hover {
    background: #3a76d8;
    transform: translateY(-2px);
}

.route-btn.secondary,
.route-btn.icon-btn.secondary {
    background: #6c757d;
    color: white;
}

.route-btn.secondary:hover:not(:disabled),
.route-btn.icon-btn.secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.route-btn.icon-btn.success {
    background: #2ecc71;
    color: white;
}

.route-btn.icon-btn.success:hover {
    background: #27ae60;
    transform: translateY(-1px);
}

.route-btn:disabled,
.route-btn.icon-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* 路线信息 */
.route-info {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #4a86e8;
}

.route-info.compact {
    margin-top: 8px;
    padding: 8px;
    border-radius: 5px;
    border-left: 3px solid #4a86e8;
}

.route-stats {
    display: flex;
    gap: 20px;
    justify-content: space-around;
}

.route-stats.compact {
    display: flex;
    gap: 12px;
    justify-content: space-around;
}

.route-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.route-stat.compact {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.route-stat .stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.route-stat.compact .stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
}

.route-stat .stat-value {
    font-weight: bold;
    font-size: 16px;
    color: #4a86e8;
}

.route-stat.compact .stat-value {
    font-weight: bold;
    font-size: 12px;
    color: #4a86e8;
}

.route-details {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

.api-tips {
    padding: 12px;
    background: #e3f2fd;
    border-radius: 8px;
    border-left: 4px solid #2196F3;
    font-size: 12px;
    color: #555;
    margin-top: 10px;
}

.api-tips p {
    margin: 4px 0;
}

.api-tips strong {
    color: #2196F3;
}

/* 交换按钮 */
.route-swap-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 36px;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    flex-shrink: 0;
}

.route-swap-btn {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
    max-width: 30px !important;
    max-height: 30px !important;
    border: none;
    border-radius: 50% !important;
    background: #4a86e8;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    font-size: 0 !important;
    flex-shrink: 0;
    flex-grow: 0;
    flex-basis: auto;
}

.route-swap-btn:hover {
    background: #3a76d8;
    transform: rotate(180deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.route-swap-btn:active {
    transform: rotate(180deg) scale(0.95);
}

.route-swap-btn svg {
    width: 18px;
    height: 18px;
    display: block;
    margin: 0;
    padding: 0;
}

.route-swap-btn * {
    box-sizing: border-box;
}

.route-swap-btn:before,
.route-swap-btn:after {
    display: none !important;
}

/* ===== 编辑相关样式 ===== */
.edit-tips {
    padding: 10px;
    background: #e3f2fd;
    border-radius: 4px;
    font-size: 12px;
    color: #555;
}

.edit-tips p {
    margin: 0;
}

.edit-tips-panel {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.45);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    width: 250px;
    max-height: 70vh;
    overflow-y: auto;
    display: none;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.edit-tips-panel.active {
    display: block;
}

.edit-tips-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.edit-tips-header h3 {
    margin: 0;
    color: #333;
    font-size: 16px;
}

.edit-tips-content {
    font-size: 13px;
    color: #555;
    line-height: 1.5;
}

.edit-tips-content p {
    margin-bottom: 8px;
}

.edit-tips-content strong {
    color: #333;
}

.edit-tips-close {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.edit-tips-close:hover {
    background: rgba(231, 76, 60, 0.2);
}

.edit-stats-overlay {
    position: fixed;
    top: 130px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    font-size: 12px;
    color: #333;
    display: none;
    pointer-events: auto;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.edit-stats-overlay.active {
    display: flex;
}

.edit-stats-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.edit-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.edit-stat-label {
    font-weight: 500;
    color: #666;
}

.edit-stat-value {
    font-weight: bold;
    color: #4a86e8;
}

.edit-stats-overlay .icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}

.edit-stats-overlay .icon-btn.cancel-edit {
    background: #e74c3c;
    color: white;
}

.edit-stats-overlay .icon-btn.cancel-edit:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.edit-stats-overlay .icon-btn.save-edit {
    background: #2ecc71;
    color: white;
}

.edit-stats-overlay .icon-btn.save-edit:hover {
    background: #27ae60;
    transform: translateY(-2px);
}

.edit-stats-overlay .icon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.edit-stats-overlay .icon-btn svg {
    width: 18px;
    height: 18px;
}

/* [修改/新增] 点操作菜单样式 */
.point-action-menu {
    position: absolute;
    display: flex;
    gap: 8px; /* 两个按钮之间的间距 */
    z-index: 2000;
    pointer-events: auto;
    transform: translate(-50%, -120%); /* 让菜单显示在点的上方 */
}

.point-action-menu::after {
    /* 增加一个小三角指向下方，增加UI美观度 */
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0,0,0,0.6);
}

.point-action-menu .action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
    color: white;
}

.point-action-menu .action-btn:hover {
    transform: scale(1.1);
}

.point-action-menu .action-btn.delete {
    background: #e74c3c; /* 红色 */
}

.point-action-menu .action-btn.delete:hover {
    background: #c0392b;
}

.point-action-menu .action-btn.split {
    background: #f39c12; /* 橙色 */
}

.point-action-menu .action-btn.split:hover {
    background: #d35400;
}

.point-action-menu .action-btn svg {
    width: 18px;
    height: 18px;
}

/* ===== 数据库状态指示器 ===== */
.db-status {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 15px;
    border-radius: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    display: none;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.db-status.active {
    display: flex;
}

.db-status.success {
    background: rgba(76, 175, 80, 0.9);
    color: white;
}

.db-status.error {
    background: rgba(244, 67, 54, 0.9);
    color: white;
}

/* ===== 轨迹名称提示框 ===== */
.track-name-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
    transform: translate(-50%, -100%);
    margin-top: -10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.track-name-tooltip:after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
}

/* ===== 标记点文本样式 ===== */
.marker-text {
    font-size: 12px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8),
        -1px -1px 2px rgba(255, 255, 255, 0.8),
        1px -1px 2px rgba(255, 255, 255, 0.8),
        -1px 1px 2px rgba(255, 255, 255, 0.8);
    color: #333;
    background: rgba(255, 255, 255, 0.7);
    padding: 2px 6px;
    border-radius: 3px;
    margin-top: 5px;
}

/* ===== 保存POI按钮 ===== */
.poi-save-floating-btn-container {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
}

.poi-cancel-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #e74c3c;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
}

.poi-cancel-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.poi-save-btn {
    background: #2ecc71;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
    white-space: nowrap;
}

.poi-save-btn:hover {
    background: #27ae60;
    transform: translateY(-2px);
}

/* ===== 图层z-index定义 ===== */
.drawing-track-layer,
.editing-track-layer,
.route-layer {
    z-index: 500;
}

.drawing-point-layer,
.editing-point-layer,
.route-marker-layer {
    z-index: 501;
}

.edit-point {
    z-index: 502;
}

/* ===== 拖拽优化样式 ===== */
.elevation-chart-window.dragging {
    pointer-events: none;
    transition: none;
}

/* ===== 响应式设计 ===== */

/* 中等屏幕 (平板) */
@media (max-width: 768px) {
    .control-panel {
        width: 280px;
    }

    .elevation-chart-window {
        width: 90vw;
        height: 40vh;
        right: 5vw;
        bottom: 20px;
    }

    .chart-header {
        padding: 8px 10px;
        min-height: 40px;
    }

    .chart-title {
        font-size: 13px;
    }

    .chart-controls button {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .chart-container {
        padding: 6px;
    }

    .chart-stats {
        padding: 6px 10px;
        font-size: 11px;
    }

    .chart-legend {
        gap: 6px;
    }

    .chart-legend-item {
        font-size: 10px;
    }

    .photo-modal-body {
        max-width: 95%;
        max-height: 85%;
    }

    .photo-nav {
        width: 40px;
        height: 40px;
    }

    .photo-nav.prev {
        left: 10px;
    }

    .photo-nav.next {
        right: 10px;
    }

    .photo-info-panel {
        padding: 12px 15px;
        flex-direction: column;
        gap: 8px;
    }

    .photo-info-item {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }

    .photo-info-label {
        font-size: 12px;
        margin-bottom: 0;
        margin-right: 10px;
        flex-shrink: 0;
    }

    .photo-info-value {
        font-size: 13px;
        text-align: right;
    }

    .photo-name-item {
        margin-bottom: 8px;
    }

    .photo-name-value {
        font-size: 14px;
    }

    .photo-counter {
        top: 15px;
        left: 15px;
        padding: 6px 12px;
        font-size: 13px;
    }

    .search-input-container {
        border-radius: 30px;
    }

    #search-input {
        padding: 10px 16px;
        font-size: 14px;
    }

    .search-button {
        padding: 5px 5px;
    }

    .route-planning-panel {
        width: 90vw;
        bottom: 70px;
    }

    .mode-buttons {
        grid-template-columns: 1fr;
    }

    .delete-point-btn {
        width: 44px;
        height: 44px;
    }

    .delete-point-btn svg {
        width: 22px;
        height: 22px;
    }
}

/* 小屏幕 (手机) */
@media (max-width: 480px) {
    .global-controls {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .global-toggle span {
        font-size: 12px;
    }

    .elevation-chart-window {
        width: 95vw;
        height: 35vh;
        right: 2.5vw;
        bottom: 20px;
        min-width: 260px;
        min-height: 200px;
    }

    .chart-header {
        padding: 6px 8px;
    }

    .chart-title {
        font-size: 12px;
    }

    .chart-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .chart-stats-info {
        min-width: auto;
        width: 100%;
    }

    .chart-legend {
        width: 100%;
        justify-content: flex-start;
    }

    .photo-modal-body {
        max-width: 98%;
        max-height: 80%;
    }

    .photo-nav {
        width: 35px;
        height: 35px;
    }

    .photo-info-panel {
        padding: 10px 12px;
    }

    .photo-info-label {
        font-size: 11px;
    }

    .photo-info-value {
        font-size: 12px;
    }

    .search-container {
        width: 180px;
        max-width: 180px;
        min-width: 180px;
    }

    .search-input-container {
        border-radius: 30px;
    }

    #search-input {
        padding: 10px 16px;
        width: calc(100% - 40px);
        min-width: 0;
    }

    .search-suggestions {
        width: 180px;
        left: 0;
        right: auto;
    }

    .search-suggestion-item {
        padding: 10px 12px;
        font-size: 13px;
    }

    .search-suggestion-name {
        font-size: 13px;
    }

    .search-suggestion-address {
        font-size: 11px;
    }

    .route-planning-panel {
        width: 95vw;
        padding: 15px;
    }

    .route-stats {
        flex-direction: column;
        gap: 10px;
    }

    .route-actions {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 6px;
        justify-content: center;
        align-items: center;
    }

    .route-input-row {
        gap: 4px;
        height: 36px;
    }

    .route-swap-container {
        width: 32px;
        height: 36px;
    }

    .route-swap-btn {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        min-height: 28px !important;
        max-width: 28px !important;
        max-height: 28px !important;
    }

    .route-swap-btn svg {
        width: 14px;
        height: 14px;
    }

    .route-input-group.compact .search-input-container.compact {
        height: 36px;
    }

    .route-input-group.compact input {
        padding: 4px 6px;
        font-size: 14px;
    }

    .route-input-group.compact .route-search-btn.compact {
        width: 22px;
    }

    .route-input-group.compact .route-search-btn.compact svg {
        width: 18px;
        height: 18px;
    }

    .route-btn.icon-btn {
        min-width: 70px;
        padding: 0 10px;
    }

    .route-btn.icon-btn span {
        font-size: 13px;
    }
}

/* ===== 右键菜单 ===== */
.context-menu {
    display: none;
    position: absolute;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    padding: 4px 0;
    min-width: 140px;
    overflow: hidden;
    border: 1px solid #eee;
    font-size: 14px;
}

.menu-item {
    padding: 8px 12px;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}

.menu-item:hover {
    background-color: #f5f5f5;
    color: #4a86e8;
}

.menu-item svg {
    color: #666;
}

.menu-item:hover svg {
    color: #4a86e8;
}