/* 响应式设计样式 */

/* 小屏幕笔记本 (14寸笔记本，最大宽度为 1366px) */
@media screen and (max-width: 1366px) {
    /* 侧边栏优化 */
    .sidebar {
        width: 200px;
    }
    
    .sidebar.collapsed {
        width: 64px;
    }
    
    /* 表格优化 */
    .data-table {
        font-size: 13px;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 8px;
        min-width: 80px;
    }
    
    /* 表格容器 */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
        border: 1px solid var(--divider-color);
    }
    
    .table-container::-webkit-scrollbar {
        height: 8px;
    }
    
    .table-container::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }
    
    .table-container::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 4px;
    }
    
    .table-container::-webkit-scrollbar-thumb:hover {
        background: #555;
    }
    
    /* 按钮优化 */
    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .btn-sm {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    /* 操作按钮组优化 */
    .action-buttons {
        display: flex;
        gap: 5px;
        flex-wrap: wrap;
    }
    
    .action-buttons .btn {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 60px;
    }
    
    /* 卡片优化 */
    .dashboard-card {
        padding: 15px;
        margin: 10px;
    }
    
    /* 表单优化 */
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-control {
        padding: 10px 12px;
        font-size: 13px;
    }

    /* 搜索选择框输入与普通输入框统一 */
    .searchable-select input {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    /* 表单行优化 */
    .form-row {
        gap: 15px;
    }
    
    .form-row .col {
        flex: 1;
        min-width: 150px;
    }
    
    /* 输入组优化 */
    .input-group {
        flex-direction: row;
        gap: 10px;
    }
    
    .input-group .form-control {
        flex: 1;
    }
    
    /* 内容区域优化 */
    .content-wrapper {
        padding: 15px;
    }
    
    .content-section {
        margin: 0;
        padding: 0;
        width: 100%;
        max-width: 100%;
    }
    
    .card {
        margin: 10px;
        padding: 15px;
    }
    
    /* 分页优化 */
    .pagination {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .pagination li {
        margin: 2px;
    }
    
    .pagination a {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    /* 模态框优化 */
    .modal-content {
        width: 90%;
        max-width: 800px;
    }
    
    /* 顶部栏优化 */
    .top-bar {
        padding: 0 15px;
    }
    
    .top-bar-left h1 {
        font-size: 18px;
    }
    
    /* 搜索框优化 */
    .search-box {
        max-width: 300px;
    }
    
    /* 侧边栏导航优化(紧凑+分组, 与 style.css 一致) */
    .nav-card {
        padding: 3px var(--space-2);
    }
    
    .nav-card-text {
        font-size: 12px;
    }
    
    .nav-card i {
        font-size: 13px;
    }
    
    /* 模块容器优化 - 小屏幕靠左对齐 */
    .module-container {
        max-width: 100%;
        margin: 0;
        width: 100%;
    }
    
    /* 仪表板容器优化 */
    .dashboard-container {
        max-width: 100%;
        margin: 0;
        width: 100%;
    }
    
    /* 确保所有容器靠左 */
    .dashboard-content,
    .dashboard-grid,
    .dashboard-card,
    .table-container {
        margin: 0;
        width: 100%;
    }
}

/* 中等屏幕 (1367px - 1535px) - 确保靠左对齐 */
@media screen and (min-width: 1367px) and (max-width: 1535px) {
    /* 模块容器优化 - 确保靠左对齐 */
    .module-container {
        max-width: 100%;
        margin: 0;
        width: 100%;
    }
    
    /* 仪表板容器优化 */
    .dashboard-container {
        max-width: 100%;
        margin: 0;
        width: 100%;
    }
    
    /* 内容区域优化 */
    .content-wrapper {
        text-align: left;
    }
    
    .content-section {
        text-align: left;
        margin: 0;
        padding: 0;
        width: 100%;
        max-width: 100%;
    }
    
    /* 确保所有容器靠左 */
    .dashboard-content,
    .dashboard-grid,
    .dashboard-card,
    .table-container {
        margin: 0;
        width: 100%;
        text-align: left;
    }
}

/* 移动设备专用优化 */
@media screen and (max-width: 480px) {
    /* 隐藏桌面端元素 */
    .desktop-only {
        display: none !important;
    }

    /* 显示移动端元素 */
    .mobile-only {
        display: block !important;
    }

    /* 顶部栏优化 */
    .top-bar {
        padding: 10px 15px;
    }

    .top-bar h2 {
        font-size: 16px;
    }

    /* 内容区域优化 */
    .content-wrapper {
        padding: 15px;
    }

    /* 卡片优化 */
    .dashboard-card {
        margin-bottom: 15px;
    }

    /* 表格转卡片 */
    .data-table {
        display: block;
    }

    .data-table thead {
        display: none;
    }

    .data-table tbody {
        display: block;
    }

    .data-table tr {
        display: block;
        margin-bottom: 15px;
        padding: 15px;
        background: white;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }

    .data-table td {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border: none;
        border-bottom: 1px solid #f0f0f0;
    }

    .data-table td:last-child {
        border-bottom: none;
    }

    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #333;
        margin-right: 10px;
    }

    /* 按钮组优化 */
    .table-actions {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }

    .table-actions .btn {
        flex: 1;
        min-width: 80px;
        padding: 8px 12px;
        font-size: 12px;
    }

    /* 模态框优化 */
    .modal-content {
        width: 95% !important;
        max-width: none !important;
        max-height: calc(100vh - 20px) !important;
    }

    .modal-body {
        padding: 15px;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }

    .modal-footer {
        flex-direction: column;
        gap: 10px;
    }

    .modal-footer .btn {
        width: 100%;
    }

    /* 表单优化 */
    .form-group {
        margin-bottom: 12px;
    }

    .form-label {
        font-size: 13px;
    }

    .form-control {
        font-size: 14px;
        padding: 10px 12px;
    }

    .searchable-select input {
        font-size: 14px;
        padding: 10px 12px;
    }

    /* 搜索框优化 */
    .search-box {
        margin-bottom: 10px;
    }

    .search-box input {
        font-size: 14px;
        padding: 10px 35px 10px 12px;
    }

    /* 通知优化 */
    .notification {
        left: 10px;
        right: 10px;
        bottom: 70px;
        top: auto;
        transform: none;
        border-radius: 8px;
    }
}

/* 平板设备 (最大宽度为 1024px) */
@media screen and (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .container {
        flex-direction: row;
    }

    .content-wrapper {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }

    .form-row {
        flex-wrap: wrap;
    }

    .form-row .col {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 15px;
    }

    .input-group {
        flex-direction: column;
        gap: 10px;
    }
}

/* 小平板和大手机 (最大宽度为 768px) */
@media screen and (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .sidebar {
        width: 70px;
        overflow: hidden;
    }

    .sidebar.collapsed {
        width: 250px;
    }

    .sidebar .nav-text {
        display: none;
    }

    .sidebar.collapsed .nav-text {
        display: inline;
    }

    .sidebar .nav-item i {
        margin-right: 0;
        font-size: 20px;
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-md);
        flex-shrink: 0;
    }

    .sidebar.collapsed .nav-item i {
        margin-right: 10px;
        font-size: 16px;
    }

    .main-content {
        margin-left: 70px;
    }

    .top-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .top-bar .search-box {
        width: 100%;
        margin-bottom: 10px;
    }

    .top-bar .user-info {
        width: 100%;
        justify-content: space-between;
    }

    .content-wrapper {
        padding: 10px;
    }

    .card {
        margin: 10px;
        padding: 15px;
    }

    .table {
        font-size: 12px;
    }

    .table th,
    .table td {
        padding: 8px 5px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 12px;
    }

    .modal-content {
        margin: 20px;
        width: calc(100% - 40px);
        max-width: calc(100% - 40px);
    }
}

/* 手机设备 (最大宽度为 576px) */
@media screen and (max-width: 576px) {
    body {
        font-size: 12px;
    }

    .container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -250px;
        height: 100vh;
        z-index: var(--z-40);
        transition: left 0.3s ease;
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .mobile-menu-btn {
        display: block;
        position: absolute;
        left: 10px;
        top: 15px;
        z-index: var(--z-30);
        background: #007bff;
        color: white;
        border: none;
        padding: 10px;
        border-radius: 4px;
        cursor: pointer;
    }

    .top-bar {
        padding: 10px;
    }

    .content-section {
        padding: 10px;
    }

    .card {
        margin: 5px;
        padding: 10px;
    }

    .table {
        font-size: 10px;
        display: block;
        overflow-x: auto;
    }

    .table th,
    .table td {
        padding: 5px;
        min-width: 80px;
    }

    .form-group label {
        font-size: 12px;
    }

    .form-control {
        padding: 6px 10px;
        font-size: 12px;
    }

    .searchable-select input {
        padding: 6px 10px;
        font-size: 12px;
    }

    .btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .pagination {
        flex-wrap: wrap;
    }

    .pagination li {
        margin: 2px;
    }
}

/* 超小屏幕 (最大宽度为 360px) */
@media screen and (max-width: 360px) {
    body {
        font-size: 11px;
    }

    .table {
        font-size: 9px;
    }

    .table th,
    .table td {
        padding: 3px;
        min-width: 60px;
    }

    .btn {
        padding: 5px 10px;
        font-size: 11px;
    }
}

/* 高分辨率屏幕 */
@media screen and (min-width: 1200px) {
    body {
        font-size: 16px;
    }

    .content-wrapper {
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    }
}

/* 横屏手机 */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }

    .content-section {
        overflow-y: auto;
        max-height: 100%;
    }
}