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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: #333;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

#sidebar {
    width: 340px;
    min-width: 300px;
    background: #fff;
    border-right: 1px solid #e8e8e8;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04);
    z-index: 1000;
}

.sidebar-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    flex-shrink: 0;
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 2px;
}

.subtitle {
    font-size: 12px;
    opacity: 0.9;
}

.search-box {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.search-box input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 16px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
}

.search-box input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.search-box button {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: #667eea;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.search-box button:hover {
    background: #5568d3;
}

.suggestions {
    position: fixed;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 2000;
    display: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.suggestions.show {
    display: block;
}

.suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s;
}

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

.suggestion-item:hover,
.suggestion-item.active {
    background: #f0f4ff;
}

.suggestion-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggestion-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suggestion-name mark {
    background: #fff3cd;
    color: #667eea;
    padding: 0;
}

.suggestion-region {
    font-size: 10px;
    color: #667eea;
    background: #eef1ff;
    padding: 1px 6px;
    border-radius: 8px;
    margin-right: 4px;
    vertical-align: middle;
    font-weight: 500;
}

.search-marker {
    background: transparent;
    border: none;
}

.search-blue-dot {
    position: relative;
    background: #1e88e5;
    color: #fff;
    padding: 4px 10px 4px 12px;
    border-radius: 16px 16px 16px 2px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(30, 136, 229, 0.4);
    transform: translate(-6px, -100%);
    pointer-events: none;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-blue-dot::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 10px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #1e88e5;
}

.filter-section {
    padding: 10px 12px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.filter-group {
    display: flex;
    align-items: flex-start;
    padding: 6px 0;
    gap: 8px;
}

.filter-label {
    flex-shrink: 0;
    width: 36px;
    font-size: 13px;
    color: #999;
    font-weight: 500;
    line-height: 26px;
    padding-top: 2px;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}

.filter-option {
    display: inline-block;
    padding: 5px 12px;
    border: 1px solid #e8e8e8;
    border-radius: 14px;
    font-size: 12px;
    color: #555;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    background: #fff;
    line-height: 1;
}

.filter-option:hover {
    border-color: #667eea;
    color: #667eea;
}

.filter-option.active {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
}

.filter-options.multi .filter-option.active {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
}

.filter-actions {
    padding-top: 10px;
    border-top: 1px dashed #eee;
    margin-top: 8px;
    display: flex;
    gap: 10px;
}

.filter-confirm-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 22px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.35);
}

.filter-confirm-btn:active {
    transform: scale(0.97);
}

.filter-reset-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid #e8e8e8;
    border-radius: 22px;
    background: #fff;
    color: #888;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-reset-btn:hover {
    border-color: #bbb;
    color: #666;
    background: #fafafa;
}

.filter-reset-btn:active {
    transform: scale(0.97);
}

.result-info {
    padding: 10px 16px;
    font-size: 13px;
    color: #666;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.result-info .divider {
    color: #ddd;
}

#resultCount {
    color: #667eea;
    font-weight: 600;
}

#mapContainer {
    flex: 1;
    position: relative;
    height: 100%;
    min-width: 0;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #e8e8e8;
}

#mapControls {
    position: absolute;
    bottom: 100px;
    right: 16px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group {
    display: flex;
    gap: 8px;
}

.map-btn {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-btn:hover {
    border-color: #667eea;
    color: #667eea;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
    transform: scale(1.05);
}

.map-btn.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.community-marker-wrapper {
    background: transparent !important;
    border: none !important;
}

.community-marker {
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    text-align: center;
}

.community-marker:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.35);
    z-index: 1000;
}

.community-name {
    display: inline-block;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    font-size: 14px;
    color: #667;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #f0f0f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Bottom Sheet 底部弹出 ===== */
.bottom-sheet {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.bottom-sheet.hidden {
    display: none;
}

.bs-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    transition: opacity 0.3s ease;
}

.bottom-sheet.hidden .bs-overlay {
    opacity: 0;
}

.bs-container {
    position: relative;
    background: #fff;
    border-radius: 16px 16px 0 0;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    animation: bsSlideUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes bsSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.bs-handle {
    width: 36px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    margin: 8px auto 4px;
    flex-shrink: 0;
}

.bs-header {
    padding: 8px 20px 12px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.bs-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.bs-title {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a1a;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bs-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    line-height: 1;
}

.bs-close:hover {
    background: #e8e8e8;
    color: #333;
}

.bs-subtitle {
    font-size: 13px;
    color: #999;
    margin-top: 4px;
}

.bs-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 16px env(safe-area-inset-bottom);
}

/* ===== Bottom Sheet 房间卡片（横向布局） ===== */
.bs-body .room-list {
    padding: 8px 0 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bs-body .room-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
    display: block;
    padding: 0;
    border: none;
}

.bs-body .room-card:active {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    transform: scale(0.98);
}

.bs-body .room-card-body {
    display: flex;
    flex-direction: row;
    padding: 12px;
    gap: 12px;
    align-items: stretch;
}

.bs-body .room-cover {
    width: 180px;
    height: 134px;
    border-radius: 8px;
    flex-shrink: 0;
    object-fit: cover;
    background: #f0f0f0;
}

.bs-body .room-cover-placeholder {
    width: 180px;
    height: 134px;
    border-radius: 8px;
    background: linear-gradient(135deg, #e0e0e0, #f5f5f5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #ccc;
    flex-shrink: 0;
}

.bs-body .room-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
}

.bs-body .room-head-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.bs-body .room-head-row .room-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
    flex: 1;
    min-width: 0;
}

.bs-body .room-head-row .room-price {
    color: #ff6b35;
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.bs-body .room-head-row .room-price .price-num {
    font-size: 20px;
}

.bs-body .room-head-row .room-price .price-suffix {
    font-size: 12px;
    font-weight: normal;
    color: #999;
}

.bs-body .room-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.bs-body .room-meta span {
    background: #f5f5f5;
    color: #666;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
}

.bs-body .room-facilities {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.bs-body .facility-tag {
    font-size: 13px;
    background: transparent;
    padding: 0;
}

.room-attr {
    background: #fff3ed !important;
    color: #ff6b35 !important;
}

/* 房源标签 */
.bs-body .room-tag {
    display: inline-block;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    margin-right: 4px;
}

/* 统计信息行（浏览/咨询数） */
.bs-body .room-stats {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    font-size: 11px;
    color: #999;
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    border-radius: 8px !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    border: none !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 18px !important;
}

.leaflet-control-zoom a:hover {
    background: #f5f5f5 !important;
    color: #667eea !important;
}

.leaflet-popup-tip {
    box-shadow: none !important;
}

.leaflet-popup-content-wrapper {
    border-radius: 12px !important;
}

@media (max-width: 768px) {
    #app {
        position: relative;
    }

    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 88%;
        max-width: 340px;
        height: 100vh;
        min-width: unset;
        border-right: 1px solid #e8e8e8;
        border-bottom: none;
        z-index: 1100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    #sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close {
        position: absolute;
        top: 12px;
        right: 12px;
        width: 30px;
        height: 30px;
        border: none;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 50%;
        color: #fff;
        font-size: 20px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    .sidebar-close:hover {
        background: rgba(255, 255, 255, 0.4);
    }

    .sidebar-header h1 {
        font-size: 17px;
    }

    .sidebar-header {
        padding: 14px 44px 12px 16px;
    }

    #mapContainer {
        height: 100vh;
        width: 100vw;
    }

    .panel-toggle {
        position: absolute;
        left: 12px;
        z-index: 600;
        height: 36px;
        padding: 0 14px;
        border: none;
        border-radius: 18px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        box-shadow: 0 3px 14px rgba(102, 126, 234, 0.4);
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: 5px;
        transition: all 0.25s ease;
        color: #fff;
        font-size: 13px;
        font-weight: 500;
        letter-spacing: 0.5px;
        white-space: nowrap;
    }

    .panel-toggle:active {
        transform: scale(0.96);
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    }

    .panel-toggle .filter-icon {
        font-size: 15px;
        line-height: 1;
    }

    .panel-toggle .filter-text {
        line-height: 1;
    }

    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1050;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }

    .sidebar-backdrop.show {
        opacity: 1;
        visibility: visible;
    }

    .filter-section {
        padding: 8px 10px;
    }

    .filter-option {
        padding: 4px 10px;
        font-size: 11px;
    }

    .filter-label {
        font-size: 12px;
        width: 32px;
    }

    .filter-reset-btn,
    .filter-confirm-btn {
        font-size: 13px;
        padding: 9px;
    }

    .community-marker {
        padding: 5px 10px;
        font-size: 12px;
        max-width: 180px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .bs-container {
        max-height: 80vh;
    }

    .bs-body .room-card-body {
        padding: 10px;
        gap: 10px;
    }

    .bs-body .room-cover,
    .bs-body .room-cover-placeholder {
        width: 144px;
        height: 108px;
    }

    .bs-body .room-head-row .room-title {
        font-size: 14px;
    }

    .bs-body .room-head-row .room-price {
        font-size: 15px;
    }

    .bs-body .room-head-row .room-price .price-num {
        font-size: 18px;
    }

    .bs-title {
        font-size: 16px;
    }

    #mapControls {
        bottom: 80px;
        right: 12px;
    }

    .map-btn {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
}

@media (min-width: 769px) {
    .panel-toggle,
    .sidebar-close {
        display: none;
    }
}

#resultCount,
#currentLocation {
    font-size: 13px;
}

.filter-option {
    transition: all 0.15s ease;
}
