/* 全局样式 */
.layui-layout-admin .layui-header {
    background: linear-gradient(90deg, #1e9fff 0%, #009688 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.layui-layout-admin .layui-logo {
    color: white;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.layui-layout-admin .layui-logo:hover {
    color: #f0f9ff;
    transform: scale(1.02);
}

.layui-layout-admin .layui-logo i {
    margin-right: 8px;
    font-size: 20px;
}

.layui-layout-admin .layui-body {
    background: #f2f2f2;
}

.layui-layout-admin .layui-footer {
    background: #393D49;
    color: #fff;
    text-align: center;
    line-height: 60px;
}

/* 卡片样式 */
.layui-card {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 15px;
    overflow: hidden;
}

.layui-card-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 15px;
}

.layui-card-header {
    background: linear-gradient(90deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #e6e6e6;
    border-radius: 8px 8px 0 0;
    font-weight: 500;
}

.layui-card-header i {
    margin-right: 8px;
    color: #1e9fff;
}

/* 表格样式 */
.layui-table {
    border-radius: 8px;
    overflow: hidden;
    width: 100% !important;
    table-layout: auto;
    max-width: 100%;
    box-sizing: border-box;
}

.layui-table-box {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.layui-table-view {
    max-width: 100%;
}

/* 表格容器响应式 */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    margin-bottom: 15px;
}

/* 确保表格不会超出容器 */
.layui-card-body table {
    max-width: 100%;
    min-width: auto;
    width: 100% !important;
}

/* 页面主体容器 */
.layui-body {
    overflow-x: hidden;
    max-width: 100vw;
}

.layui-fluid {
    max-width: 100%;
    box-sizing: border-box;
}

.layui-table thead tr {
    background: linear-gradient(90deg, #1e9fff 0%, #009688 100%);
    color: white;
}

.layui-table tbody tr:hover {
    background-color: #f0f9ff;
}

/* 按钮样式增强 */
.layui-btn {
    border-radius: 6px;
    transition: all 0.3s;
}

.layui-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.layui-btn-sm {
    height: 30px;
    line-height: 30px;
    padding: 0 10px;
    font-size: 12px;
}

/* 表单样式 */
.layui-form-item {
    margin-bottom: 20px;
}

.layui-input, .layui-textarea {
    border-radius: 6px;
    border: 1px solid #e6e6e6;
    transition: all 0.3s;
}

.layui-input:focus, .layui-textarea:focus {
    border-color: #1e9fff;
    box-shadow: 0 0 0 2px rgba(30, 159, 255, 0.1);
}

/* 导航菜单样式 */
.layui-nav-tree {
    background: #2c3e50;
}

.layui-nav-tree .layui-nav-item {
    border-bottom: 1px solid #34495e;
}

.layui-nav-tree .layui-nav-child {
    background: #34495e;
}

.layui-nav-tree .layui-nav-item a {
    color: #ecf0f1;
    transition: all 0.3s;
}

.layui-nav-tree .layui-nav-item a:hover {
    background: #3498db;
    color: white;
}

.layui-nav-tree .layui-nav-item.layui-this > a {
    background: #3498db;
    color: white;
}

/* 徽章样式 */
.layui-badge {
    border-radius: 12px;
    font-weight: normal;
}

/* 统计卡片 */
.stat-card {
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    color: white;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.stat-card h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 500;
}

.stat-card .stat-number {
    font-size: 32px;
    font-weight: bold;
    margin: 10px 0;
}

/* 响应式设计 */
@media (max-width: 999px) {
    /* 移动端菜单按钮显示 */
    .mobile-menu-btn {
        display: block !important;
    }
    
    /* 移动端布局调整 */
    .layui-layout-admin .layui-header {
        padding: 0 10px;
        height: 50px;
        line-height: 50px;
    }
    
    .layui-layout-admin .layui-logo {
        font-size: 12px;
        padding: 0 5px;
    }
    
    .layui-layout-admin .layui-logo i {
        font-size: 16px;
        margin-right: 5px;
    }
    
    .layui-layout-admin .layui-body {
        left: 0 !important;
        top: 50px !important;
    }
    
    .layui-layout-admin .layui-footer {
        left: 0 !important;
        display: none;
    }
    
    .layui-layout-admin .layui-side {
        display: none;
    }
    
    .layui-layout-admin.mobile-side .layui-side {
        display: block;
        position: fixed;
        left: 0;
        top: 50px;
        height: calc(100vh - 50px);
        z-index: 1000;
        width: 200px;
    }
    
    .layui-layout-admin.mobile-side .layui-body {
        display: none;
    }
    
    /* 卡片样式调整 */
    .layui-card {
        margin-bottom: 10px;
        margin: 0 5px 10px 5px;
    }
    
    .layui-card-header {
        padding: 10px;
        font-size: 14px;
    }
    
    .layui-card-body {
        padding: 10px;
    }
    
    /* 表格容器 - 移动端优化 */
    .layui-card-body {
        padding: 10px 5px;
        overflow-x: hidden;
        width: 100%;
        box-sizing: border-box;
        max-width: 100vw;
    }
    
    .layui-fluid {
        padding: 0 5px;
        max-width: 100vw;
        overflow-x: hidden;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* 响应式表格容器 - 移动端禁用横向滚动 */
    .table-responsive {
        overflow-x: visible;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* 表格响应式 - 移动端卡片布局 */
    .layui-table {
        font-size: 12px;
        border: none;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
        table-layout: auto;
        border-collapse: separate;
        border-spacing: 0;
        -webkit-transform: translateZ(0); /* 微信浏览器硬件加速 */
        transform: translateZ(0);
    }
    
    .layui-table th,
    .layui-table td {
        padding: 8px 5px;
        border: 1px solid #e6e6e6;
        font-size: 12px;
    }
    
    .layui-table thead {
        display: none;
    }
    
    .layui-table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #e6e6e6;
        border-radius: 8px;
        background: white;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        width: 100%;
        max-width: calc(100vw - 30px);
        box-sizing: border-box;
        overflow: hidden;
        -webkit-transform: translateZ(0); /* 微信浏览器硬件加速 */
        transform: translateZ(0);
        -webkit-backface-visibility: hidden; /* 防止闪屏 */
        backface-visibility: hidden;
    }
    
    .layui-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 10px;
        border-bottom: 1px solid #f0f0f0;
        position: relative;
        width: 100%;
        box-sizing: border-box;
        word-wrap: break-word;
        word-break: break-all;
    }
    
    .layui-table tbody td:last-child {
        border-bottom: none;
        align-items: center;
    }
    
    .layui-table tbody td:before {
        content: attr(data-title);
        font-weight: bold;
        color: #333;
        min-width: 70px;
        flex-shrink: 0;
        font-size: 11px;
        line-height: 1.4;
        padding-right: 8px;
    }
    
    /* 操作按钮特殊处理 */
    .layui-table tbody td.action-buttons:before {
        min-width: 50px;
    }
    
    .layui-table tbody td.action-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 3px;
        padding: 8px;
    }
    
    /* 工具栏响应式 */
    .toolbar {
        padding: 10px;
        margin: 0 5px 10px 5px;
        flex-direction: column;
        gap: 10px;
    }
    
    .toolbar .layui-btn {
        margin: 2px;
        font-size: 12px;
        height: 32px;
        line-height: 32px;
        padding: 0 8px;
    }
    
    .toolbar .layui-input {
        width: 100% !important;
        margin: 5px 0;
    }
    
    .toolbar .layui-inline {
        width: 100%;
        float: none !important;
    }
    
    /* 按钮响应式 */
    .layui-btn-container .layui-btn {
        margin: 3px;
    }
    
    .layui-btn-sm {
        height: 28px;
        line-height: 28px;
        padding: 0 8px;
        font-size: 11px;
        margin: 1px;
    }
    
    .layui-btn-xs {
        height: 24px;
        line-height: 24px;
        padding: 0 6px;
        font-size: 10px;
        margin: 1px;
    }
    
    /* 操作按钮区域 - 移动端优化 */
    .action-buttons {
        min-width: auto;
        white-space: normal;
        display: flex;
        flex-wrap: wrap;
        gap: 2px;
        justify-content: center;
        width: 100%;
        max-width: 100%;
    }
    
    .action-buttons .layui-btn {
        display: block;
        width: auto;
        margin: 0;
        flex: 1;
        min-width: 45px;
        max-width: 80px;
        text-align: center;
        font-size: 10px;
        height: 24px;
        line-height: 24px;
        padding: 0 4px;
        box-sizing: border-box;
        -webkit-tap-highlight-color: transparent; /* 微信浏览器去除点击高亮 */
        -webkit-user-select: none; /* 微信浏览器禁止选中 */
        user-select: none;
        -webkit-touch-callout: none; /* 微信浏览器禁止长按菜单 */
    }
    
    .action-buttons .layui-btn i {
        display: none; /* 移动端隐藏图标，节省空间 */
    }
    
    .action-buttons .layui-btn-xs {
        height: 22px;
        line-height: 22px;
        font-size: 9px;
        padding: 0 3px;
        min-width: 40px;
        max-width: 70px;
    }
    
    /* 状态标签 */
    .status-tag,
    .priority-tag {
        font-size: 10px;
        padding: 1px 6px;
    }
    
    .layui-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    /* 输入框响应式 */
    .layui-input,
    .layui-textarea {
        font-size: 14px;
    }
    
    .layui-form-label {
        width: 80px;
        font-size: 12px;
        padding: 9px 5px;
    }
    
    .layui-input-block {
        margin-left: 90px;
    }
    
    /* 导航菜单移动端优化 */
    .layui-nav-tree .layui-nav-item a {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .layui-nav-tree .layui-nav-child dd a {
        padding: 8px 25px;
        font-size: 12px;
    }
    
    /* 面包屑 */
    .breadcrumb {
        padding: 8px 10px;
        font-size: 12px;
        margin: 0 5px 10px 5px;
    }
    
    /* 统计卡片 */
    .stat-card {
        padding: 15px;
        margin: 0 5px 10px 5px;
    }
    
    .stat-card .stat-number {
        font-size: 24px;
    }
    
    .stat-card h3 {
        font-size: 14px;
    }
    
    /* 滚动条设置 */
    .layui-fluid {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
        /* 移动端滚动条美化 - 微信浏览器优化 */
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
        background: transparent;
    }
    
    ::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }
    
    ::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 3px;
        border: none;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        background: #a1a1a1;
    }
    
    /* 微信浏览器特殊处理 */
    body {
        -webkit-overflow-scrolling: touch;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
        -webkit-font-smoothing: antialiased;
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        -moz-text-size-adjust: 100%;
    }
    
    /* 微信浏览器滚动容器优化 */
    .layui-body, .layui-fluid, .layui-card-body {
        -webkit-overflow-scrolling: touch;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-perspective: 1000;
        perspective: 1000;
    }
    
    /* 微信浏览器表单元素优化 */
    .layui-input, .layui-textarea, .layui-select {
        appearance: none;
        -webkit-appearance: none;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        -webkit-user-select: text;
        user-select: text;
        border-radius: 0; /* 避免iOS圆角 */
    }
    
    /* 微信浏览器链接优化 */
    a {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        text-decoration: none;
        outline: none;
    }
    
    /* 微信浏览器按钮优化 */
    .layui-btn, button {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
        outline: none;
    }
    
    /* 微信浏览器防止点击穿透 */
    .layui-layer-shade {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }
    
    /* 微信浏览器点击高亮去除 */
    * {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }
    
    /* 微信浏览器滚动优化 */
    .layui-fluid {
        -webkit-overflow-scrolling: touch;
    }
    
    .layui-card-body {
        -webkit-overflow-scrolling: touch;
    }
    
    /* 弹层响应式 */
    .layui-layer {
        width: 95% !important;
        margin: 0 auto !important;
    }
    
    /* 分页响应式 */
    .layui-laypage {
        text-align: center;
    }
    
    .layui-laypage a,
    .layui-laypage span {
        margin: 2px;
        font-size: 12px;
    }
}

/* 问题分类标签 */
.category-tag {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    color: white;
    font-weight: normal;
}

.category-tag.category-infrastructure {
    background: #1e40af;
}

.category-tag.category-environment {
    background: #10b981;
}

.category-tag.category-safety {
    background: #ef4444;
}

.category-tag.category-service {
    background: #f59e0b;
}

.category-tag.category-community {
    background: #8b5cf6;
}

.category-tag.category-other {
    background: #6b7280;
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .layui-card-header {
        font-size: 13px;
    }
    
    .layui-table tbody td {
        padding: 8px;
        font-size: 11px;
    }
    
    .layui-table tbody td:before {
        font-size: 11px;
        min-width: 70px;
    }
    
    .action-buttons .layui-btn {
        font-size: 9px;
        height: 24px;
        line-height: 24px;
        padding: 0 4px;
    }
    
    .layui-btn-sm {
        height: 26px;
        line-height: 26px;
        padding: 0 6px;
        font-size: 11px;
    }
}

/* 极小屏幕优化 */
@media (max-width: 360px) {
    .layui-fluid {
        padding: 0 2px;
    }
    
    .layui-card {
        margin: 0 2px 10px 2px;
    }
    
    .layui-card-body {
        padding: 8px 3px;
    }
    
    .layui-table tbody tr {
        max-width: calc(100vw - 14px);
        margin-bottom: 12px;
    }
    
    .layui-table tbody td {
        padding: 6px 4px;
        font-size: 10px;
    }
    
    .layui-table tbody td:before {
        min-width: 55px;
        font-size: 9px;
        padding-right: 6px;
    }
    
    .action-buttons {
        gap: 1px;
        padding: 6px;
    }
    
    .action-buttons .layui-btn {
        font-size: 8px;
        height: 20px;
        line-height: 20px;
        padding: 0 2px;
        min-width: 30px;
        max-width: 50px;
    }
    
    .action-buttons .layui-btn-xs {
        height: 18px;
        line-height: 18px;
        font-size: 7px;
        padding: 0 1px;
        min-width: 25px;
        max-width: 45px;
    }
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 20px;
    color: #999;
}

.loading i {
    font-size: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 空数据样式 */
.empty-data {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-data i {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 15px;
    display: block;
}

/* 工具栏样式 */
.toolbar {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toolbar .layui-btn {
    margin-right: 10px;
}

.toolbar .layui-input {
    width: 200px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 10px;
}

/* 分页样式 */
.layui-laypage {
    margin-top: 20px;
    text-align: center;
}

/* 面包屑导航 */
.breadcrumb {
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.breadcrumb a {
    color: #666;
    text-decoration: none;
}

.breadcrumb a:hover {
    color: #1e9fff;
}

.breadcrumb .layui-breadcrumb {
    visibility: visible;
}

/* 状态标签 */
.status-tag {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    color: white;
}

.status-tag.status-pending {
    background: #ff9800;
}

.status-tag.status-processing {
    background: #2196f3;
}

.status-tag.status-completed {
    background: #4caf50;
}

.status-tag.status-cancelled {
    background: #f44336;
}

.status-tag.status-invalid {
    background: #9e9e9e;
}

/* 优先级标签 */
.priority-tag {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    color: white;
}

.priority-tag.priority-low {
    background: #4caf50;
}

.priority-tag.priority-medium {
    background: #ff9800;
}

.priority-tag.priority-high {
    background: #f44336;
}

.priority-tag.priority-urgent {
    background: #9c27b0;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* 费用管理操作按钮样式 */
.action-buttons {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.action-buttons .layui-btn {
    min-width: 28px;
    padding: 0 6px;
    font-size: 10px;
    margin: 0;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.action-buttons .layui-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* 新增按钮颜色 */
.layui-btn-green {
    background-color: #5FB878;
    border-color: #5FB878;
}

.layui-btn-green:hover {
    background-color: #4CAF50;
    border-color: #4CAF50;
}

/* 微信浏览器检测和特殊处理 */

/* 微信浏览器通过CSS检测 - 使用特定特征 */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    /* 微信浏览器X5内核优化 */
    .layui-table {
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }
    
    .layui-btn {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        user-select: none;
        -webkit-user-select: none;
    }
    
    .layui-input, .layui-textarea {
        appearance: none;
        -webkit-appearance: none;
        user-select: text;
        -webkit-user-select: text;
    }
}

/* 桌面端表格优化 */
@media (min-width: 769px) {
    .layui-table {
        width: 100% !important;
        table-layout: fixed;
    }
    
    .layui-table th,
    .layui-table td {
        word-wrap: break-word;
        word-break: break-all;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 200px;
    }
    
    /* 为不同的列设置最小宽度 */
    .layui-table th:nth-child(1), /* 期数 */
    .layui-table td:nth-child(1) {
        width: 60px;
        min-width: 60px;
    }
    
    .layui-table th:nth-child(2), /* 房号信息 */
    .layui-table td:nth-child(2) {
        width: 120px;
        min-width: 100px;
    }
    
    .layui-table th:nth-child(3), /* 姓名 */
    .layui-table td:nth-child(3) {
        width: 80px;
        min-width: 70px;
    }
    
    .layui-table th:nth-child(4), /* 电话 */
    .layui-table td:nth-child(4) {
        width: 120px;
        min-width: 110px;
    }
    
    .layui-table th:nth-child(5), /* 状态 */
    .layui-table td:nth-child(5) {
        width: 80px;
        min-width: 70px;
    }
    
    .layui-table th:nth-child(6), /* 关联业主 */
    .layui-table td:nth-child(6) {
        width: 100px;
        min-width: 80px;
    }
    
    .layui-table th:nth-child(7), /* 指定志愿者 */
    .layui-table td:nth-child(7) {
        width: 100px;
        min-width: 80px;
    }
    
    .layui-table th:nth-child(8), /* 上次回访 */
    .layui-table td:nth-child(8) {
        width: 120px;
        min-width: 100px;
    }
    
    .layui-table th:nth-child(9), /* 回访描述 */
    .layui-table td:nth-child(9) {
        width: 200px;
        min-width: 150px;
        max-width: 250px;
    }
    
    .layui-table th:nth-child(10), /* 操作 */
    .layui-table td:nth-child(10) {
        width: 200px;
        min-width: 180px;
        max-width: 250px;
    }
    
    /* 操作按钮列不截断 */
    .layui-table th:last-child,
    .layui-table td:last-child {
        white-space: normal;
        word-wrap: normal;
        overflow: visible;
    }
    
    /* 回访描述列允许换行 */
    .layui-table th:nth-child(9),
    .layui-table td:nth-child(9) {
        white-space: normal;
        word-wrap: break-word;
        word-break: break-all;
        line-height: 1.4;
        max-height: 60px;
        overflow: hidden;
        display: -webkit-box;
        line-clamp: 3;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
    }
}

