/* 全局样式：简洁、适合电脑投屏 */
:root {
    --brand: #1a7a4a;
    --brand-dark: #145f3a;
    --brand-light: #e8f5ee;
}

body { background: #f6f8f7; font-size: 16px; }

.app-navbar {
    background: #fff;
    border-bottom: 2px solid var(--brand-light);
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.app-navbar .navbar-brand { color: var(--brand); font-weight: 700; font-size: 1.35rem; }
.app-navbar .nav-link { color: #444; }
.app-navbar .nav-link.active { color: var(--brand); font-weight: 700; }

.btn-success, .btn-primary {
    background: var(--brand); border-color: var(--brand);
}
.btn-success:hover, .btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-outline-success { color: var(--brand); border-color: var(--brand); }
.btn-outline-success:hover { background: var(--brand); }
.text-brand { color: var(--brand); }
.bg-brand-light { background: var(--brand-light); }

.card { border: none; border-radius: 12px; box-shadow: 0 1px 6px rgba(0,0,0,.06); }
.page-title { font-size: 1.5rem; font-weight: 700; }

/* 统计卡片 */
.stat-card { text-align: center; padding: 1.6rem 1rem; }
.stat-card .num { font-size: 2.2rem; font-weight: 700; color: var(--brand); }
.stat-card .label { color: #888; margin-top: .3rem; }

/* 房源树 */
.tree-community { border-left: 4px solid var(--brand); padding-left: 1rem; margin-bottom: 1.2rem; }
.tree-community h5 { font-weight: 700; }
.tree-community-header { cursor: pointer; user-select: none; border-radius: .5rem; }
.tree-community-header:hover h5 { color: var(--brand); }
.tree-toggle-icon { font-size: .8em; margin-right: .15rem; }
.tree-community-active .tree-community-name { color: var(--brand) !important; text-decoration: underline; }
.tree-room {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: .6rem;
    background: #fff; border-radius: 10px; padding: .8rem 1.2rem; margin-top: .6rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

/* 房源状态徽章：统一胶囊造型 + 状态圆点，配色柔和、区分清晰 */
.badge-vacant, .badge-rented, .badge-maint, .badge-reserved, .badge-pending, .badge-checkout {
    display: inline-flex; align-items: center; gap: .45em;
    border-radius: 999px; padding: .35em .95em;
    font-size: .75rem; font-weight: 600; letter-spacing: .03em;
    line-height: 1.4; border: 1px solid transparent;
    white-space: nowrap;
}
.badge-vacant::before, .badge-rented::before, .badge-maint::before,
.badge-reserved::before, .badge-pending::before, .badge-checkout::before {
    content: ''; width: .5em; height: .5em; border-radius: 50%;
    background: currentColor; flex: none;
}
.badge-vacant { background: #eaf7ef; color: #1e7d43; border-color: #c3e8d1; }
.badge-rented { background: #fdf3e0; color: #a5670c; border-color: #f2dfa8; }
.badge-maint { background: #e9effa; color: #3b5bab; border-color: #ccd9f0; }
.badge-reserved { background: #f3ebfa; color: #7b3fa0; border-color: #e2ccef; }
.badge-pending { background: #e6f1fd; color: #1c5db8; border-color: #c4ddf6; }
.badge-checkout { background: #fdeeee; color: #c0392b; border-color: #f5c9c4; }

.table > :not(caption) > * > * { padding: .85rem .75rem; }
.auth-card { max-width: 420px; margin: 6rem auto; }

/* 水电模板卡片：拖动排序 */
.tpl-drag { cursor: grab; }
.tpl-drag:active { cursor: grabbing; }
.tpl-dragging { opacity: .4; }
.tpl-drop-hint { outline: 2px dashed var(--bs-primary); outline-offset: 2px; border-radius: .5rem; }

/* ========== 移动端专项优化（仅 ≤767.98px 生效；桌面端样式规则零改动） ========== */
@media (max-width: 767.98px) {

    /* 触摸体验：消除 300ms 点击延迟与高亮闪烁 */
    a, button, .btn, .nav-link, .tree-community-header, .tree-room, .dropdown-item {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    /* 刘海/圆角屏安全区：顶部导航避开刘海，底部留出手势条空间 */
    body { padding-bottom: env(safe-area-inset-bottom); }
    .app-navbar { padding-top: env(safe-area-inset-top); }

    /* 顶部导航：品牌行 + 菜单行两行布局，菜单单行横向滑动。
       修复点：Bootstrap 在 navbar-expand-lg 断点以下将 .navbar-nav 置为 column（纵向堆叠），
       旧方案把滚动容器放在 .navbar-collapse 且强制 nowrap，导致菜单竖排撑高、
       溢出裁切、用户下拉菜单被 overflow 剪掉。现改为：容器自然换行，
       collapse 独占第二行横向 flex，滚动容器下移到 .navbar-nav 并显式 row 方向。 */
    .app-navbar .container-fluid { flex-wrap: wrap; row-gap: .15rem; padding-left: .75rem; padding-right: .75rem; }
    .app-navbar .navbar-brand { font-size: 1.05rem; margin-right: .6rem; flex: none; }
    .app-navbar .navbar-collapse {
        display: flex; flex: 1 1 100%; min-width: 0;
        flex-wrap: nowrap; align-items: center;
    }
    .app-navbar .navbar-nav {
        flex: 0 1 auto; min-width: 0;
        flex-direction: row; flex-wrap: nowrap; gap: .15rem;
        font-size: .95rem !important;
        overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    }
    .app-navbar .navbar-nav::-webkit-scrollbar { display: none; }  /* WebKit/微信内核 */
    .app-navbar .nav-link { white-space: nowrap; padding: .5rem .65rem; min-height: 44px; display: flex; align-items: center; }
    .app-navbar .navbar-nav .nav-item { flex: none; }
    .app-navbar .btn { white-space: nowrap; flex: none; }

    /* 页面容器收窄左右留白 */
    .container-fluid.px-4 { padding-left: .75rem !important; padding-right: .75rem !important; }

    /* 标题与操作按钮行：允许换行，按钮不被挤出屏幕 */
    .page-title { font-size: 1.2rem; }
    .container-fluid .d-flex.justify-content-between { flex-wrap: wrap; gap: .5rem; }

    /* 统计卡片：缩小内边距与字号，两列布局下不拥挤 */
    .stat-card { padding: .9rem .5rem; }
    .stat-card .num { font-size: 1.6rem; }
    .stat-card .label { font-size: .85rem; }

    /* 表格：横向滑动查看，避免列被挤压变形（卡片本身成为滚动容器） */
    .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .card .table { min-width: 680px; }

    /* 表单控件：保持 16px 防止 iOS 聚焦自动缩放；筛选行控件占满可用宽度 */
    .form-control, .form-select, .form-label, .btn { font-size: 16px; }
    .row.g-2 .col-auto { max-width: 100%; }
    .row.g-2 .col-auto .form-control, .row.g-2 .col-auto .form-select { width: 100%; }

    /* 点击区域：小按钮加大触摸目标（≥40px 高） */
    .btn-sm { padding: .45rem .8rem; min-height: 40px; }
    .btn-close { padding: .8rem; background-clip: content-box; }

    /* 房源树：行内边距收紧，操作组换行居中 */
    .tree-room { padding: .7rem .8rem; }
    .tree-community { padding-left: .6rem; }

    /* 弹窗：接近全屏宽度，超高时内部滚动，避免小屏溢出 */
    .modal-dialog { margin: .75rem auto; max-width: calc(100% - 1rem); }
    .modal-content { max-height: 88vh; overflow-y: auto; }

    /* 下拉菜单与提示条：加大点击项、缩小提示字号 */
    .dropdown-item { padding: .6rem 1rem; min-height: 44px; }
    .alert { font-size: .9rem; }
}
