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

body,
html {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

body {
    font-family: "Microsoft YaHei", sans-serif;
    background-color: #f5f5f5;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* 菜单按钮样式 */
#menu-toggle {
    position: absolute;
    bottom: 125px;
    left: 15px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    z-index: 900;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 45px;
    text-align: center;
    padding: 0;
    margin: 0;
    outline: none;
    border: none;
    font-size: 22px;
}

#menu-toggle:hover {
    background-color: rgba(0, 0, 0, 0.8);
    transform: scale(1.05);
}

#menu-toggle:active {
    transform: scale(0.95);
}

#menu-toggle i {
    font-size: 22px;
    color: white;
}

/* 工具栏样式 */
.tools {
    background-color: white;
    position: absolute;
    left: 15px;
    bottom: 80px;
    width: 280px;
    max-width: 90vw;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    z-index: 999;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s;
    padding: 12px;
    overflow-y: auto;
    max-height: 70vh;
    border-radius: 10px;
    opacity: 0.95;
}

.tools.hidden {
    transform: translateY(30px) translateX(-120%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

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

.tool-header h1 {
    font-size: 18px;
    color: #3498db;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #777;
    cursor: pointer;
}

.close-btn:hover {
    color: #333;
}

.tool-group, .marker-options, .export-group {
    margin-bottom: 15px;
}

.tool-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 8px 12px;
    margin: 5px 5px 5px 0;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.3s;
}

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

.tool-btn.active {
    background-color: #e74c3c;
}

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

.location-btn:hover {
    background-color: #219653;
}

.location-btn.loading {
    background-color: #95a5a6;
    position: relative;
}

.location-btn.loading:after {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    right: 8px;
    top: 50%;
    margin-top: -6px;
    animation: spin 1s linear infinite;
}

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

#marker-icon, #marker-title, #marker-desc {
    margin: 5px 5px 5px 0;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
    width: 100%;
    max-width: 300px;
}

#marker-desc {
    resize: vertical;
    height: 60px;
}

#map {
    flex: 1;
    width: 100%;
    z-index: 1;
    height: calc(100% - 60px); /* 为底部搜索栏留出空间 */
    padding-bottom: 0;
    position: relative;
}

/* 自定义标记样式 */
.custom-marker-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

.marker-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transform: translateY(-15px);
}

.marker-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.marker-label {
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 12px;
    white-space: nowrap;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

/* 默认样式已通过JavaScript动态设置 */
.friendly-icon,
.not-friendly-icon,
.store-icon {
    /* 颜色现在通过JavaScript动态设置 */
}

.leaflet-popup-content {
    max-width: 250px;
}

/* 定位标记样式 */
.current-location-marker {
    background-color: #3498db;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.current-location-pulse {
    background-color: rgba(52, 152, 219, 0.3);
    border-radius: 50%;
    height: 14px;
    width: 14px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    70% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

/* 长按提示样式 */
.long-press-popup .leaflet-popup-content {
    font-size: 14px;
    text-align: center;
    background-color: rgba(52, 152, 219, 0.1);
    padding: 5px;
    border-radius: 4px;
}

.long-press-popup .leaflet-popup-content strong {
    color: #3498db;
}

.touch-hint {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 1000;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    animation: fadeInOut 4s forwards;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; display: none; }
}

/* 标记弹窗和编辑相关样式 */
.marker-popup {
    min-width: 150px;
}

.marker-content {
    margin-bottom: 8px;
}

.marker-actions {
    text-align: right;
    border-top: 1px solid #eee;
    padding-top: 8px;
}

.edit-marker-btn {
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

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

/* 编辑表单样式 */
.marker-edit-form {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.form-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.form-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    max-height: 90vh;
    overflow-y: auto;
}

.form-container h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
    text-align: center;
}

.form-field {
    margin-bottom: 15px;
}

.form-field label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-size: 14px;
}

.form-field input,
.form-field textarea,
.form-field select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.form-field textarea {
    resize: vertical;
    min-height: 80px;
}

.form-field select {
    height: 40px;
    background-color: white;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.form-actions button {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    flex: 1;
    margin: 0 5px;
    transition: background-color 0.2s;
}

#confirm-add-marker-btn, #save-marker-btn {
    background-color: #27ae60;
    color: white;
}

#confirm-add-marker-btn:hover, #save-marker-btn:hover {
    background-color: #219653;
}

#cancel-add-marker-btn, #cancel-edit-btn {
    background-color: #7f8c8d;
    color: white;
}

#cancel-add-marker-btn:hover, #cancel-edit-btn:hover {
    background-color: #6c7a7a;
}

@media (max-width: 768px) {
    .tools {
        padding: 10px;
        overflow-y: auto;
        max-height: 60vh;
        width: 250px;
        left: 10px;
        bottom: 110px;
    }
    
    .tool-header h1 {
        font-size: 16px;
    }
    
    .tool-btn {
        font-size: 13px;
        padding: 6px 10px;
        margin: 3px;
    }
    
    #marker-icon, #marker-title, #marker-desc {
        max-width: 100%;
    }
    
    .marker-options {
        display: flex;
        flex-direction: column;
    }
    
    #menu-toggle {
        bottom: 120px;
        left: 10px;
        width: 40px;
        height: 40px;
        font-size: 20px;
        line-height: 40px;
    }
    
    #menu-toggle i {
        font-size: 20px;
    }
    
    .center-marker-btn {
        bottom: 65px;
        right: 10px;
        width: 50px;
        height: 50px;
        font-size: 22px;
    }
    
    .current-location-btn {
        bottom: 130px;
        right: 10px;
        width: 50px;
        height: 50px;
        font-size: 22px;
    }
    
    .search-container {
        padding: 8px;
    }
    
    .search-input {
        height: 36px;
        font-size: 14px;
    }
    
    .search-btn {
        width: 36px;
        height: 36px;
    }
    
    .leaflet-control-zoom {
        bottom: 170px !important;
        left: 10px !important;
    }
    
    .leaflet-control-zoom a {
        width: 40px !important;
        height: 40px !important;
        line-height: 40px !important;
        font-size: 20px !important;
    }
}

/* 调整缩放控件位置，放在菜单按钮的上方，形成竖排 */
.leaflet-control-zoom {
    margin: 0 !important;
    padding: 0 !important;
    z-index: 900 !important;
    position: absolute !important;
    bottom: 180px !important;
    left: 15px !important;
    border: none !important;
    box-shadow: none !important;
    background: none !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
}

.leaflet-control-zoom a {
    width: 45px !important;
    height: 45px !important;
    line-height: 45px !important;
    font-size: 22px !important;
    border-radius: 50% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    color: white !important;
    transition: all 0.3s ease !important;
    background-color: #3498db !important;
    text-align: center !important;
    outline: none !important;
}

.leaflet-control-zoom-in {
    margin-bottom: 10px !important;
}

.leaflet-control-zoom a:hover {
    background-color: #2980b9 !important;
    transform: scale(1.05) !important;
}

.leaflet-control-zoom a:active {
    transform: scale(0.95) !important;
}

/* 准心样式 */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    pointer-events: none;
    z-index: 500;
}

.crosshair-vertical {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 30px;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

.crosshair-vertical::before,
.crosshair-vertical::after {
    content: '';
    position: absolute;
    left: 0;
    width: 2px;
    height: 6px;
    background-color: #e74c3c;
}

.crosshair-vertical::before {
    top: 0;
}

.crosshair-vertical::after {
    bottom: 0;
}

.crosshair-horizontal {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 30px;
    height: 2px;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

.crosshair-horizontal::before,
.crosshair-horizontal::after {
    content: '';
    position: absolute;
    top: 0;
    height: 2px;
    width: 6px;
    background-color: #e74c3c;
}

.crosshair-horizontal::before {
    left: 0;
}

.crosshair-horizontal::after {
    right: 0;
}

/* 准心标记按钮样式 */
.center-marker-btn {
    position: absolute;
    bottom: 75px;
    right: 15px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    cursor: pointer;
    transition: all 0.3s ease;
}

.center-marker-btn:hover {
    background-color: #c0392b;
    transform: scale(1.05);
}

.center-marker-btn:active {
    transform: scale(0.95);
}

/* 右下角定位按钮样式 */
.current-location-btn {
    position: absolute;
    bottom: 145px;
    right: 15px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 50%;
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    cursor: pointer;
    transition: all 0.3s ease;
}

.current-location-btn:hover {
    background-color: #2980b9;
    transform: scale(1.05);
}

.current-location-btn:active {
    transform: scale(0.95);
}

.current-location-btn.active {
    background-color: #27ae60;
}

/* 加载提示样式 */
#loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-content {
    background-color: rgba(0, 0, 0, 0.7);
    padding: 20px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loading-spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    margin-top: 10px;
}

.loading-sub-text {
    color: #cccccc;
    font-size: 13px;
    margin-top: 5px;
}

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

/* 左上角分组按钮样式 */
.category-buttons {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    border: none;
    border-radius: 50%;
    padding: 0;
    color: white;
    font-size: 18px;
    font-weight: 600;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 50px;
    min-width: 50px;
    width: 50px;
    height: 50px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.category-btn:active {
    transform: scale(0.92);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.category-btn.friendly {
    background-color: #27ae60;
}

.category-btn.friendly:active {
    background-color: #219653;
}

.category-btn.not-friendly {
    background-color: #e74c3c;
}

.category-btn.not-friendly:active {
    background-color: #c0392b;
}

.category-btn.store {
    background-color: #3498db;
}

.category-btn.store:active {
    background-color: #2980b9;
}

.category-btn.add-category {
    background-color: #9b59b6;
    border: 2px dashed #8e44ad;
}

.category-btn.add-category:active {
    background-color: #8e44ad;
}

/* 显示首字样式 */
.category-btn i {
    display: none;
}

.category-btn .first-letter {
    display: block;
    font-size: 20px;
    font-weight: bold;
}

.category-btn.add-category .first-letter {
    display: none;
}

.category-btn.add-category i {
    display: block;
    margin: 0;
    font-size: 20px;
}

.category-name {
    display: none;
}

/* 按钮标题提示 */
.category-btn::after {
    content: attr(title);
    position: absolute;
    top: 0;
    left: 60px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    transform: translateY(-50%) translateX(-10px);
    z-index: 1100;
}

.category-btn:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.category-btn.active {
    transform: scale(1.08);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.category-btn .edit-icon {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 22px;
    height: 22px;
    background-color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    font-size: 12px;
    color: #3498db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 1110;
    transition: all 0.2s ease;
}

.category-btn .edit-icon:hover {
    transform: scale(1.2);
    color: #2980b9;
    background-color: #f8f8f8;
}

@media (max-width: 768px) {
    .category-buttons {
        flex-direction: row;
        top: 15px;
        left: 15px;
        transform: none;
        gap: 8px;
    }
    
    .category-btn {
        min-height: 45px;
        min-width: 45px;
        width: 45px;
        height: 45px;
    }
    
    .category-btn::after {
        display: none;
    }
}

/* 分类编辑对话框 */
.edit-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.edit-dialog.hidden {
    display: none;
}

.edit-dialog-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.edit-dialog-content h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
    text-align: center;
}

.edit-form-field {
    margin-bottom: 15px;
}

.edit-form-field label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-size: 14px;
}

.edit-form-field input,
.edit-form-field select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

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

.dialog-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    flex: 1;
    margin: 0 5px;
}

.save-btn {
    background-color: #27ae60;
    color: white;
}

.save-btn:hover {
    background-color: #219653;
}

.cancel-btn {
    background-color: #7f8c8d;
    color: white;
}

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

/* 搜索框样式 */
.search-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px; /* 固定高度 */
    background-color: white;
    padding: 10px;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    z-index: 1000;
    box-sizing: border-box;
}

.search-input {
    flex: 1;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0 10px;
    font-size: 16px;
    box-shadow: none;
    outline: none;
}

.search-input:focus {
    border-color: #3498db;
}

.search-btn {
    width: 40px;
    height: 40px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.search-btn i {
    font-size: 18px;
}

/* 搜索结果样式 */
.search-results {
    position: absolute;
    bottom: 60px;
    left: 0;
    width: 100%;
    max-height: 300px;
    background-color: white;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    z-index: 999;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

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

.result-title {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 4px;
}

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

.search-loading, .no-results, .search-error {
    padding: 15px;
    text-align: center;
    color: #777;
}

/* 处理iOS底部安全区域 */
@supports (-webkit-touch-callout: none) {
    /* iOS设备专用样式 */
    #map {
        height: calc(100% - 60px - env(safe-area-inset-bottom, 0px));
    }
    
    .search-container {
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        height: calc(60px + env(safe-area-inset-bottom, 0px));
    }
    
    .center-marker-btn {
        bottom: calc(75px + env(safe-area-inset-bottom, 0px));
    }
    
    .current-location-btn {
        bottom: calc(145px + env(safe-area-inset-bottom, 0px));
    }
}