/* ========== 通用基础样式 ========== */
* {
    -webkit-touch-callout: none;
}

html {
    scroll-behavior: smooth;
}

:focus {
    caret-color: #28a745;
}

/* ========== 选中文本样式 ========== */
::selection {
    background-color: #d4edda;
    color: #155724;
    transition: background-color 0.2s ease;
}

::-moz-selection {
    background-color: #d4edda;
    color: #155724;
}

h1::selection,
h2::selection,
h3::selection {
    background-color: #c3e6cb;
    color: #0c5460;
}

h1::-moz-selection,
h2::-moz-selection,
h3::-moz-selection {
    background-color: #c3e6cb;
    color: #0c5460;
}

a::selection {
    background-color: #b1dfbb;
    color: #004085;
}

a::-moz-selection {
    background-color: #b1dfbb;
    color: #004085;
}

/* ========== 滚动淡入效果 ========== */
.scroll-fade {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.scroll-fade.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========== 卡片通用样式 ========== */
.card {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* ========== 按钮通用样式 ========== */
.download-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 8px 20px;
    background-color: #4361ee;
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.2);
}

.download-btn:hover {
    background-color: #3a56d4;
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
    color: white;
    text-decoration: none;
}

/* ========== 节标题通用样式 ========== */
.section-title {
    position: relative;
    padding-bottom: 10px;
}

.section-title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 60px;
    height: 3px;
    background-color: #4361ee;
    border-radius: 3px;
}

/* ========== 表头固定样式 ========== */
.overflow-x-auto {
    scrollbar-width: thin;
    scrollbar-color: #165DFF #F5F7FA;
}

.overflow-x-auto::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.overflow-x-auto::-webkit-scrollbar-track {
    background: #F5F7FA;
    border-radius: 3px;
}

.overflow-x-auto::-webkit-scrollbar-thumb {
    background: #165DFF;
    border-radius: 3px;
}

.overflow-x-auto::-webkit-scrollbar-thumb:hover {
    background: #4080FF;
}

/* ========== 表格通用样式 ========== */
.table-container {
    max-height: calc(100vh - 320px);
    overflow-y: auto;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #165DFF #F5F7FA;
}

.table-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.table-container::-webkit-scrollbar-track {
    background: #F5F7FA;
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb {
    background: #165DFF;
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #4080FF;
}

/* 表头固定关键样式 */
.table-container thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #165DFF !important;
}

/* 优化表格行高 */
.table-container tbody tr {
    transition: all 0.2s ease;
}

/* ========== 头像通用样式 ========== */
.headimg,
.head_img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    object-fit: cover;
}

/* ========== 表格固定样式 ========== */
th {
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* ========== 按钮悬停效果 ========== */
.btn-hover {
    transition: all 0.3s ease;
}

.btn-hover:hover {
    transform: translateY(-2px);
}

/* ========== 表单通用样式 ========== */
.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #165DFF;
    box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.1);
}

/* ========== 标签通用样式 ========== */
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
}

/* ========== 动画效果 ========== */
@keyframes fadeSlideUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeSlideDown {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes formItemFade {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes alertPop {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(5px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ========== 渐变背景通用样式 ========== */
.bg-gradient {
    background: linear-gradient(145deg, #f0f4fa 0%, #f8fafd 100%);
}

/* ========== 玻璃态效果 ========== */
.glass {
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* ========== 响应式工具 ========== */
@media (max-width: 640px) {
    .overflow-x-auto {
        max-height: calc(100vh - 150px);
    }

    .table-container {
        max-height: calc(100vh - 150px);
    }

    th,
    td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
}

/* ========== 可访问性 ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
