/* 响应式工具类 */

/* 基础响应式断点 */
@media (max-width: 1399.98px) {
    .d-xxl-none { display: none !important; }
    .d-xxl-inline { display: inline !important; }
    .d-xxl-inline-block { display: inline-block !important; }
    .d-xxl-block { display: block !important; }
    .d-xxl-flex { display: flex !important; }
}

@media (max-width: 1199.98px) {
    .d-xl-none { display: none !important; }
    .d-xl-inline { display: inline !important; }
    .d-xl-inline-block { display: inline-block !important; }
    .d-xl-block { display: block !important; }
    .d-xl-flex { display: flex !important; }
}

@media (max-width: 991.98px) {
    .d-lg-none { display: none !important; }
    .d-lg-inline { display: inline !important; }
    .d-lg-inline-block { display: inline-block !important; }
    .d-lg-block { display: block !important; }
    .d-lg-flex { display: flex !important; }
    
    /* 侧边栏响应式 */
    .sidebar {
        width: var(--sidebar-collapsed-width);
        transform: translateX(-100%);
        transition: transform var(--transition-speed);
    }
    
    .sidebar.show {
        transform: translateX(0);
        width: var(--sidebar-width);
        box-shadow: 4px 0 8px rgba(0, 0, 0, 0.15);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block !important;
    }
    
    .logo span {
        display: none;
    }
    
    .sidebar.show .logo span {
        display: block;
    }
}

@media (max-width: 767.98px) {
    .d-md-none { display: none !important; }
    .d-md-inline { display: inline !important; }
    .d-md-inline-block { display: inline-block !important; }
    .d-md-block { display: block !important; }
    .d-md-flex { display: flex !important; }
    
    /* 内容区域调整 */
    .content-wrapper {
        padding: 16px;
    }
    
    /* 头部响应式 */
    .header {
        padding: 0 16px;
        flex-direction: column;
        height: auto;
        padding-top: 12px;
        padding-bottom: 12px;
    }
    
    .header-left, 
    .header-right {
        width: 100%;
    }
    
    .header-right {
        margin-top: 8px;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .admin-mode-switcher {
        margin-right: 0;
        order: 2;
    }
    
    .user-info {
        order: 1;
    }
    
    /* 统计卡片响应式 */
    .stat-card {
        min-height: 80px;
        padding: 16px;
    }
    
    .stat-card-content h4 {
        font-size: 12px;
    }
    
    .stat-card-content h2 {
        font-size: 24px;
    }
    
    .stat-card-icon {
        font-size: 32px;
        right: 16px;
    }
    
    /* 卡片响应式 */
    .card-body {
        padding: 16px;
    }
    
    .card-header {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .card-header h5 {
        margin-bottom: 0;
    }
    
    /* 表格响应式 */
    .table-actions {
        flex-direction: column;
        gap: 4px;
        align-items: stretch;
    }
    
    .table-actions .btn {
        width: 100%;
        min-width: 0;
        font-size: 11px;
        text-align: center;
    }
    
    /* 按钮组响应式 */
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: var(--border-radius) !important;
        margin-bottom: 4px;
        border: 1px solid !important;
    }
    
    .btn-group .btn:last-child {
        margin-bottom: 0;
    }
}

@media (max-width: 575.98px) {
    .d-sm-none { display: none !important; }
    .d-sm-inline { display: inline !important; }
    .d-sm-inline-block { display: inline-block !important; }
    .d-sm-block { display: block !important; }
    .d-sm-flex { display: flex !important; }
    
    /* 更小屏幕的调整 */
    .content-wrapper {
        padding: 12px;
    }
    
    .header {
        padding: 8px 12px;
    }
    
    .header-left h2 {
        font-size: 16px;
    }
    
    .breadcrumb {
        font-size: 11px;
    }
    
    /* 用户信息响应式 */
    .user-info {
        gap: 8px;
    }
    
    .user-avatar img {
        width: 32px;
        height: 32px;
    }
    
    .user-name {
        font-size: 13px;
    }
    
    .user-role {
        font-size: 11px;
    }
    
    /* 模态框响应式 */
    .modal-dialog {
        margin: 1rem;
    }
    
    .modal-header {
        padding: 12px 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .modal-footer {
        padding: 12px 16px;
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* 表单响应式 */
    .search-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-form .form-control {
        margin-bottom: 8px;
    }
    
    /* 分页响应式 */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pagination .page-item .page-link {
        padding: 4px 8px;
        font-size: 12px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 374px) {
    .content-wrapper {
        padding: 8px;
    }
    
    .card-body {
        padding: 12px;
    }
    
    .card-header {
        padding: 8px 12px;
    }
    
    .stat-card {
        padding: 12px;
        min-height: 70px;
    }
    
    .stat-card-content h2 {
        font-size: 20px;
    }
    
    .stat-card-icon {
        font-size: 24px;
    }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        height: var(--header-height);
        flex-direction: row;
        padding: 0 16px;
    }
    
    .header-left,
    .header-right {
        width: auto;
    }
    
    .header-right {
        margin-top: 0;
    }
    
    .content-wrapper {
        padding: 16px;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-dialog-centered {
        min-height: calc(100vh - 1rem);
    }
}

/* 打印样式 */
@media print {
    .sidebar,
    .header,
    .footer,
    .btn,
    .modal,
    .dropdown-menu,
    .pagination {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .content-wrapper {
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
    
    .table {
        border-collapse: collapse !important;
    }
    
    .table th,
    .table td {
        border: 1px solid #000 !important;
        padding: 8px !important;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000;
        --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        --box-shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.3);
    }
    
    .card,
    .btn,
    .form-control,
    .table {
        border-width: 2px;
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .fade-in,
    .slide-up,
    .modal.fade .modal-dialog {
        animation: none !important;
        transition: none !important;
    }
}