/* 工具类 - 快速开发和扩展 */

/* ==================== 间距工具类 ==================== */
.m-xs { margin: 0.25rem !important; }
.m-sm { margin: 0.5rem !important; }
.m-md { margin: 1rem !important; }
.m-lg { margin: 1.5rem !important; }
.m-xl { margin: 2rem !important; }

.p-xs { padding: 0.25rem !important; }
.p-sm { padding: 0.5rem !important; }
.p-md { padding: 1rem !important; }
.p-lg { padding: 1.5rem !important; }
.p-xl { padding: 2rem !important; }

/* ==================== 显示工具类 ==================== */
.d-flex-center {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.d-flex-between {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.d-flex-around {
    display: flex !important;
    align-items: center !important;
    justify-content: space-around !important;
}

.d-flex-column-center {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ==================== 文本工具类 ==================== */
.text-xs { font-size: 0.75rem !important; }
.text-sm { font-size: 0.875rem !important; }
.text-md { font-size: 1rem !important; }
.text-lg { font-size: 1.125rem !important; }
.text-xl { font-size: 1.25rem !important; }
.text-2xl { font-size: 1.5rem !important; }
.text-3xl { font-size: 1.875rem !important; }

.font-weight-300 { font-weight: 300 !important; }
.font-weight-400 { font-weight: 400 !important; }
.font-weight-500 { font-weight: 500 !important; }
.font-weight-600 { font-weight: 600 !important; }
.font-weight-700 { font-weight: 700 !important; }

.line-height-1 { line-height: 1 !important; }
.line-height-sm { line-height: 1.25 !important; }
.line-height-base { line-height: 1.5 !important; }
.line-height-lg { line-height: 1.75 !important; }

.text-truncate-2 {
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box !important;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==================== 颜色工具类 ==================== */
.text-primary-light { color: #b3d7ff !important; }
.text-primary-dark { color: #0056b3 !important; }

.bg-primary-light { background-color: #e7f3ff !important; }
.bg-primary-dark { background-color: #0056b3 !important; }

.text-success-light { color: #a3d5a3 !important; }
.bg-success-light { background-color: #e6f4e6 !important; }

.text-warning-light { color: #fff3a0 !important; }
.bg-warning-light { background-color: #fff8e1 !important; }

.text-danger-light { color: #ffb3b3 !important; }
.bg-danger-light { background-color: #ffeaea !important; }

.text-info-light { color: #a3e4f0 !important; }
.bg-info-light { background-color: #e1f5fe !important; }

/* ==================== 边框工具类 ==================== */
.border-primary { border-color: var(--primary-color) !important; }
.border-success { border-color: var(--success-color) !important; }
.border-warning { border-color: var(--warning-color) !important; }
.border-danger { border-color: var(--danger-color) !important; }
.border-info { border-color: var(--info-color) !important; }

.border-width-2 { border-width: 2px !important; }
.border-width-3 { border-width: 3px !important; }
.border-width-4 { border-width: 4px !important; }

.border-radius-sm { border-radius: 0.25rem !important; }
.border-radius-md { border-radius: 0.375rem !important; }
.border-radius-lg { border-radius: 0.5rem !important; }
.border-radius-xl { border-radius: 0.75rem !important; }
.border-radius-pill { border-radius: 50rem !important; }

/* ==================== 阴影工具类 ==================== */
.shadow-none { box-shadow: none !important; }
.shadow-xs { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important; }
.shadow-sm { box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06) !important; }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important; }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important; }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important; }

/* ==================== 过渡和动画工具类 ==================== */
.transition-all { transition: all 0.3s ease !important; }
.transition-fast { transition: all 0.15s ease !important; }
.transition-slow { transition: all 0.5s ease !important; }

.hover-lift:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.hover-scale:hover {
    transform: scale(1.05) !important;
}

.hover-rotate:hover {
    transform: rotate(5deg) !important;
}

/* ==================== 位置工具类 ==================== */
.position-center {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}

.position-top-right {
    position: absolute !important;
    top: 1rem !important;
    right: 1rem !important;
}

.position-bottom-right {
    position: absolute !important;
    bottom: 1rem !important;
    right: 1rem !important;
}

/* ==================== 尺寸工具类 ==================== */
.w-10 { width: 10% !important; }
.w-20 { width: 20% !important; }
.w-30 { width: 30% !important; }
.w-40 { width: 40% !important; }
.w-60 { width: 60% !important; }
.w-70 { width: 70% !important; }
.w-80 { width: 80% !important; }
.w-90 { width: 90% !important; }

.h-10 { height: 10% !important; }
.h-20 { height: 20% !important; }
.h-30 { height: 30% !important; }
.h-40 { height: 40% !important; }
.h-60 { height: 60% !important; }
.h-70 { height: 70% !important; }
.h-80 { height: 80% !important; }
.h-90 { height: 90% !important; }

.min-h-100 { min-height: 100% !important; }
.min-h-screen { min-height: 100vh !important; }
.max-h-100 { max-height: 100% !important; }

/* ==================== Z-index工具类 ==================== */
.z-1 { z-index: 1 !important; }
.z-10 { z-index: 10 !important; }
.z-20 { z-index: 20 !important; }
.z-30 { z-index: 30 !important; }
.z-40 { z-index: 40 !important; }
.z-50 { z-index: 50 !important; }
.z-auto { z-index: auto !important; }

/* ==================== 滚动工具类 ==================== */
.overflow-x-auto { overflow-x: auto !important; }
.overflow-y-auto { overflow-y: auto !important; }
.overflow-x-hidden { overflow-x: hidden !important; }
.overflow-y-hidden { overflow-y: hidden !important; }
.overflow-hidden { overflow: hidden !important; }

.scroll-smooth { scroll-behavior: smooth !important; }

/* ==================== 表格工具类 ==================== */
.table-fixed { table-layout: fixed !important; }
.table-auto { table-layout: auto !important; }

/* ==================== 状态工具类 ==================== */
.disabled {
    opacity: 0.6 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
}

.loading {
    position: relative !important;
}

.loading::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 20px !important;
    height: 20px !important;
    margin: -10px 0 0 -10px !important;
    border: 2px solid #f3f3f3 !important;
    border-top: 2px solid var(--primary-color) !important;
    border-radius: 50% !important;
    animation: spin 1s linear infinite !important;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==================== 交互状态 ==================== */
.interactive {
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.interactive:hover {
    opacity: 0.8 !important;
}

.interactive:active {
    transform: scale(0.98) !important;
}

.selectable {
    user-select: text !important;
}

.non-selectable {
    user-select: none !important;
}

/* ==================== 可访问性 ==================== */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.focus-visible:focus {
    outline: 2px solid var(--primary-color) !important;
    outline-offset: 2px !important;
}

/* ==================== 打印样式 ==================== */
@media print {
    .print-hidden {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
    
    .break-before {
        page-break-before: always !important;
    }
    
    .break-after {
        page-break-after: always !important;
    }
    
    .break-inside-avoid {
        page-break-inside: avoid !important;
    }
}

/* ==================== 响应式工具类 ==================== */
@media (max-width: 575.98px) {
    .d-sm-flex-column {
        flex-direction: column !important;
    }
    
    .text-sm-center {
        text-align: center !important;
    }
    
    .w-sm-100 {
        width: 100% !important;
    }
}

@media (max-width: 767.98px) {
    .d-md-flex-column {
        flex-direction: column !important;
    }
    
    .text-md-center {
        text-align: center !important;
    }
    
    .w-md-100 {
        width: 100% !important;
    }
}

@media (max-width: 991.98px) {
    .d-lg-flex-column {
        flex-direction: column !important;
    }
    
    .text-lg-center {
        text-align: center !important;
    }
    
    .w-lg-100 {
        width: 100% !important;
    }
}
