/* 字体加载优化 - 减少字体警告 */
@font-face {
    font-family: 'SystemFont';
    src: local('Helvetica Neue'), local('Arial'), local('sans-serif');
    font-display: swap;
}

/* 基础页面样式 */
body {
    margin: 0;
    padding: 0;
    font-family: 'SystemFont', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    background: #f0f0f0;
}

#map {
    width: 100%;
    height: 100vh;
    position: relative;
    z-index: 1;
}

/* 🆕 功能区域容器样式 - 提升视觉感知 */
.functional-area {
    position: absolute;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 8px;
    transition: all 0.3s ease;
}

.functional-area:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(144, 202, 249, 0.6);
    box-shadow: 0 6px 25px rgba(144, 202, 249, 0.15);
    -webkit-transform: translateY(-2px);
    -moz-transform: translateY(-2px);
    transform: translateY(-2px);
}

/* 搜索区域定位 */
#search-area {
    top: 10px;
    left: 10px;
    border-color: rgba(76, 175, 80, 0.3);
}

#search-area:hover {
    border-color: rgba(76, 175, 80, 0.6);
    box-shadow: 0 6px 25px rgba(76, 175, 80, 0.15);
}

/* 模式切换区域定位 */
#mode-area {
    top: 10px;
    right: 10px;
    border-color: rgba(255, 193, 7, 0.3);
}

#mode-area:hover {
    border-color: rgba(255, 193, 7, 0.6);
    box-shadow: 0 6px 25px rgba(255, 193, 7, 0.15);
}

/* 状态信息区域定位 */
#status-area {
    bottom: 10px;
    left: 10px;
    border-color: rgba(33, 150, 243, 0.3);
}

#status-area:hover {
    border-color: rgba(33, 150, 243, 0.6);
    box-shadow: 0 6px 25px rgba(33, 150, 243, 0.15);
}

/* 控制按钮区域定位 */
#controls-area {
    bottom: 20px;
    right: 20px;
    border-color: rgba(156, 39, 176, 0.3);
}

#controls-area:hover {
    border-color: rgba(156, 39, 176, 0.6);
    box-shadow: 0 6px 25px rgba(156, 39, 176, 0.15);
}

/* 地图搜索框样式 - 调整适应新容器 */
#map-search-container {
    width: 320px;
    min-width: 320px;
    max-width: 100%;
}

/* 响应式优化 */
@media (max-width: 600px) {
    #map-search-container {
        width: 280px;
        min-width: 280px;
    }

    #search-input {
        font-size: 12px;
        padding: 10px 12px;
    }

    #search-btn, #clear-btn, #tutorial-btn {
        padding: 10px 12px;
        font-size: 12px;
    }

    #tutorial-btn {
        min-width: 40px;
        padding: 10px 12px;
    }
}

#search-box {
    display: flex;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    border: 2px solid #e0e0e0;
    overflow: visible;
    transition: all 0.3s ease;
    position: relative;
}

#search-box:focus-within {
    border-color: #4CAF50;
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.2);
}

#search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 16px;
    font-size: 14px;
    background: transparent;
    color: #333;
    min-width: 0;
    z-index: 1;
    position: relative;
}

#search-input::placeholder {
    color: #888;
}

#search-btn, #clear-btn, #tutorial-btn {
    border: none;
    background: #4CAF50;
    color: white;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 5;
}

#search-btn:hover, #clear-btn:hover, #tutorial-btn:hover {
    background: #45a049;
}

#clear-btn {
    background: #dc2626;
    order: 1;
}

#clear-btn:hover {
    background: #b91c1c;
}

#search-btn {
    order: 2;
}

#tutorial-btn {
    order: 3;
}

#tutorial-btn {
    background: #2196F3;
    padding: 12px 14px;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    z-index: 10;
    min-width: 44px;
    flex-shrink: 0;
}

#tutorial-btn:hover {
    background: #1976D2;
}

/* 坐标提示样式 */
.coordinate-tip {
    margin-top: 8px;
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 2px solid #ffc107;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(255, 193, 7, 0.3);
    animation: tipSlideIn 0.3s ease-out;
}

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

.tip-content {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 8px;
}

.tip-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.tip-text {
    flex: 1;
    font-size: 14px;
    color: #856404;
    font-weight: 500;
}

.tip-button {
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    font-weight: 600;
}

.tip-button:hover {
    background: #0056b3;
}

.tip-close {
    background: transparent;
    border: none;
    color: #856404;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.tip-close:hover {
    background: rgba(133, 100, 4, 0.1);
}

/* 教程弹窗样式 */
.tutorial-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tutorial-modal.show {
    opacity: 1;
    visibility: visible;
}

.tutorial-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.tutorial-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    -moz-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tutorial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.tutorial-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.tutorial-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.tutorial-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.tutorial-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.tutorial-notice {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 2px solid #ffc107;
    border-radius: 12px;
    margin-bottom: 24px;
    gap: 12px;
}

.notice-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.notice-text {
    color: #856404;
    font-size: 14px;
    line-height: 1.5;
}

.tutorial-steps {
    margin-bottom: 24px;
}

.tutorial-step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 16px;
}

.step-number {
    background: #3b82f6;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 4px;
}

.step-content h4 {
    margin: 0 0 8px 0;
    color: #1e40af;
    font-size: 16px;
    font-weight: 600;
}

.step-content p {
    margin: 0;
    color: #4b5563;
    line-height: 1.5;
    font-size: 14px;
}

.step-content a {
    color: #3b82f6;
    text-decoration: underline;
    font-weight: 500;
}

.step-content a:hover {
    color: #1d4ed8;
}

.tutorial-image {
    margin: 16px 0;
    text-align: center;
}

.tutorial-screenshot {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 2px solid #e5e7eb;
    -webkit-transition: -webkit-transform 0.2s ease;
    -moz-transition: -moz-transform 0.2s ease;
    transition: transform 0.2s ease;
}

.tutorial-screenshot:hover {
    -webkit-transform: scale(1.02);
    -moz-transform: scale(1.02);
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.image-caption {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
}

.tutorial-examples {
    background: #ecfdf5;
    border: 2px solid #10b981;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.tutorial-examples h4 {
    margin: 0 0 16px 0;
    color: #065f46;
    font-size: 16px;
    font-weight: 600;
}

.coordinate-examples {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.coord-example {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 12px 16px;
    font-family: "SF Mono", Monaco, monospace;
    font-size: 14px;
    color: #1f2937;
    border-left: 4px solid #10b981;
}

.tutorial-tips {
    background: #eff6ff;
    border: 2px solid #3b82f6;
    border-radius: 12px;
    padding: 20px;
}

.tutorial-tips h4 {
    margin: 0 0 12px 0;
    color: #1e40af;
    font-size: 16px;
    font-weight: 600;
}

.tutorial-tips ul {
    margin: 0;
    padding-left: 20px;
}

.tutorial-tips li {
    color: #374151;
    margin: 8px 0;
    line-height: 1.5;
    font-size: 14px;
}

.tutorial-footer {
    padding: 20px 24px;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.tutorial-ok-btn {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 32px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.tutorial-ok-btn:hover {
    background: #2563eb;
}

/* 教程弹窗响应式优化 */
@media (max-width: 768px) {
    .tutorial-modal-content {
        width: 95%;
        max-height: 95vh;
        margin: 2.5vh auto;
    }

    .tutorial-header {
        padding: 16px 20px;
    }

    .tutorial-header h2 {
        font-size: 18px;
    }

    .tutorial-body {
        padding: 20px;
    }

    .tutorial-step {
        gap: 12px;
    }

    .step-number {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .step-content h4 {
        font-size: 14px;
    }

    .step-content p {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .tutorial-modal-content {
        width: 98%;
        margin: 1vh auto;
    }

    .tutorial-header {
        padding: 12px 16px;
    }

    .tutorial-body {
        padding: 16px;
    }

    .tutorial-examples h4,
    .tutorial-tips h4 {
        font-size: 14px;
    }

    .coord-example {
        font-size: 12px;
        padding: 10px 12px;
    }
}

#search-results {
    margin-top: 5px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e0e0;
    max-height: 300px;
    overflow-y: auto;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
}

.search-result-item:hover {
    background: #f8f9fa;
}

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

.search-result-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.search-result-address {
    font-size: 12px;
    color: #666;
}

/* 模式切换面板样式 - 调整适应新容器 */
#mode-switch-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mode-btn {
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: #f0f0f0;
    color: #333;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mode-btn:hover {
    background-color: #e0e0e0;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.mode-btn.active {
    color: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transform: translateY(-1px);
    background-color: #4CAF50; /* Green for all active buttons */
}

.mode-btn.active:hover {
    transform: translateY(-2px);
}

/* 状态信息面板样式 - 调整适应新容器 */
#info-panel {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    font-size: 12px;
    min-width: 220px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

#info-panel div {
    margin: 4px 0;
}

#panel-title {
    font-weight: bold;
    font-size: 14px;
    color: #1f2937;
    margin-bottom: 8px !important;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

#coordinates {
    font-weight: bold;
    color: #2563eb;
}

#zoom-level {
    color: #059669;
}

#speed-info {
    color: #7c3aed;
    font-weight: bold;
}

#status {
    color: #dc2626;
}

/* 自定义地图控件样式 - 移到右下角 */
.leaflet-control-zoom {
    display: none !important; /* 隐藏默认缩放控件，使用自定义的 */
}

.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.8) !important;
    font-size: 10px !important;
}

/* 🔧 标准用户位置点样式（符合主流地图应用） + 方向指示 */
.user-location-dot {
    position: relative;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 脉冲外环 - 完美居中对齐 */
.location-dot-outer {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    background: rgba(66, 165, 245, 0.3);
    border: 2px solid #42A5F5;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: location-pulse 2s infinite;
    z-index: 1;
}

/* 内部实心圆点 - 完美居中对齐 */
.location-dot-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    background: #1976D2;
    border: 2px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    z-index: 3;
}

/* 🎮 方向指示箭头 - 环绕圆外侧旋转 */
.direction-arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 12px solid #1976D2;
    /* 关键：箭头距离中心14px（脉冲圆的半径 + 几个像素的间距） */
    transform: translate(-50%, -50%) translateY(-30px);
    transform-origin: 50% 24px; /* 旋转中心在圆点处 */
    z-index: 4;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.2s ease;
}

/* 当有方向指示时显示箭头 */
.user-location-dot.with-direction .direction-arrow {
    opacity: 1;
}

/* 脉冲动画 - 保持完美居中 */
@keyframes location-pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    70% {
        transform: translate(-50%, -50%) scale(1.8);
        opacity: 0.3;
    }
    100% {
        transform: translate(-50%, -50%) scale(2.2);
        opacity: 0;
    }
}

/* 保留原有样式作为备用 */
.current-position-marker {
    width: 50px;
    height: 50px;
    background: #62ff68;
    border-radius: 50%;
    border: 6px solid rgb(225, 241, 249);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.position-marker {
    width: 16px;
    height: 16px;
    background: #2196F3;
    border-radius: 50%;
    border: 3px solid rgba(237, 71, 143, 0.609);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.marker-base {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 3px solid #4CAF50;
}

.marker-arrow {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid #4CAF50;
}

.marker-arrow svg {
    position: absolute;
    top: -10px;
    left: -6px;
}

.navigation-path {
    stroke: #2196F3;
    stroke-width: 4;
    stroke-dasharray: 5, 5;
    stroke-linecap: round;
    fill: none;
    opacity: 0.8;
    animation: dash 30s linear infinite;
}

/* 🔧 删除旧的红色搜索标记样式，替换为新的绿色搜索结果标记样式 */
.green-search-result-marker {
    /* 绿色搜索结果标记不需要额外的CSS样式，因为所有样式都在内联样式中定义 */
    /* 这样可以避免与其他标记样式产生冲突 */
}

.beautiful-position-marker {
    position: relative;
    width: 48px;
    height: 48px;
    z-index: 100;
}

.marker-shadow {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    filter: blur(4px);
    z-index: 1;
}

.marker-container {
    position: relative;
    top: 8px;
    left: 8px;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
    z-index: 3;
    transition: transform 0.3s ease;
}

.marker-container svg {
    margin-top: 4px;
    margin-left: 4px;
}

.marker-pulse {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 32px;
    height: 32px;
    background: rgba(74, 144, 226, 0.4);
    border-radius: 50%;
    z-index: 2;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.6;
    }
    100% {
        transform: scale(0.8);
        opacity: 1;
    }
}

/* 位置标记悬停效果 */
.beautiful-position-marker:hover .marker-container {
    transform: scale(1.1);
}

.beautiful-position-marker:hover .marker-pulse {
    animation-duration: 1s;
}

/* 控制面板滚动条样式 */
QScrollArea {
    border: none;
    background: transparent;
}

QScrollBar:vertical {
    background: rgba(0, 0, 0, 0.1);
    width: 12px;
    border-radius: 6px;
    margin: 0px;
}

QScrollBar::handle:vertical {
    background: rgba(74, 144, 226, 0.6);
    border-radius: 6px;
    min-height: 20px;
}

QScrollBar::handle:vertical:hover {
    background: rgba(74, 144, 226, 0.8);
}

QScrollBar::handle:vertical:pressed {
    background: rgba(74, 144, 226, 1.0);
}

QScrollBar::add-line:vertical,
QScrollBar::sub-line:vertical {
    height: 0px;
}

QScrollBar::add-page:vertical,
QScrollBar::sub-page:vertical {
    background: transparent;
}

/* 🔧 右下角控制按钮组样式 */
#map-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

/* 🆕 自定义缩放按钮样式 */
.zoom-controls {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

.zoom-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: all 0.3s ease;
    position: relative;
}

.zoom-btn:first-child {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.zoom-btn:hover {
    background: rgba(33, 150, 243, 0.95);
    color: white;
    -webkit-transform: scale(1.05);
    -moz-transform: scale(1.05);
    transform: scale(1.05);
}

.zoom-btn:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

.zoom-btn svg {
    transition: all 0.3s ease;
}

/* Google Maps 风格的缩放按钮悬停效果 */
#zoom-in-btn:hover {
    background: rgba(33, 150, 243, 0.95);
}

#zoom-out-btn:hover {
    background: rgba(33, 150, 243, 0.95);
}

.map-control-btn {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

.map-control-btn:hover {
    background: rgba(76, 175, 80, 0.95);
    color: white;
    border-color: #4CAF50;
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.3);
}

.map-control-btn:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

.map-control-btn svg {
    transition: all 0.3s ease;
}

/* 蓝牙按钮状态：连接中/已连接（深色按钮样式） */
.map-control-btn.connecting {
    background: #f59e0b; /* 连接中：琥珀黄 */
    color: white;
    border-color: #f59e0b;
}
.map-control-btn.connected {
    background: #4CAF50; /* 已连接：深绿色 */
    color: white;
    border-color: #4CAF50;
}
.map-control-btn.connected:hover {
    background: #4CAF50;
}

/* 返回用户位置按钮特殊样式 */
#return-to-user-btn:hover {
    background: rgba(59, 130, 246, 0.95);
    border-color: #3b82f6;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

/* 地图样式选择菜单 */
.map-style-menu {
    position: absolute;
    bottom: 0;
    right: 54px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(15px);
    min-width: 160px;
    overflow: hidden;
    transform-origin: bottom right;
    animation: menuSlideIn 0.3s ease-out;
}

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

.style-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.style-option:last-child {
    border-bottom: none;
}

.style-option:hover {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
}

.style-option.active {
    background: rgba(76, 175, 80, 0.2);
    color: #2e7d32;
    font-weight: bold;
}

.style-icon {
    margin-right: 10px;
    font-size: 16px;
}

.style-name {
    font-size: 14px;
    color: inherit;
}

/* 🔧 调整原有控件位置，避免与新按钮重叠 */
.leaflet-control-layers {
    display: none !important; /* 隐藏默认的图层控制，使用自定义的样式切换 */
}

/* 🆕 自定义搜索弹窗样式 */
.custom-search-popup .leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(5, 150, 105, 0.2);
    backdrop-filter: blur(10px);
}

.custom-search-popup .leaflet-popup-content {
    margin: 8px 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.custom-search-popup .leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.98);
    border: 2px solid rgba(5, 150, 105, 0.2);
    border-top: none;
    border-right: none;
}

.custom-search-popup .leaflet-popup-close-button {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    font-size: 18px;
    font-weight: bold;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    top: 8px;
    right: 8px;
}

.custom-search-popup .leaflet-popup-close-button:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.1);
}

/* 🆕 模拟点弹窗样式 */
.custom-simulation-popup .leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(245, 158, 11, 0.3);
    backdrop-filter: blur(10px);
}

.custom-simulation-popup .leaflet-popup-content {
    margin: 8px 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.custom-simulation-popup .leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.98);
    border: 2px solid rgba(245, 158, 11, 0.3);
    border-top: none;
    border-right: none;
}

.custom-simulation-popup .leaflet-popup-close-button {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    font-size: 18px;
    font-weight: bold;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    top: 8px;
    right: 8px;
}

.custom-simulation-popup .leaflet-popup-close-button:hover {
    background: rgba(245, 158, 11, 0.2);
    transform: scale(1.1);
}

/* 🆕 传送点弹窗样式 */
.custom-teleport-popup .leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(59, 130, 246, 0.3);
    backdrop-filter: blur(10px);
}

.custom-teleport-popup .leaflet-popup-content {
    margin: 8px 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.custom-teleport-popup .leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.98);
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-top: none;
    border-right: none;
}

.custom-teleport-popup .leaflet-popup-close-button {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    font-size: 18px;
    font-weight: bold;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    top: 8px;
    right: 8px;
}

.custom-teleport-popup .leaflet-popup-close-button:hover {
    background: rgba(59, 130, 246, 0.2);
    transform: scale(1.1);
}

/* 🆕 当前位置标记弹窗样式 */
.custom-current-position-popup .leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(37, 99, 235, 0.3);
    backdrop-filter: blur(10px);
}

.custom-current-position-popup .leaflet-popup-content {
    margin: 8px 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.custom-current-position-popup .leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.98);
    border: 2px solid rgba(37, 99, 235, 0.3);
    border-top: none;
    border-right: none;
}

.custom-current-position-popup .leaflet-popup-close-button {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    font-size: 18px;
    font-weight: bold;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    top: 8px;
    right: 8px;
}

.custom-current-position-popup .leaflet-popup-close-button:hover {
    background: rgba(37, 99, 235, 0.2);
    transform: scale(1.1);
}

/* Multi-Point 路径点标记样式 */
.multipoint-marker {
    background: radial-gradient(circle, #4ebdf4, #44d0fe);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    color: white;
    font-weight: bold;
    font-size: 14px;
    z-index: 1000;
}

.multipoint-marker:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(52, 219, 245, 0.5);
}

/* Multi-Point 路径连线样式 */
.multipoint-path {
    stroke: #35f2ff;
    stroke-width: 3;
    stroke-opacity: 0.8;
    stroke-dasharray: 10, 5;
    fill: none;
}


/* 蓝牙连接弹窗样式 - 居中显示 */
.bluetooth-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    padding: 20px;
    font-family: Arial, sans-serif;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, -45%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

.bluetooth-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* 多设备连接计数文本 */
.multi-device-status {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.08);
    border: 1px solid rgba(76, 175, 80, 0.25);
    border-radius: 20px;
    padding: 4px 12px;
    margin: 0 0 12px 0;
    letter-spacing: 0.3px;
    transition: color 0.3s;
}

/* 达到上限时变成橙色警示 */
.multi-device-status.limit {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.3);
}

.bluetooth-discovery-tip {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin: -2px 0 10px;
    padding: 8px 10px;
    border: 1px solid rgba(59, 130, 246, 0.24);
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.08);
    color: #315b8a;
    font-size: 11px;
    line-height: 1.4;
    text-align: left;
}

.bluetooth-discovery-tip-icon {
    flex: 0 0 auto;
    color: #3b82f6;
    font-weight: 700;
}

/* 连接上限：置灰按钮 */
.connect-btn.limit-reached {
    background-color: #b0bec5 !important;
    color: #fff !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

.bluetooth-title {
    font-weight: bold;
    font-size: 18px;
    color: #333;
}

.bluetooth-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.bluetooth-close:hover {
    color: #666;
}

.bluetooth-content {
    text-align: center;
    margin: 20px 0;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.bluetooth-status {
    font-size: 15px;
    margin: 15px 0;
    color: #555;
}

.bluetooth-spinner {
    border: 4px solid rgba(52, 152, 219, 0.2);
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

.bluetooth-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
}

.bluetooth-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    flex: 1;
    margin: 0 5px;
    transition: all 0.2s;
}

.connect-btn {
    background-color: #3498db;
    color: white;
}

.connect-btn:hover {
    background-color: #2980b9;
}

.cancel-btn {
    background-color: #f1f1f1;
    color: #555;
}

.cancel-btn:hover {
    background-color: #e0e0e0;
}

.connected-content {
    display: none;
    text-align: center;
}

/* 成功图标 */
.success-icon {
    color: #4CAF50;
    font-size: 48px;
    margin-bottom: 15px;
}

.device-info {
    font-size: 14px;
    color: #666;
    margin: 10px 0;
}

/* 半透明遮罩层 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}


/* VIP拦截弹窗 - 提示升级为VIP界面内容 */
.vip-block-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.vip-block-container {
    width: 500px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.vip-block-header {
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    padding: 15px 20px;
    font-size: 18px;
    font-weight: bold;
}

.vip-block-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.vip-block-features {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.vip-block-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vip-block-column-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: #555;
}

.vip-block-footer {
    background: #f8f9fa;
    padding: 15px 20px;
    text-align: center;
    font-size: 14px;
    color: #666;
}

.vip-block-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.vip-block-btn {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.vip-block-btn-primary {
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
}

.vip-block-btn-secondary {
    background: #e9ecef;
    color: #495057;
}

.vip-block-btn-discount {
    background: linear(135deg, #ff9a9e, #fad0c4);
    color: white;
}



/* 设备列表样式 */
.device-list {
    height: 200px; /* 固定高度，更容易让用户感知这是一个滚动区域 */
    overflow-y: auto;
    padding: 5px;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px inset #eee;
}

.device-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    margin: 5px 0;
    background-color: #edf7ee; /* 扫描结果默认浅绿色底，增强识别度 */
    border: 1px solid #b7e1c2; /* 细绿边框增强对比 */
    border-radius: 6px;
    transition: all 0.2s ease;
}

.device-item:hover {
    background-color: #d9f0dd; /* 悬停时加深绿色 */
    border-color: #9dd6ac;
}

.device-info {
    flex-grow: 1;
}

.device-name {
    font-weight: 500;
}

/* 已配对设备标识 */
.paired-badge {
    display: inline-block;
    font-size: 0.75em;
    color: #2563eb;
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 10px;
    padding: 1px 8px;
    margin-left: 6px;
    vertical-align: middle;
}

/* 已知设备（历史连接过）的行样式 */
.device-item.known-device {
    position: relative;
    background-color: #eff6ff; /* 浅蓝色底，区分于扫描发现的浅绿色 */
    border: 1px solid #bfdbfe;
}

.device-item.known-device:hover {
    background-color: #dbeafe;
    border-color: #93c5fd;
}

/* 设备提示文字 */
.device-hint {
    font-size: 0.75em;
    color: #6b7280;
    margin-top: 2px;
    font-style: italic;
}

.device-address {
    font-size: 0.85em;
    color: #6c757d;
    margin-top: 2px;
}

.connect-btn {
    display: inline-block;
    padding: 5px 12px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s;
}

.connect-btn:hover {
    background-color: #218838;
}

/* 按钮常显，不再依赖鼠标悬停 */

/* 按钮样式 */
.bluetooth-btn {
    position: relative;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
}

.scan-btn {
    background-color: #2196F3;
    color: white;
}

.scan-btn:hover {
    background-color: #28a745;
}

.cancel-btn {
    background-color: #2196F3;
    color: white;
}

.cancel-btn:hover {
    background-color: #cddced;
}

.disconnect-btn {
    background-color: #2196F3;
    color: white;
}

.disconnect-btn:hover {
    background-color: #cddced;
}

/* 按钮内部元素 */
.btn-text {
    transition: opacity 0.2s;
}

.btn-spinner {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

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


/* 连接中按钮样式 */
.connecting-btn {
    background-color: #ffc107; /* 黄色表示连接中 */
    color: #333;
}

/* 连接中内容样式 */
#connecting-content {
    text-align: center;
    padding: 20px;
}



.device-connecting {
    background-color: #cfe9d6 !important; /* 连接中更明显的绿色提示 */
    pointer-events: none;
}

.connecting-spinner {
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top: 2px solid #3498db;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

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






/* Toast容器样式 - 固定在页面顶部中间 */
.toast-container {
    position: fixed;
    top: 11%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column-reverse; /* 新消息在上方，旧消息向下推移 */
    align-items: center;
    gap: 10px;
}

/* Toast消息样式 */
.toast {
    min-width: 300px;
    max-width: 80vw;
    padding: 15px 20px;
    background-color: #333;
    color: white;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    pointer-events: auto;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* 不同类型的Toast */
.toast.success {
    background-color: #28a745;
}

.toast.error {
    background-color: #dc3545;
}

.toast.warning {
    background-color: #ffc107;
    color: #333;
}

.toast.info {
    background-color: #17a2b8;
}

/* Toast图标 */
.toast-icon {
    margin-right: 12px;
    font-size: 20px;
}

/* 关闭按钮 */
.close-btn {
    margin-left: 15px;
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.close-btn:hover {
    opacity: 1;
}

/* ── 手动蓝牙地址输入 ── */
.manual-bt-section {
    margin: 10px 12px 4px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.manual-bt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f9fafb;
    cursor: pointer;
    font-size: 0.88em;
    font-weight: 500;
    color: #374151;
    user-select: none;
    transition: background 0.15s;
}

.manual-bt-header:hover {
    background: #f3f4f6;
}

.manual-bt-header .toggle-arrow {
    font-size: 0.7em;
    transition: transform 0.2s;
}

.manual-bt-header.open .toggle-arrow {
    transform: rotate(90deg);
}

.manual-bt-body {
    padding: 10px 14px 12px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
}

.manual-bt-hint {
    font-size: 0.75em;
    color: #6b7280;
    margin-bottom: 10px;
    line-height: 1.5;
}

.manual-bt-input-row {
    display: flex;
    gap: 8px;
}

#manual-bt-address {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85em;
    font-family: monospace;
    outline: none;
    transition: border-color 0.15s;
}

#manual-bt-address:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

#manual-bt-address::placeholder {
    font-family: inherit;
    color: #9ca3af;
}

.manual-bt-connect {
    padding: 8px 16px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.manual-bt-connect:hover {
    background: #4f46e5;
}

.manual-bt-connect:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.manual-bt-error {
    margin-top: 8px;
    padding: 6px 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    color: #dc2626;
    font-size: 0.78em;
}

/* 已知设备条目上的单个移除按钮 */
.known-device-remove {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 22px;
    height: 22px;
    line-height: 20px;
    text-align: center;
    background: rgba(255,255,255,0.8);
    color: #9ca3af;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    font-size: 0.75em;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
    z-index: 5;
}

.known-device-remove:hover {
    color: #ef4444;
    background: #fef2f2;
    border-color: #fca5a5;
}
