/* ===== 全局重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4CAF50;
    --primary-light: #81C784;
    --danger: #f44336;
    --warning: #FF9800;
    --text-main: #333;
    --text-sub: #666;
    --text-hint: #999;
    --bg-page: #f5f5f5;
    --bg-card: #fff;
    --border: #e8e8e8;
}

body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-page);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

/* ===== 统计栏 ===== */
.stats-bar {
    display: flex;
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    padding: 16px 0;
    text-align: center;
}

.stat-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: 1px solid rgba(255,255,255,0.2);
}

.stat-item:last-child {
    border-right: none;
}

.stat-num {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
}

.stat-item.highlight .stat-num {
    color: #FFEB3B;
}

.stat-label {
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    margin-top: 2px;
}

/* ===== 顶部漂浮头（搜索 + 筛选） ===== */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
}

/* ===== 搜索栏 ===== */
.search-bar {
    padding: 10px 12px;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.search-input-wrap {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 20px;
    padding: 0 12px;
    height: 36px;
}

.search-icon {
    flex-shrink: 0;
}

.search-input-wrap input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    margin: 0 8px;
    color: var(--text-main);
}

.search-input-wrap input::placeholder {
    color: var(--text-hint);
}

.clear-btn {
    border: none;
    background: #ccc;
    color: #fff;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 12px;
    line-height: 18px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

/* ===== 筛选栏 ===== */
.filter-bar {
    display: flex;
    align-items: center;
    background: #fff;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    gap: 8px;
}

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

.filter-tab {
    padding: 5px 14px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 16px;
    font-size: 13px;
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.filter-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* 价格排序快捷按钮 */
.sort-price-btn {
    padding: 5px 12px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 16px;
    font-size: 13px;
    color: var(--text-sub);
    cursor: pointer;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s;
}

.sort-price-btn.active {
    color: var(--primary);
    border-color: var(--primary);
    background: #E8F5E9;
}

.filter-more-btn {
    padding: 5px 12px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 16px;
    font-size: 13px;
    color: var(--text-sub);
    cursor: pointer;
    white-space: nowrap;
}

.filter-more-btn.active {
    color: var(--primary);
    border-color: var(--primary);
}

/* ===== 筛选面板（漂浮下拉浮层） ===== */
.filter-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    max-height: 70vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 99;
    animation: slideDown 0.2s ease;
}

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

.filter-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.filter-row label {
    width: 70px;
    font-size: 13px;
    color: var(--text-sub);
    flex-shrink: 0;
}

.price-range {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.price-range input {
    width: 70px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-align: center;
    font-size: 13px;
    outline: none;
}

.price-range input:focus {
    border-color: var(--primary);
}

.filter-row select {
    flex: 1;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    padding: 0 8px;
    background: #fff;
    outline: none;
}

.filter-row select:focus {
    border-color: var(--primary);
}

.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.btn-reset, .btn-apply {
    flex: 1;
    height: 36px;
    border-radius: 18px;
    font-size: 14px;
    cursor: pointer;
    border: none;
}

.btn-reset {
    background: #f5f5f5;
    color: var(--text-sub);
}

.btn-apply {
    background: var(--primary);
    color: #fff;
}

/* ===== 属性筛选 ===== */
.filter-row-attr {
    flex-direction: column;
    align-items: flex-start;
}

.filter-row-attr label {
    margin-bottom: 8px;
}

.attr-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
}

.attr-chip {
    padding: 4px 12px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 14px;
    font-size: 12px;
    color: var(--text-sub);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.15s;
}

.attr-chip.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* 房间卡片上的属性标签 */
.room-attrs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.room-attr-tag {
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    background: #E3F2FD;
    color: #1565C0;
}

/* ===== 房间列表 ===== */
.room-list {
    padding: 8px;
}

.room-card {
    background: var(--bg-card);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.room-card:active {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.room-card-body {
    display: block;
    padding: 0;
}

/* 手机端：满宽大图，整卡顶部展示（4:3 比例） */
.room-cover {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    border-radius: 0;
    display: block;
    object-fit: cover;
    background: #f0f0f0;
}

.room-cover-placeholder {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 0;
    background: linear-gradient(135deg, #e0e0e0, #f5f5f5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #ccc;
}

.room-info {
    padding: 10px 12px 14px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* 标题行：标题 + 价格 同一行，价格靠右与标题平齐 */
.room-head-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.room-head-row .room-title {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.room-head-row .room-price {
    flex-shrink: 0;
    white-space: nowrap;
    margin-left: auto;
}

.room-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.room-meta {
    font-size: 12px;
    color: var(--text-hint);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.room-meta .tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.room-meta .tag-region {
    background: #E3F2FD;
    color: #1565C0;
}

.room-meta .tag-seq {
    background: #F5F5F5;
    color: #666;
}

.room-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--danger);
}

.room-price .unit {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-hint);
}

.status-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-vacant {
    background: #E8F5E9;
    color: var(--primary);
}

.status-occupied {
    background: #FFEBEE;
    color: var(--danger);
}

.status-reserved {
    background: #FFF3E0;
    color: #E65100;
}

/* ===== 加载更多 ===== */
.load-more {
    text-align: center;
    padding: 16px 0 24px;
}

.load-more-btn {
    padding: 8px 32px;
    border: 1px solid var(--primary);
    background: #fff;
    color: var(--primary);
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
}

.load-more-btn:active {
    background: var(--primary);
    color: #fff;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-hint);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-sub {
    font-size: 12px;
    margin-top: 4px;
}

/* ===== 加载动画 ===== */
.loading-dots {
    text-align: center;
    padding: 20px;
    color: var(--text-hint);
}

.loading-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    margin: 0 3px;
    animation: bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* ===== 详情弹窗 ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-overlay.show {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.modal-content {
    background: #fff;
    width: 100%;
    max-width: 600px;
    min-height: 100%;
    animation: slideUp 0.25s ease;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    border: none;
    background: none;
    font-size: 24px;
    color: var(--text-hint);
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

.modal-body {
    padding: 16px;
}

/* 图片画廊 */
.gallery {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
}

.gallery::-webkit-scrollbar {
    height: 3px;
}

.gallery::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.gallery img {
    width: 200px;
    height: 150px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    cursor: pointer;
}

/* 详情信息块 */
.detail-section {
    margin-bottom: 16px;
}

.detail-section h3 {
    font-size: 14px;
    color: var(--text-sub);
    margin-bottom: 8px;
    padding-left: 8px;
    border-left: 3px solid var(--primary);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
}

.detail-item {
    display: flex;
    font-size: 13px;
}

.detail-item .label {
    color: var(--text-hint);
    width: 70px;
    flex-shrink: 0;
}

.detail-item .value {
    color: var(--text-main);
    flex: 1;
    word-break: break-all;
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.detail-tag {
    padding: 2px 8px;
    background: #F5F5F5;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-sub);
}

.price-highlight {
    font-size: 28px;
    font-weight: 700;
    color: var(--danger);
    text-align: center;
    padding: 12px 0;
    border-bottom: 1px dashed var(--border);
    margin-bottom: 16px;
}

.price-highlight .unit {
    font-size: 14px;
    font-weight: 400;
}

/* ===== 位置地图卡片 ===== */
.location-section .map-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.map-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    background: #eef1f4;
}

.map-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-hint);
    font-size: 13px;
    text-align: center;
    padding: 0 12px;
}

.map-address {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-sub);
    border-top: 1px solid var(--border);
    line-height: 1.4;
}

.map-address svg {
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--primary);
}

.map-address .addr-text {
    word-break: break-all;
}

.remark-box {
    background: #FFF9C4;
    border-radius: 8px;
    padding: 10px;
    font-size: 13px;
    color: #795548;
    line-height: 1.6;
}

/* ===== 图片幻灯片 ===== */
.image-viewer {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #000;
    z-index: 2000;
    display: none;
    overflow: hidden;
}

.image-viewer.show {
    display: flex;
    flex-direction: column;
}

.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    color: #fff;
    font-size: 14px;
    z-index: 10;
    flex-shrink: 0;
}

.viewer-close {
    border: none;
    background: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

/* 轮播轨道：scroll-snap 实现原生丝滑滑动 */
.viewer-track {
    flex: 1;
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.viewer-track::-webkit-scrollbar {
    display: none;
}

.viewer-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewer-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    -webkit-user-drag: none;
}

/* 左右箭头 */
.viewer-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.35);
    color: #fff;
    border: none;
    font-size: 28px;
    line-height: 40px;
    text-align: center;
    cursor: pointer;
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
    display: none;
    user-select: none;
    backdrop-filter: blur(4px);
}

.image-viewer.show .viewer-arrow.has-multi {
    display: block;
}

.viewer-prev { left: 10px; }
.viewer-next { right: 10px; }

.viewer-arrow:active {
    background: rgba(0,0,0,0.6);
}

/* 圆点指示器 */
.viewer-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 8px 0 16px;
    flex-shrink: 0;
}

.viewer-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: all 0.25s ease;
}

.viewer-dot.active {
    background: #fff;
    width: 18px;
    border-radius: 3px;
}

/* ===== 访问码遮罩 ===== */
.access-mask {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.access-card {
    background: #fff;
    border-radius: 18px;
    width: 100%;
    max-width: 360px;
    padding: 36px 28px 28px;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    animation: accessPop 0.28s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes accessPop {
    from { opacity: 0; transform: scale(0.9) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.access-icon {
    font-size: 48px;
    line-height: 1;
    margin-bottom: 12px;
}

.access-card h2 {
    font-size: 19px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 10px;
}

.access-tip {
    font-size: 15px;
    color: #333;
    margin: 0 0 4px;
    line-height: 1.5;
}

.access-tip-sub {
    font-size: 13px;
    color: #999;
    margin: 0 0 22px;
    line-height: 1.5;
}

.access-input-wrap {
    margin-bottom: 16px;
}

.access-input-wrap input {
    width: 100%;
    height: 46px;
    border: 1.5px solid #e0e0e0;
    border-radius: 12px;
    padding: 0 16px;
    font-size: 16px;
    text-align: center;
    letter-spacing: 2px;
    box-sizing: border-box;
    transition: border-color 0.2s;
    outline: none;
}

.access-input-wrap input:focus {
    border-color: #1677ff;
}

.access-submit {
    width: 100%;
    height: 46px;
    border: none;
    border-radius: 12px;
    background: #1677ff;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.access-submit:active {
    background: #0958d9;
}

.access-submit:disabled {
    background: #9cc7ff;
    cursor: not-allowed;
}

.access-err {
    min-height: 18px;
    margin: 12px 0 0;
    font-size: 13px;
    color: #ff4d4f;
}

/* ===== 复制房源链接 ===== */
.detail-share {
    text-align: center;
    padding: 16px 12px 4px;
    border-top: 1px dashed #eee;
}
.btn-copy-link {
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    background: #1677ff;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-copy-link:active {
    background: #0958d9;
}
.share-tip {
    margin: 8px 0 0;
    font-size: 12px;
    color: #999;
    line-height: 1.5;
}

/* ===== 轻提示 toast ===== */
.app-toast {
    position: fixed;
    left: 50%;
    bottom: 60px;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    max-width: 80%;
    text-align: center;
}
.app-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== 地图找房漂浮按钮 ===== */
.map-float-btn {
    position: fixed;
    right: 16px;
    bottom: 80px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 999;
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: visible;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.map-float-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin-bottom: 2px;
}

.map-float-label {
    font-size: 10px;
    color: #333;
    font-weight: 600;
    line-height: 1;
}

.map-float-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
    .map-float-btn {
        right: 24px;
        bottom: 24px;
        width: 80px;
        height: 80px;
    }
    
    .map-float-img {
        width: 48px;
        height: 48px;
    }
    
    .map-float-label {
        font-size: 12px;
    }
}
