/* 地图选择器样式 */

/* 防止模态框导致页面横向滚动 */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

/* 确保所有地图相关元素使用border-box */
.map-modal,
.map-modal *,
.map-modal *::before,
.map-modal *::after {
    box-sizing: border-box;
}

/* 地图模态框 */
.map-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-x: hidden;  /* 防止横向滚动 */
}
/* 通过类名打开模态框，避免JS写内联样式 */
.map-modal.is-open {
    display: flex;
}
/* 打开模态框时禁止页面滚动 */
body.no-scroll {
    overflow: hidden;
    overflow-x: hidden !important;  /* 明确禁止横向滚动 */
    position: fixed;  /* 防止移动端背景滚动 */
    width: 100%;  /* 固定宽度 */
    max-width: 100vw;  /* 确保不超过视口宽度 */
}

.map-modal-dialog {
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.map-modal-content {
    background: white;
    border-radius: 10px;  /* 统一为10px，与其他模态框一致 */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
}

.map-modal-header {
    padding: 20px 25px 15px;  /* 统一padding，与其他模态框一致 */
    border-bottom: 1px solid #e9ecef;  /* 统一边框颜色 */
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;  /* 改为白色背景，与其他模态框一致 */
}

.map-modal-title {
    margin: 0;
    font-size: 20px;  /* 统一字体大小 */
    font-weight: 600;
    color: #212529;  /* 使用网站主色深色，与其他模态框一致 */
}

.map-close-btn {
    background: none;
    border: none;
    color: #6c757d;  /* 改为深灰色，与白色背景搭配 */
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.map-close-btn:hover {
    color: #212529;  /* hover时更深 */
    transform: scale(1.1);
}

.map-modal-body {
    padding: 20px 25px;  /* 统一padding，与其他模态框一致 */
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.map-search-box {
    display: flex;
    gap: 8px;
}

.map-search-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #e9ecef;  /* 统一边框颜色 */
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.15s ease-in-out;
}

.map-search-input:focus {
    outline: none;
    border-color: #ced4da;  /* 聚焦时使用柔和的灰色边框 */
    box-shadow: none;  /* 去除默认蓝色阴影 */
}

.map-search-btn {
    padding: 10px 20px;
    background: #3a7bd5;  /* 使用网站主色 */
    color: white;
    border: none;
    border-radius: 5px;  /* 统一圆角 */
    cursor: pointer;
    transition: background 0.3s;
    font-size: 14px;
}

.map-search-btn:hover {
    background: #2a5ba8;  /* hover时使用深蓝色 */
}

/* 地图容器包装器（包含地图+中心图标） */
.map-wrapper {
    position: relative;
    width: 100%;
    height: 450px;
}

.baidu-map-container {
    width: 100%;
    height: 100%;
    border: 1px solid #e9ecef;  /* 统一边框颜色 */
    border-radius: 8px;
    overflow: hidden;
}

/* 百度地图控件基础样式 - 确保PC端控件可见 */
.baidu-map-container .BMap_stdMpZoom {
    display: block !important;
    visibility: visible !important;
}

/* 中心图标与提示（全局基础样式，移动端/PC均可用） */
.map-center-marker {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -100%);
    z-index: 1000;  /* 降低z-index，避免遮挡地图控件 */
    pointer-events: none !important;  /* 确保不拦截任何点击事件 */
    font-size: 42px;
    line-height: 1;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.4));
    display: none;
    transition: opacity 0.3s ease;
}
.map-center-marker.is-visible {
    display: block;
    opacity: 1;
}

/* 自定义确认弹窗 - 与页面风格统一 */
.map-confirm-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 1400;
}
.map-confirm-overlay.is-open { 
	display: flex; 
}

.map-confirm-dialog {
	background: #ffffff;
	border-radius: 10px;  /* 与其他模态框一致 */
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	width: 420px;
	max-width: calc(100% - 32px);
	overflow: hidden;
	animation: modalSlideIn 0.3s ease-out;  /* 使用与其他模态框一致的动画 */
}
@keyframes modalSlideIn {
	from {
		opacity: 0;
		transform: translateY(-50px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.map-confirm-icon {
	font-size: 48px;
	text-align: center;
	padding: 24px 24px 16px;
	background: #f8f9fa;  /* 简化背景 */
}
.map-confirm-content {
	padding: 0 25px 20px;  /* 统一padding */
}
.map-confirm-title {
	font-size: 20px;  /* 与其他模态框一致 */
	font-weight: 600;
	color: #212529;  /* 使用网站主色深色 */
	margin-bottom: 12px;
	text-align: center;
	line-height: 1.4;
}
.map-confirm-message {
	font-size: 14px;
	color: #666;
	line-height: 1.6;
	text-align: center;
	white-space: pre-line;
	background: #f8f9fa;
	border-radius: 6px;
	padding: 12px;
	margin-top: 8px;
}
.map-confirm-actions {
	display: flex;
	gap: 12px;
	padding: 15px 25px 20px;  /* 统一padding */
	border-top: 1px solid #e9ecef;  /* 统一边框颜色 */
}
.map-confirm-btn {
	flex: 1;
	padding: 10px 24px;  /* 统一按钮大小 */
	border-radius: 5px;  /* 统一圆角 */
	border: none;
	font-size: 14px;
	font-weight: normal;
	cursor: pointer;
	transition: background 0.3s;  /* 简化动画 */
}
.map-confirm-btn:focus {
	outline: none;
}
.map-confirm-btn-cancel {
	background: #6c757d;  /* 使用网站灰色按钮样式 */
	color: white;
}
.map-confirm-btn-cancel:hover {
	background: #5a6268;
}
.map-confirm-btn-primary {
	background: #3a7bd5;  /* 使用网站主色 */
	color: #ffffff;
}
.map-confirm-btn-primary:hover {
	background: #2a5ba8;  /* 使用网站主色深色 */
}

/* 移动端优化 */
@media (max-width: 768px) {
	.map-confirm-dialog {
		width: calc(100% - 32px);
		max-width: 400px;
	}
	.map-confirm-icon {
		font-size: 40px;
		padding: 20px 20px 12px;
	}
	.map-confirm-content {
		padding: 0 20px 16px;
	}
	.map-confirm-title {
		font-size: 18px;
	}
	.map-confirm-message {
		font-size: 13px;
		padding: 10px;
	}
	.map-confirm-actions {
		padding: 15px 20px;
		gap: 10px;
	}
	.map-confirm-btn {
		padding: 12px 20px;
		font-size: 15px;
	}
}

/* 自定义缩放控件（PC端，仿百度官方样式） */
.map-zoom-controls {
	position: absolute;
	bottom: 10px;  /* 移到右下角 */
	right: 10px;
	z-index: 1200;
	display: flex;
	flex-direction: column;
	gap: 0;
	background: #fff;
	border: 1px solid rgba(0,0,0,0.2);
	border-radius: 4px;
	box-shadow: 0 2px 6px rgba(0,0,0,0.2);
	overflow: hidden;
}
.map-zoom-btn {
	width: 34px;
	height: 34px;
	border: 0;
	background: linear-gradient(#ffffff, #f4f4f4);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	transition: background-color 0.08s ease, background 0.08s ease;
}
.map-zoom-btn:hover { background: linear-gradient(#ffffff, #f5f5f5); }
.map-zoom-btn:active { background: linear-gradient(#ffffff, #f5f5f5); }
.map-zoom-btn:focus { outline: none; }
.map-zoom-btn + .map-zoom-btn { border-top: 1px solid #d7d7d7; }
.map-zoom-icon {
	font-size: 20px;
	line-height: 1;
	color: #666;
	font-weight: 700;
}


.map-info {
    padding: 12px;
    background: #e7f3ff;
    border-left: 4px solid #667eea;
    border-radius: 4px;
    font-size: 14px;
    color: #495057;
}

.map-modal-footer {
    padding: 15px 25px 20px;  /* 统一padding，与其他模态框一致 */
    border-top: 1px solid #e9ecef;  /* 统一边框颜色 */
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;  /* 确保footer不被压缩 */
    background: white;  /* 确保背景色 */
    z-index: 10;  /* 确保在内容之上 */
}

.map-modal-footer .btn-secondary {
    padding: 10px 24px;
    background: #6c757d;  /* 保持灰色 */
    color: white;
    border: none;
    border-radius: 5px;  /* 统一圆角 */
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.map-modal-footer .btn-secondary:hover {
    background: #5a6268;  /* hover时更深 */
}

.map-modal-footer .btn-primary {
    padding: 10px 30px;  /* 统一padding，与其他模态框一致 */
    background: #3a7bd5;  /* 使用网站主色 */
    color: white;
    border: none;
    border-radius: 5px;  /* 统一圆角 */
    cursor: pointer;
    font-size: 16px;  /* 统一字体大小 */
    transition: background 0.3s;
}

.map-modal-footer .btn-primary:hover {
    background: #2a5ba8;  /* hover时使用深蓝色 */
}

/* 移动端优化 */
@media (max-width: 768px) {
    .map-modal {
        padding: 0;
        align-items: flex-start;
        overflow: hidden;  /* 防止横向滚动 */
    }
    
    .map-modal-dialog {
        max-width: 100%;
        width: 100%;
        max-height: 100vh;
        height: 100vh;
        margin: 0;
        display: flex;
        flex-direction: column;
    }
    
    .map-modal-content {
        border-radius: 0;
        max-height: 100vh;
        height: 100vh;
        width: 100%;  /* 改为100%，避免超出屏幕 */
        max-width: 100vw;  /* 确保不超过视口宽度 */
        display: flex;
        flex-direction: column;
        overflow: hidden;  /* 防止内容溢出 */
    }
    
    .map-modal-header {
        padding: 12px 15px;
        flex-shrink: 0;
        position: relative;
        z-index: 20;
    }
    
    .map-modal-title {
        font-size: 16px;
    }
    
    .map-close-btn {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
    
    .map-modal-body {
        padding: 10px;
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        display: flex;
        flex-direction: column;
        gap: 10px;
        min-height: 0;
        -webkit-overflow-scrolling: touch;  /* iOS 平滑滚动 */
        padding-bottom: calc(100px + env(safe-area-inset-bottom));  /* 为固定底部按钮留出空间（按钮高度约80px + 20px间距） */
    }
    
    .map-search-box {
        flex-direction: column;
        gap: 8px;
        flex-shrink: 0;
    }
    
    .map-search-input {
        width: 100%;
        padding: 12px 15px;
        font-size: 15px;
        border-radius: 8px;
    }
    
    .map-search-btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 15px;
        border-radius: 8px;
    }
    
    .map-wrapper {
        flex: 1;
        min-height: 0;
        height: 100%;
        position: relative;
    }
    
    .baidu-map-container {
        height: 100%;
        width: 100%;
        border-radius: 8px;
    }
    
    /* 移动端底部按钮优化 - 固定在屏幕底部 */
    .map-modal-footer {
        position: fixed;
        bottom: 0;  /* 固定在底部 */
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100vw;  /* 确保不超过视口宽度 */
        padding: 12px 16px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));  /* 安全区域内边距 */
        flex-shrink: 0;
        z-index: 1500;  /* 确保在最上层 */
        background: white;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);  /* 顶部阴影，增强层次感 */
        border-top: 1px solid #e9ecef;  /* 统一边框颜色 */
    }
    
    .map-modal-footer .btn-secondary,
    .map-modal-footer .btn-primary {
        flex: 1;
        padding: 14px 20px;
        font-size: 16px;
        font-weight: 500;
        border-radius: 5px;  /* 统一圆角 */
        min-height: 48px;  /* 确保触摸区域足够大 */
    }
    
    /* 移动端信息提示区域 */
    .map-info {
        margin-bottom: 0;  /* 去掉留白，紧凑布局 */
        flex-shrink: 0;  /* 防止被压缩 */
    }
    
    /* 移动端自定义缩放控件 - 右下角，底部按钮上方 */
    .map-zoom-controls {
        bottom: 120px !important;  /* 提高位置，确保Chrome和Safari都不被遮挡 */
        right: 10px !important;
        left: auto !important;
        top: auto !important;
    }
    
    /* 移动端百度官方地图控件样式调整 - 右下角，底部按钮上方 */
    .baidu-map-container .BMap_stdMpZoom {
        left: auto !important;
        right: 10px !important;
        bottom: 120px !important;  /* 提高位置，确保Chrome和Safari都不被遮挡 */
        top: auto !important;
    }
    
    .baidu-map-container .BMap_stdMpPan {
        display: none !important;
    }
    
    /* 在移动端隐藏PC端模态框 */
    .map-modal-pc {
        display: none !important;
    }
}

/* PC端隐藏移动端模态框 */
@media (min-width: 769px) {
    .map-modal-mobile {
        display: none !important;
    }
}

/* 移动端专属模态框样式 */
.map-modal-mobile {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;  /* 动态视口高度，自动适配地址栏 */
    background: white;
    z-index: 10000;
    overflow: hidden;
}

.map-modal-mobile.is-open {
    display: flex;
    flex-direction: column;
}

.map-modal-mobile-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.map-modal-mobile-header {
    flex-shrink: 0;
    padding: 12px 15px;
    background: white;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 20;
}

.map-modal-mobile-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #212529;
}

.map-modal-mobile-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 10px;
    gap: 10px;
}

.map-wrapper-mobile {
    flex: 1;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.baidu-map-container-mobile {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

.map-modal-mobile-footer {
    flex-shrink: 0;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    z-index: 20;
}

.map-modal-mobile-footer .btn-secondary,
.map-modal-mobile-footer .btn-primary {
    flex: 1;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 500;
    border-radius: 5px;
    min-height: 48px;
    border: none;
    cursor: pointer;
}

.map-modal-mobile-footer .btn-secondary {
    background: #6c757d;
    color: white;
}

.map-modal-mobile-footer .btn-primary {
    background: #3a7bd5;
    color: white;
}

/* 移动端缩放控件位置 */
.map-wrapper-mobile .map-zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 10px;
    z-index: 100;
}

.map-wrapper-mobile .BMap_stdMpZoom {
    position: absolute !important;
    bottom: 20px !important;
    right: 10px !important;
    left: auto !important;
    top: auto !important;
}

