/**
 * 工具类
 * 通用样式辅助类
 */

/* 隐藏类 */
.hidden {
    display: none !important;
}

.invisible {
    visibility: hidden;
}



/* 文字截断 */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

/* 淡入动画 */
.fade-in {
    animation: fadeIn var(--transition-normal) ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 渐变文字 */
.gradient-text {
    background: linear-gradient(135deg, var(--color-primary), var(--color-info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 加载屏幕 */
.loading-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-deep);
    z-index: 9999;
}

.loading-screen p {
    margin-top: var(--spacing-lg);
    color: var(--color-text-secondary);
    font-size: 0.95rem;
}

.loader {
    width: 48px;
    height: 48px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* 加载状态 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
}

.loading::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--color-text-secondary);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.empty-state .empty-text {
    font-size: 1rem;
    margin-bottom: var(--spacing-lg);
}

/* ================= 通用组件样式 ================= */

/* 表单输入 */
.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary) !important;
    /* 强制使用主文字颜色 */
    transition: all var(--transition-fast);
    outline: none;
    font-size: 0.95rem;
}

.form-control option {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
    background: var(--color-bg-primary);
    /* 聚焦时背景稍亮 */
}

.form-control::placeholder {
    color: var(--color-text-secondary) !important;
    opacity: 0.9 !important;
}

/* 小型输入框 */
.form-control-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
}

/* ================= 布局工具类 ================= */
.flex {
    display: flex;
}

.flex-col,
.flex-column {
    display: flex;
    flex-direction: column;
}

.flex-1 {
    flex: 1;
}

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

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

.align-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-end {
    justify-content: flex-end;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

/* 宽高 */
.w-100 {
    width: 100%;
}

.h-100 {
    height: 100%;
}

.vw-100 {
    width: 100vw;
}

.vh-100 {
    height: 100vh;
}

/* 间距 - 内边距 */
.p-0 {
    padding: 0 !important;
}

.p-5 {
    padding: 5px !important;
}

.p-10 {
    padding: 10px !important;
}

.p-15 {
    padding: 15px !important;
}

.p-20 {
    padding: 20px !important;
}

.pl-10 {
    padding-left: 10px !important;
}

.pr-10 {
    padding-right: 10px !important;
}

/* 间距 - 外边距 */
.m-0 {
    margin: 0 !important;
}

.mb-5 {
    margin-bottom: 5px !important;
}

.mb-10 {
    margin-bottom: 10px !important;
}

.mb-15 {
    margin-bottom: 15px !important;
}

.mb-20 {
    margin-bottom: 20px !important;
}

.mt-5 {
    margin-top: 5px !important;
}

.mt-10 {
    margin-top: 10px !important;
}

.mt-20 {
    margin-top: 20px !important;
}

.mr-5 {
    margin-right: 5px !important;
}

.mr-10 {
    margin-right: 10px !important;
}

.ml-10 {
    margin-left: 10px !important;
}

.mt-auto {
    margin-top: auto !important;
}

/* 间距 - Gap */
.gap-5 {
    gap: 5px;
}

.gap-10 {
    gap: 10px;
}

.gap-15 {
    gap: 15px;
}

.gap-20 {
    gap: 20px;
}

/* 定位 */
.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.inset-0 {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.z-10 {
    z-index: 10;
}

.overflow-hidden {
    overflow: hidden;
}

.overflow-y-auto {
    overflow-y: auto;
}

/* 文本 */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-xl {
    font-size: 1.25rem;
}

.font-bold {
    font-weight: 700;
}

.font-mono {
    font-family: monospace;
}

.text-secondary {
    color: var(--color-text-secondary);
}

/* 背景与边框 */
.bg-primary {
    background-color: var(--color-bg-primary);
}

.bg-secondary {
    background-color: var(--color-bg-secondary);
}

.bg-tertiary {
    background-color: var(--color-bg-tertiary);
}

.border-radius-10 {
    border-radius: 10px;
}

.border-bottom {
    border-bottom: 1px solid var(--color-border);
}

.border-top {
    border-top: 1px solid var(--color-border);
}

.border-left {
    border-left: 1px solid var(--color-border);
}

/* 显示 */
.d-block {
    display: block;
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

.transition-all {
    transition: all var(--transition-normal);
}

/* 路由懒加载指示器 */
.route-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.15s ease-out;
}

.route-loading-spinner {
    background: var(--color-bg-elevated, #fff);
    padding: 20px 32px;
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow-xl, 0 20px 50px rgba(0,0,0,0.3));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.route-loading-spinner .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--color-border, #e5e5e5);
    border-top-color: var(--color-primary, #3b82f6);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.route-loading-spinner span {
    font-size: 14px;
    color: var(--color-text-secondary, #666);
}