/* 移动端响应式适配样式 */

/* 侧边栏移动端适配 */
@media (max-width: 1024px) {
    /* 侧边栏在移动端使用fixed定位 */
    #sidebar-wrapper {
        position: fixed !important;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 40;
    }
    
    /* 顶部导航栏适配 */
    nav {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    /* 首页链接横排显示 */
    nav a {
        display: inline-block !important;
    }
}

/* 基础响应式调整 */
@media (max-width: 768px) {
    /* 标题字体大小调整 */
    h1 {
        font-size: 1.25rem !important;
    }
    
    h2 {
        font-size: 1rem !important;
    }
    
    h3 {
        font-size: 0.95rem !important;
    }
    
    h4 {
        font-size: 0.9rem !important;
    }
    
    /* 内边距调整 */
    .p-3, .p-4, .p-5, .p-6 {
        padding: 0.75rem !important;
    }
    
    .px-6 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    .py-6 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
    
    /* 表单输入框 */
    input[type="text"],
    input[type="tel"],
    input[type="email"],
    input[type="number"],
    input[type="datetime-local"],
    input,
    select,
    textarea {
        padding: 0.625rem 0.75rem !important;
        font-size: 0.875rem !important;
        min-height: 44px !important;
    }
    
    /* 按钮 */
    button {
        padding: 0.625rem 0.875rem !important;
        font-size: 0.875rem !important;
        min-height: 44px !important;
    }
    
    /* 搜索按钮特殊处理 */
    button[type="button"]:not(.w-full) {
        width: auto !important;
    }
    
    /* 网格布局改为单列 */
    .grid {
        grid-template-columns: 1fr !important;
    }
    
    /* 保持某些网格为2列 */
    .grid.grid-cols-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* 间距调整 */
    .gap-6 {
        gap: 0.75rem !important;
    }
    
    .gap-4 {
        gap: 0.75rem !important;
    }
    
    .gap-3 {
        gap: 0.5rem !important;
    }
    
    .gap-2 {
        gap: 0.5rem !important;
    }
    
    /* 文字大小 */
    .text-2xl {
        font-size: 1.25rem !important;
    }
    
    .text-xl {
        font-size: 1.125rem !important;
    }
    
    .text-lg {
        font-size: 1rem !important;
    }
    
    .text-base {
        font-size: 0.875rem !important;
    }
    
    .text-sm {
        font-size: 0.8125rem !important;
    }
    
    .text-xs {
        font-size: 0.75rem !important;
    }
    
    /* 卡片内边距 */
    section {
        padding: 0.75rem !important;
    }
    
    /* 审核列表项 */
    article {
        padding: 0.75rem !important;
    }
    
    /* 下拉建议列表 */
    .absolute.z-10,
    .absolute.z-50 {
        max-height: 12rem !important;
    }
    
    /* Flex 布局调整 */
    .flex.flex-col.sm\\:flex-row {
        flex-direction: column !important;
    }
    
    .flex.items-center.gap-4 {
        flex-wrap: wrap !important;
    }
    
    /* 选择框 */
    select {
        flex: 1 !important;
    }
    
    /* 文字换行 */
    .break-all {
        word-break: break-all !important;
        overflow-wrap: break-word !important;
    }
    
    /* 状态标签 */
    .rounded-full {
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }
    
    /* 审核操作区域 */
    .mt-3.grid {
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* 搜索框容器 */
    .relative.flex {
        flex-direction: row !important;
    }
    
    .relative.flex input {
        flex: 1 !important;
    }
    
    .relative.flex button {
        width: auto !important;
        flex-shrink: 0 !important;
    }
    
    /* 审核按钮组 */
    .flex.flex-col.sm\\:flex-row.gap-2 {
        flex-direction: column !important;
    }
    
    .flex.flex-col.sm\\:flex-row.gap-2 button,
    .flex.flex-col.sm\\:flex-row.gap-2 input {
        width: 100% !important;
    }
    
    /* 房源详情页适配 */
    .min-h-screen.bg-gradient-to-br {
        padding: 0.75rem !important;
    }
    
    /* 详情页顶部按钮组 */
    .flex.items-center.justify-between.gap-4 {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    .flex.items-center.justify-between.gap-4 > .flex.gap-3 {
        width: 100% !important;
        flex-wrap: wrap !important;
    }
    
    .flex.items-center.justify-between.gap-4 > .flex.gap-3 button {
        flex: 1 !important;
        min-width: 0 !important;
    }
    
    /* 详情页标题 */
    .flex.items-center.gap-4 h1 {
        font-size: 1.125rem !important;
        line-height: 1.4 !important;
    }
    
    /* 图片网格 */
    .grid.grid-cols-2.md\\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* 弹窗适配 */
    .sm\\:max-w-4xl,
    .sm\\:max-w-lg,
    .sm\\:max-w-md {
        max-width: calc(100vw - 1.5rem) !important;
        margin: 0.75rem !important;
    }
    
    /* 弹窗内容区域 */
    .max-h-\\[75vh\\] {
        max-height: 60vh !important;
    }
    
    /* 弹窗表单网格 */
    .grid.grid-cols-1.md\\:grid-cols-3,
    .grid.grid-cols-1.md\\:grid-cols-4 {
        grid-template-columns: 1fr !important;
    }
    
    .grid.grid-cols-2.md\\:grid-cols-4 {
        grid-template-columns: 1fr !important;
    }
    
    /* 弹窗中的col-span */
    .md\\:col-span-2,
    .md\\:col-span-3,
    .col-span-3 {
        grid-column: span 1 / span 1 !important;
    }
    
    /* 弹窗内所有表单项垂直布局 */
    .rounded-xl > .grid > div {
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* 表单标签优化 */
    .rounded-xl label.block {
        width: 100% !important;
        margin-bottom: 0.5rem !important;
        font-size: 0.8125rem !important;
        font-weight: 600 !important;
    }
    
    /* 表单输入框、选择框 */
    .rounded-xl input,
    .rounded-xl select,
    .rounded-xl textarea {
        width: 100% !important;
    }
    
    /* 图片上传区域优化 */
    .flex.gap-3.items-start {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    .flex.gap-3.items-start > .flex.flex-col {
        width: 100% !important;
    }
    
    /* 图片上传内部布局 */
    .flex.gap-3.items-start .flex.gap-3.items-center {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        gap: 0.75rem !important;
    }
    
    /* 图片预览 */
    .w-24.h-24 {
        width: 8rem !important;
        height: 8rem !important;
        margin: 0 auto !important;
    }
    
    /* 图片上传按钮容器 */
    .flex.gap-3.items-start .flex-1 {
        width: 100% !important;
    }
    
    /* 图片上传按钮 */
    .flex.gap-3.items-start label.inline-flex {
        width: 100% !important;
        justify-content: center !important;
    }
    
    /* 类型选择下拉框 */
    .flex.gap-3.items-start select {
        width: 100% !important;
    }
    
    /* 主图复选框区域 */
    .flex.gap-3.items-start .flex.flex-col.items-center {
        align-items: flex-start !important;
        padding-top: 0 !important;
    }
    
    /* 删除按钮区域 */
    .flex.gap-3.items-start > .flex.flex-col:last-child {
        flex-direction: row !important;
        justify-content: flex-end !important;
        padding-top: 0 !important;
    }
    
    /* 复选框组（产证齐全、学区房等）横向排列，四个平均分配 */
    .col-span-3.flex.gap-6 {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 0 !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    
    /* 复选框项平均分配，每个占25% */
    .col-span-3.flex.gap-6 label {
        width: 25% !important;
        flex: 0 0 25% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        padding: 0.5rem 0 !important;
        margin: 0 !important;
    }
    
    /* 复选框大小与文字一致 */
    .col-span-3.flex.gap-6 label input[type="checkbox"] {
        width: 0.875rem !important;
        height: 0.875rem !important;
        min-width: 0.875rem !important;
        min-height: 0.875rem !important;
        margin-right: 0.25rem !important;
        flex-shrink: 0 !important;
    }
    
    /* 复选框文字大小 */
    .col-span-3.flex.gap-6 label span {
        font-size: 0.875rem !important;
        white-space: nowrap !important;
        line-height: 0.875rem !important;
    }
    
    /* 钥匙在管复选框 - 复选框与文字大小一致 */
    .flex.items-end label.inline-flex {
        display: flex !important;
        align-items: center !important;
    }
    
    .flex.items-end label.inline-flex input[type="checkbox"] {
        width: 0.875rem !important;
        height: 0.875rem !important;
        min-width: 0.875rem !important;
        min-height: 0.875rem !important;
        margin-right: 0.25rem !important;
        flex-shrink: 0 !important;
    }
    
    .flex.items-end label.inline-flex span {
        font-size: 0.875rem !important;
        line-height: 0.875rem !important;
    }
    
    /* 图片主图复选框 - 复选框与文字大小一致 */
    .flex.gap-3.items-start .flex.flex-col.items-center label {
        display: flex !important;
        align-items: center !important;
    }
    
    .flex.gap-3.items-start .flex.flex-col.items-center input[type="checkbox"] {
        width: 0.875rem !important;
        height: 0.875rem !important;
        min-width: 0.875rem !important;
        min-height: 0.875rem !important;
        margin-right: 0.25rem !important;
        flex-shrink: 0 !important;
    }
    
    .flex.gap-3.items-start .flex.flex-col.items-center span {
        font-size: 0.875rem !important;
        line-height: 0.875rem !important;
    }
    
    /* 标签文字优化 */
    label.block {
        font-size: 0.8125rem !important;
    }
    
    /* 复选框标签 */
    label.inline-flex.items-center {
        font-size: 0.875rem !important;
    }
    
    /* 搜索框头部适配 */
    .flex.items-center.gap-2 {
        flex-wrap: wrap !important;
    }
    
    /* 更多操作按钮适配 */
    .inline-flex.items-center.gap-2 {
        font-size: 0.8125rem !important;
        padding: 0.5rem 0.75rem !important;
    }
    
    /* 返回按钮 */
    .inline-flex.items-center.gap-2.px-4 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

/* 超小屏幕优化 (小于 375px) */
@media (max-width: 375px) {
    h1 {
        font-size: 1.125rem !important;
    }
    
    .p-3 {
        padding: 0.5rem !important;
    }
    
    input, select, button, textarea {
        font-size: 0.8125rem !important;
    }
    
    /* 按钮文字更小 */
    .text-sm {
        font-size: 0.75rem !important;
    }
}

/* 平板适配 (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .grid.grid-cols-1.xl\\:grid-cols-2,
    .grid.grid-cols-1.lg\\:grid-cols-3 {
        grid-template-columns: 1fr !important;
    }
}

/* -------------------------------------------------------------------------- */
/* 管理端大弹窗：预编译 Tailwind v2 不含 max-h-[85vh] / h-[85vh] 等 arbitrary 工具类， */
/* 若仅用 class 不写真实 CSS，弹窗会撑满视口且无法出现内部滚动。 */
/* -------------------------------------------------------------------------- */
.pl-modal-sheet {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    height: 85vh;
    max-height: 85vh;
    height: min(85vh, 100dvh);
    max-height: min(85vh, 100dvh);
    overflow: hidden;
}

@media (min-width: 640px) {
    .pl-modal-sheet {
        width: 50vw;
        max-width: 50vw;
        height: auto;
        max-height: 90vh;
        max-height: min(90vh, 100dvh);
    }
}

.pl-modal-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.pl-modal-video {
    max-height: 75vh;
    max-height: min(75vh, 85dvh);
}

/* 导出房源弹窗：「工具栏 + 筛选/已选字段」限高并内部滚动，把 flex 剩余空间留给字段勾选区（PC 弹窗已限高 45vh 时尤其重要） */
.pl-export-modal .pl-export-scroll-top {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

@media (min-width: 640px) {
    .pl-export-modal .pl-export-scroll-top {
        max-height: 12.5rem;
    }
}

/* 导出弹窗：PC 端「选择字段」滚动区高度在原先约 54vh 基准上缩小三分之一（≈36vh），移动端不加此规则 */
@media (min-width: 640px) {
    .pl-export-modal .pl-export-fields-scroll {
        max-height: calc(54vh * 2 / 3);
        max-height: min(calc(54vh * 2 / 3), calc(100dvh * 0.36));
    }
}

/* 导出房源弹窗：移动端再拉高整体高度，并略收紧上半区内边距 */
@media (max-width: 639px) {
    .pl-modal-sheet.pl-export-modal {
        height: min(92vh, 100dvh);
        max-height: min(92vh, 100dvh);
    }

    .pl-export-modal .pl-export-scroll-top {
        max-height: min(34vh, 260px);
    }

    .pl-export-modal .pl-export-toolbar-block {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .pl-export-modal .pl-export-toolbar-block .mt-3 {
        margin-top: 0.5rem !important;
    }

    .pl-export-modal .pl-export-amber-block {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .pl-export-modal .pl-export-amber-block .mt-3 {
        margin-top: 0.5rem !important;
    }

    /* 导出字段勾选项：强制 checkbox 与文字同一行、并缩小 checkbox */
    .pl-export-modal .pl-export-field-item {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 0.5rem !important;
    }

    .pl-export-modal .pl-export-field-checkbox {
        width: 0.875rem !important;
        height: 0.875rem !important;
        min-width: 0.875rem !important;
        min-height: 0.875rem !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
    }
}
