/**
 * 移动端优化样式
 * 针对手机和平板设备优化用户体验
 * 侧边栏模式
 */

/* ========================================
   侧边栏切换按钮（移动端显示）- 优化样式
   ======================================== */
.sidebar-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
}

/* 桌面端隐藏侧边栏切换按钮 */
@media (min-width: 769px) {
    .sidebar-toggle {
        display: none !important;
    }
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-toggle:active {
    background: rgba(255, 255, 255, 0.22);
}

.sidebar-toggle i.fa {
    font-size: 20px;
    line-height: 1;
}

.sidebar-toggle.active {
    background: rgba(255, 77, 79, 0.85);
}

/* ========================================
   侧边栏覆盖层
   ======================================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ========================================
   侧边栏主体
   ======================================== */
.sidebar {
    display: none;
    position: fixed;
    top: 60px;
    left: -260px;
    width: 180px;
    height: calc(100% - 60px);
    background: linear-gradient(180deg, #1a1d21 0%, #252a30 100%);
    z-index: 999;
    overflow-y: auto;
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    left: 0;
}

/* 侧边栏自定义滚动条 */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ========================================
   侧边栏头部
   ======================================== */
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.sidebar-header h3 {
    color: white;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(135deg, #00d4ff, #0099cc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ========================================
   侧边栏用户信息
   ======================================== */
.sidebar-user {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.sidebar-user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00d4ff, #0099cc);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-user-name {
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   侧边栏导航
   ======================================== */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu > li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 15px;
    transition: all 0.2s ease;
    position: relative;
    gap: 12px;
}

.sidebar-link:hover {
    background: rgba(0, 123, 255, 0.15);
    color: #00d4ff;
}

.sidebar-link.active {
    background: rgba(0, 123, 255, 0.15);
    color: #00d4ff;
    border-left: 3px solid #00d4ff;
}

.sidebar-icon {
    width: 22px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-text {
    flex: 1;
}

.sidebar-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
    color: rgba(255, 255, 255, 0.4);
}

.sidebar-has-submenu.open > .sidebar-link > .sidebar-arrow {
    transform: rotate(90deg);
}

/* ========================================
   侧边栏子菜单
   ======================================== */
.sidebar-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: rgba(0, 0, 0, 0.2);
    display: none;
}

.sidebar-has-submenu.open > .sidebar-submenu {
    display: block;
}

.sidebar-submenu li a {
    display: block;
    padding: 14px 20px 14px 54px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    min-height: 48px;
    box-sizing: border-box;
}

.sidebar-submenu li a:hover {
    background: rgba(0, 123, 255, 0.1);
    color: #00d4ff;
}

.sidebar-submenu li a.active {
    color: #00d4ff;
    background: rgba(0, 123, 255, 0.1);
    border-left: 3px solid #00d4ff;
}

/* 三级菜单（子分类）额外缩进，与二级区分层级 */
.sidebar-submenu-l3 li a {
    padding-left: 74px;
}

/* ========================================
   侧边栏底部
   ======================================== */
.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 107, 107, 0.9);
    text-decoration: none;
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.sidebar-logout:hover {
    background: rgba(255, 107, 107, 0.15);
    border-color: rgba(255, 107, 107, 0.5);
}

.sidebar-login {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(77, 171, 247, 0.95);
    text-decoration: none;
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    border: 1px solid rgba(77, 171, 247, 0.4);
}

.sidebar-login:hover {
    background: rgba(77, 171, 247, 0.15);
    border-color: rgba(77, 171, 247, 0.6);
}

/* ========================================
   移动端表单优化
   ======================================== */

@media (max-width: 992px) {
    /* 显示侧边栏切换按钮并居左显示 */
    .sidebar-toggle {
        display: flex !important;
        order: 1 !important;
        margin-right: 15px !important;
    }
    
    /* 调整header布局，使其包含侧边栏切换按钮 */
    /* 固定移动端顶部导航：滚动时常驻，避免被内容遮挡 */
    .header {
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        align-items: center !important;
        padding: 0px !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1001 !important;
    }

/* 固定头部后内容下移，避免被 60px 高头部遮挡（移动端 duty-bar 已隐藏） */
/* 注意：首页使用 .top-bar/.main-nav（非固定 .header），无需此偏移，故 .home-main-container 不在此列 */
.main-container {
    padding-top: 60px !important;
}
    
    .header-left {
        order: 2 !important;
        flex: 1 !important;
        text-align: left !important;
        margin-bottom: 0 !important;
        padding-left: 10px !important;
    }
    
    .header-left h1 {
        font-size: 16px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        text-align: left !important;
    }
    
    .header-nav {
        display: none !important;
    }
    
    .header-right {
        display: none !important;
    }

    /* 侧边栏默认隐藏，active时才显示 */
    .sidebar {
        display: flex !important;
        left: -260px;
    }
    
    .sidebar.active {
        left: 0;
    }

    /* 隐藏桌面端用户信息，显示侧边栏用户信息 */
    .header-right .user-name,
    .header-right .logout-btn {
        display: none !important;
    }

    /* 表单组优化 */
    .form-group {
        margin-bottom: 15px;
    }

    .form-group label {
        font-size: 14px;
        margin-bottom: 6px;
    }

    /* 移动端复选框优化 */
    input[type="checkbox"],
    input[type="radio"] {
        width: 22px !important;
        height: 22px !important;
        min-width: 22px !important;
        min-height: 22px !important;
        max-width: 22px !important;
        max-height: 22px !important;
        margin: 0 8px 0 0 !important;
        vertical-align: middle !important;
    }

    /* 表格中的复选框居中 */
    table input[type="checkbox"] {
        width: 20px !important;
        height: 20px !important;
        min-width: 20px !important;
        min-height: 20px !important;
        max-width: 20px !important;
        max-height: 20px !important;
    }

    /* 复选框标签对齐 */
    .checkbox-label,
    .radio-label,
    label:has(input[type="checkbox"]),
    label:has(input[type="radio"]) {
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
        font-size: 14px !important;
    }

    /* form-horizontal 表单按钮：同一行显示 */
    .form-horizontal > .btn,
    .form-horizontal > button[type="submit"],
    .form-horizontal > a.btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 1 1 0% !important;
        min-width: 0 !important;
        padding: 10px 12px !important;
        font-size: 14px !important;
        white-space: nowrap !important;
        width: auto !important;
        box-sizing: border-box !important;
    }

    .form-horizontal {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .form-horizontal .form-group {
        flex: 1 1 100% !important;
        margin-bottom: 8px !important;
    }

    /* 日期类型选择优化 */
    .form-group div[style*="display: flex"] {
        flex-direction: column;
        gap: 10px;
    }

    .form-group div[style*="display: flex"] label {
        padding: 10px;
        border: 1px solid #d9d9d9;
        border-radius: 4px;
        background: white;
    }

    .form-group div[style*="display: flex"] label:has(input:checked) {
        background: #e6f7ff;
        border-color: #1890ff;
        color: #1890ff;
    }

    /* 加班时间区域优化 */
    .overtime-section {
        padding: 15px;
        margin: 10px 0;
    }

    .overtime-section h3 {
        font-size: 16px;
    }

    /* 员工选择器优化 */
    .members-selector {
        border-radius: 8px;
    }

    .members-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .members-header .col-btn {
        width: 100%;
        text-align: center;
    }

    .members-list {
        max-height: 300px;
    }

    .member-item {
        padding: 10px;
        font-size: 14px;
    }
}

/* ========================================
   移动端表格优化
   ======================================== */

@media (max-width: 992px) {
    /* 表格卡片视图 */
    .table-responsive-card {
        display: block;
    }

    .table-responsive-card thead {
        display: none;
    }

    .table-responsive-card tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    .table-responsive-card tbody td {
        display: block;
        text-align: left;
        padding: 10px 15px;
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 40%;
    }

    .table-responsive-card tbody td:before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        width: 35%;
        font-weight: 600;
        color: #495057;
    }

    .table-responsive-card tbody td:last-child {
        border-bottom: none;
    }

    /* 操作按钮优化 */
    .table-responsive-card tbody td .btn-sm {
        padding: 8px 12px;
        font-size: 12px;
        margin: 2px;
    }
}

/* ========================================
   移动端模态框优化
   ======================================== */

@media (max-width: 992px) {
    .modal {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        overflow-y: auto;
    }

    .modal-content {
        margin: 10px;
        border-radius: 8px;
    }

    .modal-header {
        padding: 15px;
    }

    .modal-body {
        padding: 15px;
    }

    .modal-footer {
        padding: 15px;
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
        margin: 5px 0;
    }
}

/* ========================================
   移动端加载状态优化
   ======================================== */

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 123, 255, 0.3);
    border-radius: 50%;
    border-top-color: #007bff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 加载遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay .loading-content {
    text-align: center;
}

.loading-overlay .loading-text {
    margin-top: 15px;
    font-size: 16px;
    color: #333;
}

/* ========================================
   移动端提示信息优化
   ======================================== */

@media (max-width: 992px) {
    .alert {
        padding: 12px 15px;
        font-size: 14px;
        border-radius: 6px;
        margin-bottom: 15px;
    }

    .alert-dismissible {
        padding-right: 40px;
    }

    .alert-dismissible .close {
        position: absolute;
        top: 10px;
        right: 10px;
        padding: 5px;
        font-size: 18px;
    }
}

/* ========================================
   移动端分页优化
   ======================================== */

@media (max-width: 992px) {
    .pagination {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
    }

    .pagination li {
        display: inline-block;
    }

    .pagination li a {
        padding: 8px 12px;
        min-width: 40px;
        text-align: center;
        border-radius: 4px;
    }
}

/* ========================================
   移动端滚动条优化
   ======================================== */

@media (max-width: 992px) {
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }

    ::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    ::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 2px;
    }
}

/* ========================================
   移动端字体优化
   ======================================== */

@media (max-width: 992px) {
    body {
        font-size: 14px;
        line-height: 1.5;
    }

    p {
        margin-bottom: 10px;
    }

    small {
        font-size: 12px;
    }
}

/* ========================================
   移动端打印优化
   ======================================== */

@media print and (max-width: 992px) {
    .table-responsive-card tbody td {
        padding: 8px 10px;
        padding-left: 35%;
        font-size: 12px;
    }

    .table-responsive-card tbody td:before {
        width: 30%;
        font-size: 12px;
    }
}

/* ========================================
   移动端暗色模式支持
   ======================================== */

@media (prefers-color-scheme: dark) {
    /* 如果用户系统启用了暗色模式，可以在这里添加暗色主题样式 */
}

/* ========================================
   移动端无障碍优化
   ======================================== */

/* 焦点样式优化 */
@media (max-width: 992px) {
    :focus {
        outline: 2px solid #007bff;
        outline-offset: 2px;
    }

    /* 跳过导航链接 */
    .skip-nav {
        position: absolute;
        top: -40px;
        left: 10px;
        background: #007bff;
        color: white;
        padding: 8px 16px;
        text-decoration: none;
        border-radius: 4px;
        z-index: 10000;
    }

    .skip-nav:focus {
        top: 10px;
    }
}

/* ========================================
   移动端性能优化
   ======================================== */

/* 启用GPU加速 */
@media (max-width: 992px) {
    .btn,
    .header-nav ul li a,
    .table tbody tr {
        transform: translateZ(0);
        will-change: transform;
    }
}

/* ========================================
   移动端列表页面操作按钮和筛选表单优化
   ======================================== */

@media (max-width: 992px) {
    /* 顶部操作栏优化 - 垂直堆叠 */
    .top-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
        margin-bottom: 5px !important;
        flex-wrap: nowrap !important;
    }
    
    /* 标题和操作按钮容器 */
    .title-with-actions {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        flex: none !important;
        width: 100% !important;
    }
    
    .title-with-actions h2 {
        font-size: 18px !important;
        margin: 0 !important;
    }
    
    /* 操作按钮组 - 自动换行平分宽度 */
    .actions-bar {
        display: grid !important;
        gap: 8px !important;
        flex-wrap: wrap !important;
        overflow-x: hidden !important;
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 移动端：确保按年查看按钮包装器在grid布局中正确显示 */
    .actions-bar > div[id*="yearViewBtnWrapper"] {
        grid-column: span 1;
    }
    
    .actions-bar > div[id*="yearViewBtnWrapper"][style*="display: inline-block"] {
        display: flex !important;
    }
    
    .actions-bar > div[id*="yearViewBtnWrapper"] .btn {
        flex: 1 !important;
        width: 100% !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .actions-bar .btn {
        flex: 1 1 0% !important;
        flex-shrink: 1 !important;
        min-width: 0 !important;
        padding: 8px 15px !important;
        font-size: 13px !important;
        white-space: nowrap !important;
        border-radius: 4px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    /* 筛选表单 - 自适应换行显示 */
    .search-form,
    .search-form * {
        box-sizing: border-box !important;
    }

    .search-form {
        display: flex !important;
        flex-direction: row !important;
        gap: 6px !important;
        align-items: center !important;
        flex-wrap: wrap !important;
        overflow-x: hidden !important;
        justify-content: flex-start !important;
        width: 100% !important;
    }

    /* 隐藏的input不参与flex布局 */
    .search-form input[type="hidden"] {
        display: none !important;
        flex: none !important;
    }

    /* 日期输入：两个平分一行 */
    .search-form input[type="date"],
    .filter-form input[type="date"] {
        flex: 1 1 calc(50% - 3px) !important;
        min-width: 0 !important;
        max-width: none !important;
        padding: 7px 8px !important;
        font-size: 13px !important;
        border: 1px solid #ddd !important;
        border-radius: 4px !important;
        display: block !important;
        box-sizing: border-box !important;
    }

    /* 普通文本输入和下拉：自适应宽度 */
    .search-form input[type="text"],
    .search-form select {
        flex: 1 1 0% !important;
        min-width: 60px !important;
        max-width: none !important;
        padding: 7px 8px !important;
        font-size: 13px !important;
        border: 1px solid #ddd !important;
        border-radius: 4px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        display: block !important;
    }

    .search-form button,
    .search-form button[type="submit"],
    .search-form .btn,
    .search-form a.btn {
        flex: 1 1 0% !important;
        padding: 8px 12px !important;
        font-size: 13px !important;
        white-space: nowrap !important;
        border-radius: 4px !important;
        cursor: pointer !important;
        font-weight: 500 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: auto !important;
        text-decoration: none !important;
        min-width: 60px !important;
    }

    .search-form button[type="submit"],
    .search-form button:not(.btn-secondary) {
        background: #007bff !important;
        color: white !important;
        border: none !important;
    }

    .search-form .btn-secondary,
    .search-form a.btn-secondary {
        background: #6c757d !important;
        color: white !important;
        border: none !important;
    }

    .search-form button:hover {
        background: #0056b3 !important;
    }

    /* 筛选表单 filter-form（考勤、工资等页面）- 与桌面端保持视觉一致 */
    .filter-section {
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        border: 1px solid #dee2e6;
    }
    
    .filter-form {
        display: grid !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        align-items: center !important;
        grid-template-columns: repeat(2, 1fr);
    }
    .container > :first-child {
        grid-column: span 2;
    }   
    .filter-form input[type="hidden"] {
        display: none !important;
    }
    
    .filter-form input[type="text"],
    .filter-form input[type="month"],
    .filter-form select {
        padding: 7px 8px !important;
        font-size: 13px !important;
        border: 1px solid #ddd !important;
        border-radius: 4px !important;
        height: 44px !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
    }
    
    .filter-form .btn,
    .filter-form button {
        flex-shrink: 0 !important;
        padding: 7px 50px !important;
        font-size: 13px !important;
        white-space: nowrap !important;
    }
    
    /* 月份导航在移动端独占一行 */
    .filter-form .month-nav-inline {
        flex-basis: 100% !important;
        display: flex !important;
        gap: 5px !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 5px 0 !important;
        order: 99 !important;
    }
    
    /* 员工下拉选择器在移动端自适应 */
    .filter-form .emp-dropdown {
        min-width: 120px !important;
        flex: 1 1 auto !important;
    }
    
    /* 员工选择器面板在移动端：使用固定定位，由 JavaScript 动态计算位置 */
    .emp-dropdown-panel {
        width: 254px !important;
        max-width: 90vw !important;
        max-height: 60vh !important;
        z-index: 99999 !important;
    }
    
    .emp-dropdown-list {
        max-height: 50vh !important;
    }
    
    /* 表格移动端优化 */
    .table {
        font-size: 13px !important;
    }
    
    .table th,
    .table td {
        padding: 8px 5px !important;
    }
    
    /* 操作列在移动端显示为垂直按钮组 */
    .table td:last-child {
        display: flex !important;
        flex-direction: column !important;
        gap: 5px !important;
    }
    
    .table td:last-child a {
        display: block !important;
        padding: 8px !important;
        text-align: center !important;
        background: linear-gradient(135deg, #dc3545 0%, #c82333 100%)
        border-radius: 4px !important;
        text-decoration: none !important;
        font-size: 13px !important;
        transition: all 0.2s ease !important;
    }
    
    .table td:last-child a:hover {
        background: #e9ecef !important;
    }
    
    .table td:last-child a:first-child {
        background: #007bff !important;
        color: white !important;
    }
    
    .table td:last-child a:first-child:hover {
        background: #0056b3 !important;
    }
}

/* ========================================
   移动端表单组优化（补充）
   ======================================== */

@media (max-width: 992px) {
    /* 筛选表单项优化 */
    .filter-item {
        width: 100%;
    }
    
    .filter-item label {
        display: block;
        margin-bottom: 5px;
        font-size: 13px;
    }
    
    .filter-item .form-control,
    .filter-item input,
    .filter-item select {
        width: 100%;
        padding: 10px;
        font-size: 14px;
    }
    
    /* 月份选择器在移动端显示 - 第一行 */
    .month-picker-wrapper {
        display: flex !important;
        flex-wrap: nowrap !important; /* 不允许换行，确保在一行显示 */
        gap: 3px !important; /* 减小间距 */
        align-items: center;
        justify-content: center;
        margin: 10px 0;
        width: 100%;
        overflow-x: auto; /* 如果屏幕太小，允许横向滚动 */
        grid-column: 1 !important;
    }
    
    /* 调整月份选择器内的按钮大小 */
    .month-picker-wrapper .btn-outline {
        padding: 4px 8px !important; /* 减小按钮内边距 */
        font-size: 12px !important; /* 减小字体大小 */
        white-space: nowrap; /* 防止文字换行 */
    }
    
    /* 调整月份输入框大小 */
    .month-picker-wrapper .month-input {
        width: 130px !important; /* 设置固定宽度 */
        padding: 4px 6px !important; /* 减小内边距 */
        font-size: 12px !important; /* 减小字体大小 */
    }
    
    /* 移动端考勤页面筛选表单布局调整 - 垂直单列布局 */
    .filter-form {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        justify-items: center;
    }
    
    /* 搜索和重置按钮容器 - 第二行 */
    .filter-buttons-wrapper {
        display: flex !important;
        gap: 10px !important;
        justify-content: center !important;
        width: 100%;
        grid-column: 1 !important;
    }
    
    .filter-buttons-wrapper .btn,
    .filter-buttons-wrapper button {
        flex: 1 !important;
    }
    
    /* 月份导航按钮优化 */
    .month-nav-inline {
        gap: 5px;
        padding: 8px;
    }
    
    .month-nav-inline .btn-outline {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .current-month-text {
        font-size: 13px;
    }
    
    /* form-row 移动端改为单列垂直布局 */
    .form-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .form-row .form-group {
        flex: 1 1 auto !important;
        width: 100% !important;
        margin-bottom: 0 !important;
    }
    
    /* 帮助文字在移动端优化 */
    .help-text {
        display: block !important;
        margin-top: 4px !important;
        font-size: 11px !important;
        color: #999 !important;
    }
    
    /* form-actions 按钮在移动端优化 */
    .form-actions {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    .form-actions .btn {
        flex: 1 1 0% !important;
        min-width: 80px !important;
        text-align: center !important;
    }
    
    /* 移动端隐藏带.mobile-hide类的元素（如月份中的"月"字） */
    .mobile-hide {
        display: none !important;
    }
    
    /* 考勤统计页面：移动端显示员工选择器，隐藏桌面端员工选择器 */
    .desktop-employee-selector {
        display: none !important;
    }
    
    .mobile-employee-selector {
        display: inline-block !important;
        margin-left: 8px;
    }
    
    /* 移动端员工选择器宽度调整 */
    .mobile-employee-selector .emp-dropdown {
        width: 140px !important;
        min-width: 160px !important;
        min-height: 44px !important;
    }
    
    /* 移动端隐藏列数切换器 */
    .column-toggle {
        display: none !important;
    }
    
    /* ========================================
       车牌查询页面移动端优化
       ======================================== */
    
    /* 车牌查询页面：移动端筛选表单使用flex布局，覆盖内联样式 */
    .search-bar form {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        align-items: center !important;
    }
    
    /* 车牌查询页面：搜索输入框在移动端占满宽度 */
    .search-bar .search-input-wrapper {
        flex: 1 1 100% !important;
        min-width: 0 !important;
    }
    
    /* 车牌查询页面：班组和岗位在同一行，左右分布 */
    .search-bar form select[name="team_id"],
    .search-bar form select[name="position"] {
        flex: 1 1 calc(50% - 4px) !important;
        min-width: 0 !important;
        max-width: none !important;
        height: 44px !important;
    }
    
    /* 车牌查询页面：查询和重置按钮在下一行，平分宽度 */
    .search-bar form button[type="submit"],
    .search-bar form a.btn-reset {
        flex: 1 1 calc(50% - 4px) !important;
        min-width: 0 !important;
        height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}
    
    /* 员工页面：排序列在移动端优化 */
    .table-responsive-card tbody td[data-label="排序号"]:before {
        content: "排序号" !important;
    }
    
    .table-responsive-card tbody td[data-label="排序号"] input.sort-order-input {
        width: 60px !important;
        padding: 6px 4px !important;
        font-size: 14px !important;
    }
    
    /* ========================================
       员工信息管理页面移动端优化
       ======================================== */
    
    /* 员工页面：筛选表单使用flex布局 */
    body[class*="employee"] .filter-form,
    .employee-index .filter-form {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    /* 员工页面：工号和岗位在同一行，左右分布 */
    body[class*="employee"] .filter-form input[name="employee_no"],
    body[class*="employee"] .filter-form select[name="position"],
    .employee-index .filter-form input[name="employee_no"],
    .employee-index .filter-form select[name="position"] {
        flex: 1 1 calc(50% - 4px) !important;
        min-width: 0 !important;
        max-width: none !important;
    }
    
    /* 员工页面：搜索和重置按钮在下一行，平分宽度 */
    body[class*="employee"] .filter-form button[type="submit"],
    body[class*="employee"] .filter-form .btn-secondary,
    .employee-index .filter-form button[type="submit"],
    .employee-index .filter-form .btn-secondary {
        flex: 1 1 calc(50% - 4px) !important;
        min-width: 0 !important;
    }
}

/* 通用：员工信息管理页面 - 工号和岗位移动端同行左右显示 */
@media (max-width: 992px) {
    /* 员工选择器在移动端隐藏（使用移动端选择器） */
    .desktop-employee-selector {
        display: none !important;
    }
    
    /* 筛选表单改为flex布局，允许换行 */
    form.filter-form {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        justify-content: flex-start !important;
    }
    
    /* 工号输入框和岗位下拉框各占50%宽度，在同一行 */
    form.filter-form input[name="employee_no"],
    form.filter-form select[name="position"] {
        flex: 1 1 calc(50% - 4px) !important;
        min-width: 0 !important;
        max-width: none !important;
        width: auto !important;
    }
    
    /* 搜索和重置按钮各占50%宽度，在下一行 */
    form.filter-form button[type="submit"],
    form.filter-form a.btn-secondary {
        flex: 1 1 calc(50% - 4px) !important;
        min-width: 0 !important;
        width: auto !important;
    }
}

/* 移动端：文章列表筛选表单两列网格布局 */
@media (max-width: 992px) {
    /* 两列二等分：分类|状态 / 标签|搜索 / 搜索按钮|重置按钮 */
    form.article-filter-form {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
        align-items: center !important;
    }

    form.article-filter-form > .afi-field {
        width: auto !important;
        min-width: 0 !important;
    }

    /* label 固定宽度不被压缩，下拉/输入框撑满剩余，避免标签文字过宽导致内部换行 */
    form.article-filter-form > .afi-field label {
        flex-shrink: 0 !important;
    }

    /* 下拉 / 输入框在格内撑满，覆盖内联 min-width（分类 160px / 标签 140px / 搜索 200px 等） */
    form.article-filter-form > .afi-field select,
    form.article-filter-form > .afi-field input[type="text"] {
        flex: 1 1 100% !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    /* 搜索 / 重置按钮各占一格（半行）并增大触摸区 */
    form.article-filter-form > button,
    form.article-filter-form > a {
        width: auto !important;
        min-width: 0 !important;
        height: 44px !important;
        padding: 0 16px !important;
        border-radius: 10px !important;
        font-size: 15px !important;
        font-weight: 600 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
        cursor: pointer !important;
        white-space: nowrap !important;
    }
}

