/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

:root {
    /* 主题色 - 清新蓝白 */
    --primary: #4A90E2;
    --primary-light: #6BA3E8;
    --primary-dark: #357ABD;
    --primary-bg: #EAF3FC;
    --success: #2ECC71;
    --success-bg: #E8F8F0;
    --danger: #E74C3C;
    --warning: #F39C12;

    /* 中性色 */
    --text-1: #1A1A1A;
    --text-2: #4A4A4A;
    --text-3: #8C8C8C;
    --text-4: #BFBFBF;
    --bg-page: #F5F7FA;
    --bg-card: #FFFFFF;
    --border: #EBEEF5;
    --divider: #F0F2F5;

    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: var(--text-1);
    background: var(--bg-page);
    line-height: 1.5;
    overflow-x: hidden;
}

body {
    padding-top: 44px;
    padding-bottom: 56px;
    min-height: 100vh;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    border: none;
    background: none;
    outline: none;
}

input, textarea, select {
    appearance: none;
    -webkit-appearance: none;
}

input::placeholder, textarea::placeholder {
    color: var(--text-4);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }

/* ==================== 顶部导航 ==================== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 44px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

.header-content {
    height: 100%;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.app-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.header-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-1);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 32px;
    justify-content: flex-end;
}

.header-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    cursor: pointer;
}

/* ==================== 主内容区 ==================== */
.app-main {
    min-height: calc(100vh - 100px);
}

.page {
    display: none;
    animation: fadeIn 0.2s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==================== 搜索栏 ==================== */
.search-bar {
    padding: 8px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 44px;
    z-index: 50;
}

.search-input-wrap {
    background: var(--bg-page);
    border-radius: 18px;
    padding: 0 12px;
    height: 36px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-3);
}

.search-input-wrap input {
    flex: 1;
    height: 100%;
    font-size: 14px;
    color: var(--text-1);
}

.clear-btn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-4);
    color: white;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* ==================== 房源列表 ==================== */
.property-list {
    padding: 12px;
}

.property-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s, box-shadow 0.15s;
}

.property-card:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-md);
}

.property-card-image {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #EAF3FC 0%, #D5E6F7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.property-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.property-card-image .no-image {
    color: var(--text-4);
    font-size: 13px;
}

.property-card-image .image-tag {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
}

.property-card-content {
    padding: 12px 14px 14px;
}

.property-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.property-card-address {
    font-size: 12px;
    color: var(--text-3);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.tag-item {
    background: var(--primary-bg);
    color: var(--primary);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    line-height: 1.4;
}

.tag-item.success {
    background: var(--success-bg);
    color: var(--success);
}

.property-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--divider);
    font-size: 12px;
    color: var(--text-3);
}

.property-card-price {
    color: var(--danger);
    font-size: 16px;
    font-weight: 600;
}

.property-card-price .unit {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-3);
    margin-left: 2px;
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 80px 32px;
}

.empty-icon {
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-text {
    color: var(--text-3);
    font-size: 14px;
    margin-bottom: 20px;
}

/* ==================== 通用按钮 ==================== */
.primary-btn {
    background: var(--primary);
    color: white;
    border-radius: 22px;
    padding: 0 20px;
    height: 44px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: opacity 0.15s;
}

.primary-btn:active {
    opacity: 0.8;
}

.primary-btn:disabled {
    background: var(--text-4);
    cursor: not-allowed;
}

.secondary-btn {
    background: var(--bg-card);
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 22px;
    padding: 0 20px;
    height: 44px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.secondary-btn:active {
    background: var(--primary-bg);
}

.block-btn {
    width: 100%;
    display: flex;
}

.link-btn {
    color: var(--primary);
    font-size: 13px;
    background: none;
    padding: 4px 0;
    cursor: pointer;
}

/* ==================== 表单 ==================== */
.property-form {
    padding: 12px;
}

.form-card {
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
}

.form-card-title {
    padding: 14px 16px 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-card-tip {
    font-size: 12px;
    color: var(--text-3);
    font-weight: 400;
}

.form-tip {
    padding: 0 16px 12px;
    font-size: 12px;
    color: var(--text-3);
}

.form-cells {
    padding: 0 16px 8px;
}

.form-cell {
    padding: 10px 0;
    border-bottom: 1px solid var(--divider);
}

.form-cell:last-child {
    border-bottom: none;
}

.form-cell-row {
    display: flex;
    gap: 12px;
    border-bottom: 1px solid var(--divider);
}

.form-cell-row .form-cell {
    flex: 1;
    border-bottom: none;
}

.cell-label {
    display: block;
    font-size: 13px;
    color: var(--text-2);
    margin-bottom: 4px;
}

.required {
    color: var(--danger);
    margin-right: 2px;
}

.cell-input {
    width: 100%;
    height: 32px;
    font-size: 15px;
    color: var(--text-1);
    background: transparent;
}

select.cell-input {
    background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%238C8C8C' d='M6 8L0 0h12z'/%3E%3C/svg%3E") no-repeat right center;
    background-size: 10px;
    padding-right: 16px;
}

.cell-textarea {
    width: 100%;
    min-height: 60px;
    font-size: 15px;
    color: var(--text-1);
    background: transparent;
    resize: none;
    padding: 4px 0;
}

.form-submit {
    display: flex;
    gap: 12px;
    padding: 16px 12px;
}

.form-submit button {
    flex: 1;
}

/* ==================== 封面图上传 ==================== */
.cover-uploader {
    padding: 0 16px 16px;
}

.cover-preview {
    width: 100%;
    aspect-ratio: 3 / 2;
    background: var(--primary-bg);
    border: 1.5px dashed var(--primary-light);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-3);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: background 0.15s;
}

.cover-preview:active {
    background: #D5E6F7;
}

.cover-preview p {
    font-size: 13px;
    margin-top: 6px;
}

.cover-hint {
    font-size: 11px !important;
    color: var(--text-4) !important;
    margin-top: 2px !important;
}

.cover-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cover-preview .remove-cover {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}

/* ==================== 房间图片上传 ==================== */
.room-uploader {
    padding: 0 16px 4px;
}

.room-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--divider);
}

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

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.room-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-1);
}

.room-count {
    font-size: 12px;
    color: var(--text-3);
}

.room-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 8px;
}

.room-image-item {
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    background: var(--bg-page);
}

.room-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.room-image-item .remove-image {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.room-add {
    aspect-ratio: 1;
    border: 1.5px dashed var(--primary-light);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-bg);
    cursor: pointer;
    transition: background 0.15s;
}

.room-add:active {
    background: #D5E6F7;
}

/* ==================== 房源详情 ==================== */
.property-detail {
    padding: 0;
}

.detail-header {
    background: var(--bg-card);
    padding: 16px;
    border-bottom: 8px solid var(--bg-page);
}

.detail-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 8px;
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-3);
    font-size: 13px;
    margin-bottom: 12px;
}

.detail-price {
    color: var(--danger);
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
}

.detail-price .unit {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-3);
    margin-left: 4px;
}

.detail-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.detail-actions button {
    flex: 1;
    height: 40px;
    border-radius: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
}

.detail-edit-btn {
    background: var(--primary-bg);
    color: var(--primary);
    border: 1px solid var(--primary-light);
}

.detail-delete-btn {
    background: white;
    color: var(--danger);
    border: 1px solid #FADCD9;
}

.detail-section {
    background: var(--bg-card);
    padding: 16px;
    margin-bottom: 8px;
}

.detail-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

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

.detail-item-label {
    color: var(--text-3);
    margin-bottom: 4px;
    font-size: 12px;
}

.detail-item-value {
    color: var(--text-1);
    font-size: 14px;
}

.detail-item.full {
    grid-column: 1 / -1;
}

/* 详情页图片组 */
.detail-image-group {
    margin-bottom: 16px;
}

.detail-image-group:last-child {
    margin-bottom: 0;
}

.detail-image-group-title {
    font-size: 13px;
    color: var(--text-2);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-image-group-title::before {
    content: "";
    width: 3px;
    height: 12px;
    background: var(--primary);
    border-radius: 2px;
}

.detail-image-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.detail-image-list img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    background: var(--bg-page);
}

/* ==================== 地图页 ==================== */
.map-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 100px);
}

.map-wrapper {
    flex: 1;
    background: #EAF3FC;
    position: relative;
}

.map-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-3);
    font-size: 14px;
}

.map-info {
    background: var(--bg-card);
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.selected-location h3 {
    font-size: 14px;
    color: var(--text-2);
    margin-bottom: 6px;
}

.selected-location p {
    color: var(--text-1);
    font-size: 13px;
    margin: 2px 0;
}

.coords-text {
    color: var(--text-3) !important;
    font-size: 12px !important;
}

.map-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.map-actions button {
    flex: 1;
    height: 40px;
}

/* ==================== 数据管理 ==================== */
.stats-card,
.action-card {
    background: var(--bg-card);
    margin: 12px;
    padding: 16px;
    border-radius: 12px;
}

.stats-card h3,
.action-card h3 {
    font-size: 15px;
    color: var(--text-1);
    margin-bottom: 12px;
}

.action-card p {
    font-size: 13px;
    color: var(--text-3);
    margin-bottom: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-item {
    text-align: center;
    padding: 8px 4px;
    background: var(--primary-bg);
    border-radius: 8px;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 11px;
    color: var(--text-3);
    margin-top: 2px;
}

.warning-text {
    color: var(--warning);
    font-size: 12px;
    margin-top: 8px !important;
    margin-bottom: 0 !important;
}

/* ==================== 底部TabBar ==================== */
.tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-3);
    cursor: pointer;
    font-size: 11px;
    background: none;
    border: none;
    padding: 6px 0;
    position: relative;
    transition: color 0.15s;
}

.tab-item svg {
    transition: stroke 0.15s;
}

.tab-item.active {
    color: var(--primary);
}

.tab-item.active svg {
    stroke: var(--primary);
}

.tab-plus {
    width: 44px;
    height: 44px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -16px;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
    transition: transform 0.15s;
}

.tab-plus:active {
    transform: scale(0.92);
}

/* ==================== 图片预览 ==================== */
.preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.preview-modal.active {
    display: flex;
}

.preview-modal img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.preview-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

/* ==================== ActionSheet 弹窗 ==================== */
.action-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.action-sheet.active {
    display: flex;
}

.action-sheet-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 320px;
    overflow: hidden;
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.action-sheet-header {
    padding: 20px 20px 8px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-1);
}

.action-sheet-body {
    padding: 0 20px 20px;
    text-align: center;
    font-size: 14px;
    color: var(--text-2);
}

.action-sheet-buttons {
    display: flex;
    border-top: 1px solid var(--divider);
}

.action-sheet-btn {
    flex: 1;
    height: 48px;
    font-size: 15px;
    background: none;
    border: none;
    cursor: pointer;
}

.action-sheet-btn.cancel {
    color: var(--text-2);
    border-right: 1px solid var(--divider);
}

.action-sheet-btn.confirm {
    color: var(--danger);
    font-weight: 500;
}

/* ==================== Toast ==================== */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    transition: all 0.2s;
    z-index: 2000;
    pointer-events: none;
    max-width: 80%;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

/* ==================== 响应式 ==================== */
@media screen and (min-width: 768px) {
    body {
        max-width: 480px;
        margin: 0 auto;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
        background: var(--bg-page);
    }
    .app-header, .tabbar {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
    }
    .app-header { right: auto; width: 480px; }
    .tabbar { right: auto; width: 480px; }
}

@media screen and (max-width: 360px) {
    .property-card-image { height: 160px; }
    .form-cells { padding: 0 12px 8px; }
    .form-card-title { padding: 12px 12px 8px; }
    .app-logo { width: 24px; height: 24px; }
    .header-title { font-size: 15px; }
}

/* ==================== 版权信息 ==================== */
.app-footer {
    text-align: center;
    padding: 16px 12px 12px;
    margin-top: 24px;
    margin-bottom: 56px; /* 避开底部TabBar */
    color: var(--text-4);
    font-size: 11px;
    line-height: 1.6;
}

.app-footer p {
    margin: 2px 0;
}

.app-footer .footer-brand {
    color: var(--text-3);
    font-size: 12px;
}
