/* Responsive Styles */
@media screen and (max-width: 1170px) {
    html {
        overflow-x: hidden;
    }

    body {
        overflow-x: hidden;
    }

    .wrap {
        width: 98%;
    }

    /* Header Responsive */
    .nav .logo {
        padding: 0 10px;
    }

    .nav .logo a {
        font-size: 14px;
    }
    
    .nav .menu ul li {
        font-size: 16px;
    }

    .nav .menu {
        left: 200px;
    }

    .nav .menu ul li a {
        padding: 0 15px;
        font-size: 14px;
    }

    .nav .b .b1 {
        font-size: 12px;
        padding: 0 8px;
    }

    /* Sub Navigation Bar Responsive */
    .sub-nav-bar .sub-nav-menu li a {
        padding: 12px 15px;
        font-size: 13px;
    }

    /* Search Responsive */
    .search {
        height: auto;
        padding: 0.5rem;
    }

    .search input {
        position: relative;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .search button {
        position: relative;
        width: 100%;
        margin-top: 0.5rem;
    }

    /* Table Responsive */
    .text_table {
        overflow-x: auto;
    }

    .text_table table {
        min-width: 800px;
    }

    .text_table table td {
        padding: 3%;
        word-break: break-all;
    }

    /* Form Responsive */
    .form-group label {
        display: block;
        width: 100%;
        text-align: left;
        margin-bottom: 0.5rem;
    }

    .form-group .form-control {
        width: 100%;
    }

    .form-row {
        flex-direction: column;
    }

    .form-row .form-group {
        margin-right: 0;
        margin-bottom: 1rem;
    }

    /* Footer Responsive */
    .footer {
        margin-top: 2%;
    }

    .footer .qrcode {
        display: none;
    }
}

/* Mobile Styles */
@media screen and (max-width: 768px) {
    /* Header Mobile */
    .header {
        height: auto;
        box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
        overflow: visible;
    }

    .nav {
        height: auto;
        padding: 15px 0;
        position: relative;
        overflow: visible;
    }

    .nav .logo {
        position: relative;
        float: left;
        width: auto;
        text-align: left;
        padding: 15px 0 15px 20px;
        height: auto;
        line-height: 1.5;
        margin-bottom: 0;
        margin-right: 0;
    }

    .nav .logo a {
        font-size: 14px;
    }
    
    /* 显示汉堡菜单按钮 */
    .mobile-menu-toggle {
        display: flex;
        right: 20px;
    }
    
    /* 移动端菜单默认隐藏 - 在文档流中显示 */
    .nav .menu {
        float: none;
        width: 100%;
        margin-left: 0;
        margin-top: 0;
        margin-bottom: 0;
        background: #2eb670;
        display: none;
        padding: 0;
        clear: both;
        overflow: visible;
        min-height: auto;
        max-height: none;
        height: 100%;
    }
    
    /* 菜单展开状态 */
    .nav .menu.menu-open {
        display: block;
    }
    
    /* 显示移动端用户信息 */
    .mobile-user-info {
        display: block;
        padding: 15px 20px;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        margin-top: 0;
    }
    
    .nav .menu ul {
        flex-direction: column;
        justify-content: flex-start;
        height: auto;
        padding: 0;
        margin: 0;
        width: 100%;
        display: block;
    }
    
    .nav .menu ul li {
        width: 100%;
        height: 50px;
        line-height: 50px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
        margin: 0;
        display: block;
    }
    
    .nav .menu ul li:last-child {
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .nav .menu ul li.current {
        background: rgba(255, 255, 255, 0.1);
        border-bottom: none;
    }
    
    .nav .menu ul li a {
        padding: 15px 20px;
        font-size: 16px;
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* 桌面端用户信息在移动端隐藏 */
    .nav .b {
        display: none;
    }

    /* Sub Navigation Bar Mobile */
    .sub-nav-bar {
        padding: 10px 0;
        margin-top: 10px;
    }
    
    .sub-nav-bar .wrap {
        padding: 0 4%;
    }

    .sub-nav-menu {
        flex-wrap: wrap;
        justify-content: flex-start;
        display: flex;
    }

    .sub-nav-bar .sub-nav-menu li {
        flex: 0 0 calc(50% - 10px);
        min-width: calc(50% - 10px);
        margin: 5px;
        box-sizing: border-box;
    }

    /* 当只有3个菜单项时：前2个各占50%，第3个换行后居左显示 */
    .sub-nav-bar .sub-nav-menu li:first-child:nth-last-child(3) ~ li:last-child {
        flex: 0 0 calc(50% - 10px);
        min-width: calc(50% - 10px);
        margin-left: 5px;
        margin-right: auto;
    }

    /* 当只有1个菜单项时，居中显示 */
    .sub-nav-bar .sub-nav-menu li:first-child:last-child {
        flex: 0 0 auto;
        min-width: auto;
        margin: 5px auto;
    }

    .sub-nav-bar .sub-nav-menu li a {
        margin: 0;
        padding: 10px 15px;
        font-size: 13px;
        text-align: center;
        width: 100%;
        box-sizing: border-box;
        white-space: nowrap;
    }

    /* Main Container Mobile */
    .main-container {
        padding: 15px 4%;
    }
    
    .text_table {
        border-radius: 8px;
        margin-bottom: 15px;
    }
    
    .text_table table {
        font-size: 12px;
    }
    
    .text_table table td {
        padding: 10px 12px;
    }
    
    /* Form Mobile Styles */
    /* 表单table的父容器不需要滚动条 */
    .text_table form {
        overflow-x: visible !important;
    }

    .text_table form table {
        min-width: auto !important;
        width: 98% !important;
    }

    .text_table form table td {
        display: block;
        width: 100% !important;
        padding: 12px !important;
        border: none !important;
        border-bottom: 1px solid #eee !important;
        text-align: left !important;
        white-space: normal !important;
    }
    
    .text_table form table td:last-child {
        border-bottom: none !important;
    }
    
    .text_table form table tr {
        display: block;
        margin-bottom: 0;
        border: none;
        border-bottom: 1px solid #eee;
        border-radius: 0;
    }
    
    .text_table form table td[id="t1"] {
        font-weight: bold;
        background: transparent;
        color: #333;
        padding-bottom: 5px !important;
    }
    
    /* 条件搜索table（包含select的筛选条件）在移动端每行一个，不使用滚动条 */
    .text_table.mb2 {
        overflow-x: visible !important;
    }
    
    .text_table.mb2 table {
        min-width: auto !important;
        width: 100% !important;
    }
    
    .text_table.mb2 table tr {
        display: block;
        width: 100%;
    }
    
    .text_table.mb2 table td {
        display: block;
        width: 100% !important;
        padding: 10px 0 !important;
        border: none !important;
        border-bottom: 1px solid #eee !important;
        text-align: left !important;
    }
    
    .text_table.mb2 table td:last-child {
        border-bottom: none !important;
    }
    
    .text_table.mb2 table td.bn {
        padding: 10px 0 !important;
    }
    
    .text_table.mb2 table td.rn {
        padding: 10px 0 !important;
    }
    
    .text_table.mb2 select.qt_drop_down {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
        font-size: 14px;
    }
    
    input[type="radio"] + label,
    input[type="checkbox"] + label {
        margin-right: 15px;
        margin-bottom: 8px;
        display: inline-block;
        font-size: 14px;
    }
    
    .inp_text, .inp_area, select {
        width: 100% !important;
        max-width: 100%;
        box-sizing: border-box;
        margin-top: 5px;
    }
    
    .btn-add {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }

    /* Search Mobile */
    .search {
        padding: 0.5rem 0;
        margin-left: 0;
        margin-right: 0;
    }

    .search input {
        width: 100%;
        margin-bottom: 0.5rem;
        box-sizing: border-box;
    }

    .search button {
        width: 100%;
        margin-top: 0;
        box-sizing: border-box;
        right: 0;
    }

    /* Table Mobile - 列表页table有滚动条 */
    .text_table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 我的合同列表：内容不换行，小屏幕时使用滚动条 */
    .person-contract-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .person-contract-table table {
        min-width: 800px;
        white-space: nowrap;
    }
    
    .person-contract-table table td {
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
    }

    /* 表单table的父容器不需要滚动条（通过更具体的选择器覆盖） */
    .text_table > form {
        overflow-x: visible !important;
    }

    /* 列表table样式（直接子元素是table） */
    .text_table > table {
        min-width: 600px;
        font-size: 12px;
    }

    /* 列表table td - 不换行，显示全部内容，通过滚动条查看 */
    .text_table > table td {
        padding: 10px 12px;
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
    }
    
    /* 确保最后一列有足够的右边距 */
    .text_table > table td:last-child {
        padding-right: 15px;
    }

    /* 表单table样式已在上面定义，确保不应用列表样式 */
    .text_table form table {
        min-width: auto !important;
    }

    /* 隐藏表单提示文字 */
    .form-label-hint {
        display: none;
    }

    /* Pages Mobile */
    .pages {
        text-align: center;
        padding: 10px 0;
    }

    .pages .home, .pages .prev, .pages .next, .pages .end {
        display: inline-block;
        min-width: 40px;
    }

    .pages a, .pages span {
        margin: 2px;
        font-size: 13px;
        min-width: 32px;
        height: 32px;
        line-height: 32px;
    }

    /* Footer Mobile */
    .footer {
        padding: 15px 10px;
    }

    .footer .copy {
        float: none;
        text-align: center;
        font-size: 12px;
    }

    /* Utility Mobile */
    .btn-add {
        padding: 0.6rem 1rem;
        width: 100%;
        text-align: center;
    }
}

/* Small Mobile Styles */
@media screen and (max-width: 480px) {
    .wrap {
        width: 100%;
        padding: 0 10px;
    }

    .nav .menu ul li a {
        font-size: 14px;
        padding: 0 10px;
    }

    .sub-nav-bar .sub-nav-menu li a {
        font-size: 12px;
        padding: 10px 15px;
    }

    .main-container {
        padding: 1%;
    }

    .text_table table {
        min-width: 500px;
        font-size: 11px;
    }
}

/* Modal Responsive */
@media screen and (max-width: 768px) {
    .modal-content {
        width: 95%;
        padding: 20px;
        margin: 10px;
    }

    .modal-header h3 {
        font-size: 16px;
    }

    .modal-form-group {
        margin-bottom: 15px;
    }

    .modal-footer {
        text-align: center;
    }

    .modal-footer button {
        width: 48%;
        margin: 5px 1%;
    }

    .btn-bind {
        width: 100%;
        margin-bottom: 15px;
    }

    .binding-section {
        margin-top: 20px;
    }

    .binding-section h3 {
        font-size: 14px;
    }

    .binding-table table {
        font-size: 12px;
    }

    .binding-table table td {
        padding: 8px;
    }
}

/* Category Tabs Responsive */
@media screen and (max-width: 768px) {
    .category-tabs {
        margin-bottom: 15px;
    }

    .category-tab {
        display: block;
        width: 100%;
        margin: 5px 0;
        border-radius: 5px;
        text-align: center;
    }
}

/* Form Input Responsive */
@media screen and (max-width: 768px) {
    .form-input-half,
    .form-input-full,
    .form-input-date,
    .select-width-300 {
        width: 100% !important;
    }

    .form-cell-content-45,
    .form-cell-content-250 {
        width: 100% !important;
    }

    .form-cell-padding-left {
        padding-left: 0 !important;
    }
}

/* Print Styles */
@media print {
    .header, .sub-nav-bar, .footer, .search, .pages {
        display: none;
    }

    .main-container {
        padding: 0;
    }

    .text_table {
        border: 1px solid #000;
    }

    .text_table table td {
        border: 1px solid #000;
    }

    .modal-overlay {
        display: none !important;
    }
}

