/**
 * 公共样式文件
 * 提供通用样式和组件样式
 * 
 * @author Xray Management System
 * @version 2.0
 */

/* ==================== 全局样式 ==================== */
:root {
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --secondary-color: #764ba2;
    --success-color: #48bb78;
    --danger-color: #f56565;
    --warning-color: #ed8936;
    --info-color: #4299e1;
    --dark-color: #2d3748;
    --light-color: #f7fafc;
    --border-color: #e2e8f0;
    --text-color: #4a5568;
    --text-muted: #718096;
    
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

/* ==================== Logo样式 ==================== */
.logo-z {
    font-size: 22px;
    font-weight: 900;
    font-family: 'Arial Black', 'Impact', sans-serif;
    background: linear-gradient(
        90deg,
        #FFD700 0%,
        #FFA500 20%,
        #FF6B6B 40%,
        #4ECDC4 60%,
        #45B7D1 80%,
        #FFD700 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 300% 100%;
    margin-right: 0;
    padding-right: 8px;
    padding-left: 2px;
    display: inline-block;
    position: relative;
    animation: logo-rainbow 6s linear infinite;
    letter-spacing: 1px;
    transform: skewX(-5deg);
    font-style: italic;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
    overflow: visible;
    vertical-align: middle;
    line-height: 1;
}

/* 拖影效果 */
.logo-z::before {
    content: attr(data-text);
    position: absolute;
    left: 2px;
    top: 2px;
    z-index: -1;
    background: linear-gradient(
        90deg,
        rgba(255, 215, 0, 0.3) 0%,
        rgba(255, 165, 0, 0.3) 20%,
        rgba(255, 107, 107, 0.3) 40%,
        rgba(78, 205, 196, 0.3) 60%,
        rgba(69, 183, 209, 0.3) 80%,
        rgba(255, 215, 0, 0.3) 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 300% 100%;
    filter: blur(3px);
    opacity: 0.6;
    animation: logo-rainbow 6s linear infinite;
    padding-right: 8px;
    padding-left: 2px;
}

/* 彩虹渐变动画 */
@keyframes logo-rainbow {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

/* 悬停效果 */
.navbar-brand:hover .logo-z {
    animation: logo-rainbow 3s linear infinite, logo-pulse 0.6s ease-in-out;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6)) 
            drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.4));
}

.navbar-brand:hover .logo-z::before {
    animation: logo-rainbow 3s linear infinite, logo-shadow-pulse 0.6s ease-in-out;
}

@keyframes logo-pulse {
    0%, 100% { transform: skewX(-5deg) scale(1); }
    50% { transform: skewX(-5deg) scale(1.1); }
}

@keyframes logo-shadow-pulse {
    0%, 100% { 
        left: 2px;
        top: 2px;
        opacity: 0.6;
    }
    50% { 
        left: 4px;
        top: 4px;
        opacity: 0.8;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-color);
    padding-top: 70px; /* 为fixed-top导航栏预留空间 */
}

/* 手机端调整padding-top，匹配手机端导航栏高度 */
@media (max-width: 768px) {
    body {
        padding-top: 60px; /* 手机端导航栏高度是60px */
    }
}

/* ==================== 渐变背景 ==================== */
.gradient-bg {
    background: var(--gradient-primary);
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==================== 卡片样式 - 增强版 ==================== */
.card {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.06),
                0 1px 4px rgba(0, 0, 0, 0.04),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 100%; /* 防止卡片超出容器 */
    overflow: hidden; /* 隐藏超出内容 */
    background: linear-gradient(135deg, #ffffff 0%, #fafbff 100%);
    border: 1.5px solid rgba(102, 126, 234, 0.12);
    position: relative;
}

.card:hover {
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.18),
                0 4px 16px rgba(118, 75, 162, 0.12),
                0 2px 8px rgba(0, 0, 0, 0.06),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border-color: rgba(102, 126, 234, 0.35);
    background: linear-gradient(135deg, #ffffff 0%, #f5f7ff 100%);
}

.card-hover-effect:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 16px 48px rgba(102, 126, 234, 0.2),
                0 6px 20px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.06) 0%, rgba(118, 75, 162, 0.04) 100%);
    border-bottom: 2px solid rgba(102, 126, 234, 0.12);
    font-weight: 600;
    padding: 1.25rem 1.5rem;
    position: relative;
}


/* ==================== 按钮样式 ==================== */
.btn {
    border-radius: var(--radius-md);
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-gradient {
    background: var(--gradient-primary);
    color: white;
    border: none;
}

.btn-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    color: white;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* ==================== Loading 加载效果简化美化 ==================== */
#loading-overlay {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9999 !important;
    animation: loading-fade-in 0.25s ease-out;
    cursor: wait !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

@keyframes loading-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

#loading-overlay > div,
#loading-overlay .loading-content {
    background: #ffffff !important;
    border-radius: 20px !important;
    padding: 2.5rem 3rem !important;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.15),
        0 8px 25px rgba(102, 126, 234, 0.1) !important;
    border: 1px solid rgba(102, 126, 234, 0.15) !important;
    min-width: 200px;
    position: relative;
    animation: loading-scale-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: block !important;
}

@keyframes loading-scale-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Spinner 简化美化 */
#loading-overlay .spinner-border {
    width: 48px !important;
    height: 48px !important;
    border-width: 4px !important;
    border-style: solid !important;
    border-color: rgba(102, 126, 234, 0.1) !important;
    border-top-color: #667eea !important;
    border-right-color: #764ba2 !important;
    border-radius: 50% !important;
    display: inline-block !important;
    vertical-align: text-bottom !important;
    animation: spinner-rotate 0.75s linear infinite !important;
    margin-bottom: 1.25rem !important;
    position: relative;
    -webkit-animation: spinner-rotate 0.75s linear infinite !important;
}

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

/* 加载文字简化 */
#loading-message {
    color: #667eea !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    position: relative;
    z-index: 1;
    letter-spacing: 0.3px;
}

/* 移动端优化 */
@media (max-width: 768px) {
    #loading-overlay > div,
    #loading-overlay .loading-content {
        padding: 2rem 2.5rem !important;
        min-width: 180px !important;
        border-radius: 16px !important;
    }
    
    #loading-overlay .spinner-border {
        width: 40px !important;
        height: 40px !important;
        border-width: 3.5px !important;
        margin-bottom: 1rem !important;
    }
    
    #loading-message {
        font-size: 0.875rem !important;
    }
}

/* ==================== 表格样式 ==================== */
.table {
    border-radius: var(--radius-lg);
    overflow: hidden;
    width: 100%; /* 表格宽度与容器一致 */
    max-width: 100%; /* 防止表格超出容器 */
}

.table thead {
    background: var(--light-color);
}

.table thead th {
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 1rem;
    white-space: nowrap; /* 表头不换行 */
}

.table tbody tr {
    transition: background-color 0.2s;
}

.table tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.05);
}

.table tbody td {
    white-space: nowrap; /* 表格单元格内容不换行 */
    vertical-align: middle; /* 垂直居中对齐 */
    text-indent: 0; /* 去除复制时的前导空格 */
}

/* 表格响应式容器 - 支持横向滚动 */
.table-responsive {
    display: block;
    width: 100%;
    max-width: 100%; /* 防止超出父容器 */
    overflow-x: auto; /* 横向滚动 */
    overflow-y: visible; /* 允许垂直内容显示 */
    -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
    -ms-overflow-style: -ms-autohiding-scrollbar; /* IE/Edge 自动隐藏滚动条 */
    /* 确保表格可以完全滚动 */
    scroll-padding: 0;
    -webkit-overflow-scrolling: touch;
}

/* 确保表格本身有足够宽度 */
.table-responsive .table {
    min-width: 100%;
    width: auto; /* 根据内容自动调整宽度 */
    margin-bottom: 0;
    table-layout: auto; /* 自动布局，根据内容调整 */
    /* 确保表格宽度刚好等于内容宽度，不超出 */
    max-width: fit-content;
}

/* 优化表格响应式容器的滚动条样式 */
.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--light-color);
    border-radius: var(--radius-md);
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-md);
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* 表格操作按钮列 */
.table-actions {
    white-space: nowrap;
}

.table-actions .btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

/* 为特定列添加最小宽度，避免压缩 */
.table td:first-child,
.table th:first-child {
    min-width: 80px; /* ID 列最小宽度 */
}

.table td.table-actions,
.table th.table-actions {
    min-width: 120px; /* 操作列最小宽度 */
}

/* ==================== 徽章样式 ==================== */
.badge {
    padding: 0.35em 0.75em;
    border-radius: var(--radius-md);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
    vertical-align: middle;
    min-height: 1.5em;
    text-align: center;
}

.badge-gradient {
    background: var(--gradient-primary);
    color: white;
}

/* ==================== 状态指示器 ==================== */
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-online {
    background-color: var(--success-color);
    box-shadow: 0 0 10px var(--success-color);
}

.status-offline {
    background-color: var(--danger-color);
}

.status-warning {
    background-color: var(--warning-color);
}

/* ==================== 表单样式 ==================== */
.form-control,
.form-select,
textarea.form-control {
    border-radius: 10px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    padding: 0.625rem 0.875rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, #ffffff 0%, #fafbff 100%);
    color: #2d3748;
    font-size: 0.95rem;
    box-shadow: 0 1px 2px rgba(102, 126, 234, 0.06);
}

.form-control:hover:not(:disabled):not([readonly]),
.form-select:hover:not(:disabled) {
    border-color: rgba(102, 126, 234, 0.35);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.1);
    background: #ffffff;
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: none;
    outline: none;
    background: #ffffff;
}

.form-control[readonly],
.form-control:disabled,
.form-select:disabled {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    cursor: not-allowed;
    border-color: rgba(102, 126, 234, 0.1);
    opacity: 0.7;
}

.form-control.font-monospace[readonly] {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    font-size: 0.875rem;
    font-family: 'Courier New', monospace;
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-label i {
    color: #667eea;
    font-size: 0.875rem;
}

.input-group-text {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.06) 100%);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-right: none;
    color: var(--primary-color);
    font-weight: 600;
    border-radius: 10px 0 0 10px;
}

.input-group .form-control {
    border-left: none;
    border-radius: 0 10px 10px 0;
    box-shadow: none;
}

.input-group:focus-within {
    box-shadow: none;
}

.input-group:focus-within .input-group-text {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.input-group:focus-within .form-control {
    border-color: var(--primary-color);
}

/* ==================== 统计卡片 ==================== */
.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    height: 120px; /* 固定高度确保一致性 */
    display: flex;
    align-items: center;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    background: var(--gradient-primary);
    color: white;
    flex-shrink: 0; /* 防止图标缩小 */
}

.stat-card-title {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.stat-card-value {
    font-size: 1.5rem; /* 统一字体大小 */
    font-weight: 700;
    color: var(--dark-color);
    margin: 0;
    white-space: nowrap; /* 防止换行 */
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.stat-card-value-sm {
    font-size: 1rem; /* 适用于较长文本如日期 */
}

.stat-card-change {
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-card-change.positive {
    color: var(--success-color);
}

.stat-card-change.negative {
    color: var(--danger-color);
}

/* ==================== 进度条 ==================== */
.progress {
    height: 8px;
    border-radius: var(--radius-md);
    background-color: var(--light-color);
}

.progress-bar {
    background: var(--gradient-primary);
}

/* ==================== Alert样式 ==================== */
.alert {
    border: none;
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    border-left: 4px solid;
}

.alert-success {
    background-color: rgba(72, 187, 120, 0.1);
    border-left-color: var(--success-color);
    color: var(--success-color);
}

.alert-danger {
    background-color: rgba(245, 101, 101, 0.1);
    border-left-color: var(--danger-color);
    color: var(--danger-color);
}

.alert-warning {
    background-color: rgba(237, 137, 54, 0.1);
    border-left-color: var(--warning-color);
    color: var(--warning-color);
}

.alert-info {
    background-color: rgba(66, 153, 225, 0.1);
    border-left-color: var(--info-color);
    color: var(--info-color);
}

/* ==================== 分页样式 ==================== */
.pagination {
    gap: 0.5rem;
}

.page-link {
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    color: var(--primary-color);
    font-weight: 500;
    padding: 0.5rem 0.875rem;
    transition: all 0.2s;
}

.page-link:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.page-item.active .page-link {
    background: var(--gradient-primary);
    border-color: transparent;
}

/* ==================== 模态框样式 - 深度美化 ==================== */

/* 模态框外层容器 - 确保完全居中，只在显示时应用flex */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1055;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 1rem;
    display: none;
}

/* 模态框显示时应用flex居中 */
.modal.show,
.modal.showing {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* 模态框淡入动画 - 快速关闭，避免位置跳动 */
.modal.fade {
    transition: opacity 0.1s linear;
}

.modal.fade:not(.show) {
    opacity: 0;
}

.modal.show,
.modal.showing {
    opacity: 1;
}

/* 关闭时保持居中位置，快速消失，避免跳动 */
.modal.fade.hiding,
.modal.fade.hide {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0;
    transition: opacity 0.05s linear !important;
}

/* 完全关闭时立即隐藏，不显示动画 */
.modal:not(.show):not(.showing):not(.hiding) {
    display: none !important;
}

/* 禁用Bootstrap默认的transform动画 - 确保关闭时不会有位置跳动 */
.modal.fade .modal-dialog {
    transition: none !important;
    transform: none !important;
    -webkit-transform: none !important;
}

.modal.show .modal-dialog,
.modal.showing .modal-dialog,
.modal.hiding .modal-dialog,
.modal.hide .modal-dialog {
    transform: none !important;
    -webkit-transform: none !important;
}

/* 模态框背景遮罩层 - 浅灰色背景 + 主界面模糊 */
.modal-backdrop {
    background: rgba(240, 242, 245, 0.85) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-backdrop.show {
    opacity: 1;
}

/* 模态框容器 - 完美居中（上下左右），智能响应式宽度 */
.modal-dialog {
    position: relative;
    /* 使用 clamp 实现智能宽度：
       - 最小宽度：90% (小屏幕接近全屏，确保移动端体验)
       - 理想宽度：min(70vw, calc(100vw - 80px)) 
         在小屏幕上取 90% (clamp 最小值)，中等屏幕取 70vw，超大屏幕取 (100vw - 80px) 确保有边距
       - 最大宽度：1600px (超大屏幕限制，避免过宽)
       这样可以在任何屏幕尺寸下都获得最佳显示效果，平滑过渡 */
    width: clamp(90%, min(70vw, calc(100vw - 80px)), 1600px);
    margin: auto;
    pointer-events: none;
    /* 禁用所有transform和transition，避免关闭时位置跳动 */
    transition: none !important;
    transform: none !important;
    -webkit-transform: none !important;
}

/* 确保模态框内容可以接收点击事件 */
.modal-dialog .modal-content {
    pointer-events: auto;
}

/* modal-lg 类 - 更大的模态框，使用更宽的智能宽度 */
.modal-dialog.modal-lg {
    /* 最小 90%，理想宽度更大 (75vw)，最大 1800px */
    width: clamp(90%, min(75vw, calc(100vw - 60px)), 1800px);
}

/* modal-xl 类 - 超大模态框 */
.modal-dialog.modal-xl {
    max-width: 90%;
}

@media (min-width: 992px) {
    .modal-dialog.modal-xl {
        max-width: 1400px;
    }
}

@media (min-width: 1200px) {
    .modal-dialog.modal-xl {
        max-width: 1600px;
    }
}

@media (min-width: 1400px) {
    .modal-dialog.modal-xl {
        max-width: 1700px;
    }
}

@media (min-width: 1600px) {
    .modal-dialog.modal-xl {
        max-width: 1800px;
    }
}

@media (min-width: 1920px) {
    .modal-dialog.modal-xl {
        max-width: 1900px;
    }
}

/* 模态框内容区域 - 统一精美样式 */
.modal-content {
    border: 1px solid rgba(102, 126, 234, 0.1);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12),
                0 8px 24px rgba(102, 126, 234, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
    width: 100%;
    background: linear-gradient(135deg, #ffffff 0%, #fafbff 100%);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 3rem);
    margin: auto;
    /* 确保模态框内容不受模糊影响 */
    filter: none;
    -webkit-filter: none;
    /* 确保可以正常交互 */
    pointer-events: auto;
}

@media (min-width: 576px) {
    .modal-content {
        max-height: calc(100vh - 7rem);
    }
}


/* 模态框头部 - 统一渐变背景 */
.modal-header {
    border-bottom: 1px solid rgba(102, 126, 234, 0.08);
    padding: 1.5rem 1.75rem;
    background: linear-gradient(135deg, #ffffff 0%, #fafbff 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    min-height: 60px;
}


/* 模态框标题 */
.modal-title {
    font-weight: 700;
    color: #1a202c;
    font-size: 1.25rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.01em;
    /* 确保文字清晰 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.modal-title i {
    color: #667eea;
    font-size: 1.1em;
}

/* 关闭按钮 - 隐藏 */
.modal-header .btn-close {
    display: none !important;
}

.modal-header .btn-close-white {
    display: none !important;
}

/* 模态框主体 - 统一渐变背景 */
.modal-body {
    padding: 1.75rem;
    background: linear-gradient(135deg, #ffffff 0%, #fafbff 100%);
    position: relative;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
    flex: 1 1 auto;
    /* 确保文字清晰 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* 美化内部布局 */
    line-height: 1.6;
}

/* 模态框内部表单元素美化 */
.modal-body .form-label {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-body .form-label i {
    color: #667eea;
    font-size: 0.875rem;
}

.modal-body .form-control,
.modal-body .form-select,
.modal-body textarea.form-control {
    border-radius: 12px;
    border: 2px solid rgba(102, 126, 234, 0.18);
    padding: 0.75rem 1.125rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    background: linear-gradient(135deg, #ffffff 0%, #fafbff 100%);
    color: #2d3748;
    box-shadow: 0 1px 3px rgba(102, 126, 234, 0.08);
    position: relative;
}

.modal-body .form-control:hover:not(:disabled):not([readonly]),
.modal-body .form-select:hover:not(:disabled) {
    border-color: rgba(102, 126, 234, 0.35);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.12);
    background: #ffffff;
}

.modal-body .form-control:focus,
.modal-body .form-select:focus,
.modal-body textarea.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.25rem rgba(102, 126, 234, 0.2),
                0 4px 12px rgba(102, 126, 234, 0.15);
    outline: none;
    background: #ffffff;
    transform: translateY(-1px);
}

.modal-body .form-control[readonly],
.modal-body .form-control:disabled,
.modal-body .form-select:disabled {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-color: rgba(102, 126, 234, 0.1);
    cursor: not-allowed;
    opacity: 0.7;
}

.modal-body textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.modal-body .mb-3,
.modal-body .form-group {
    margin-bottom: 1.25rem;
}

/* 表单多列布局 - 电脑端 */
@media (min-width: 768px) {
    .modal-body .row {
        margin-left: -0.75rem;
        margin-right: -0.75rem;
    }
    
    .modal-body .row > [class*="col-"] {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* 两列布局 */
    .modal-body .form-row-2 {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* 三列布局 */
    .modal-body .form-row-3 {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
}

/* 手机端强制单列 */
@media (max-width: 767.98px) {
    .modal-body .form-row-2,
    .modal-body .form-row-3 {
        display: block;
    }
    
    .modal-body .form-row-2 > *,
    .modal-body .form-row-3 > * {
        margin-bottom: 1rem;
    }
}

.modal-body .text-muted {
    color: #718096;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.modal-body .text-muted i {
    font-size: 0.75rem;
}

.modal-body hr {
    border: none;
    border-top: 2px solid rgba(102, 126, 234, 0.12);
    margin: 1.75rem 0;
    position: relative;
}

.modal-body hr::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, #667eea 0%, rgba(102, 126, 234, 0.3) 100%);
    border-radius: 2px;
}

/* 输入组美化 */
.modal-body .input-group {
    box-shadow: 0 1px 3px rgba(102, 126, 234, 0.08);
    border-radius: 12px;
    overflow: hidden;
}

.modal-body .input-group-text {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.06) 100%);
    border: 2px solid rgba(102, 126, 234, 0.18);
    border-right: none;
    color: #667eea;
    font-weight: 600;
    padding: 0.75rem 1rem;
}

.modal-body .input-group .form-control {
    border-left: none;
    box-shadow: none;
}

.modal-body .input-group:focus-within {
    box-shadow: 0 0 0 0.25rem rgba(102, 126, 234, 0.2),
                0 4px 12px rgba(102, 126, 234, 0.15);
}

.modal-body .input-group:focus-within .input-group-text {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(118, 75, 162, 0.1) 100%);
}

/* 复选框和单选框美化 */
.modal-body .form-check {
    padding-left: 2rem;
    margin-bottom: 0.75rem;
}

.modal-body .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    margin-top: 0.125rem;
    margin-left: -2rem;
}

.modal-body .form-check-input[type="radio"] {
    border-radius: 50%;
}

.modal-body .form-check-input:checked {
    background-color: #667eea;
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.modal-body .form-check-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.modal-body .form-check-label {
    font-weight: 500;
    color: #2d3748;
    cursor: pointer;
    margin-left: 0.5rem;
}

/* 自定义滚动条 */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #5568d3 0%, #5a3a7a 100%);
}

/* 模态框底部 - 按钮并排显示 */
.modal-footer {
    border-top: 1px solid rgba(102, 126, 234, 0.08);
    padding: 1.25rem 1.75rem;
    background: linear-gradient(135deg, #ffffff 0%, #fafbff 100%);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    position: relative;
    flex-wrap: nowrap;
    flex-shrink: 0;
    min-height: 70px;
}


/* 模态框底部按钮优化 - 并排显示 */
.modal-footer .btn {
    padding: 0.625rem 1.5rem;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 100px;
    max-width: none;
    flex: 0 0 auto;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    width: auto;
}

.modal-footer .btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.modal-footer .btn:hover::before {
    width: 300px;
    height: 300px;
}

.modal-footer .btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
}

.modal-footer .btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

.modal-footer .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-footer .btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #5a3a7a 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.modal-footer .btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.modal-footer .btn-success:hover {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(72, 187, 120, 0.4);
}

.modal-footer .btn-danger {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
}

.modal-footer .btn-danger:hover {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(245, 101, 101, 0.4);
}

/* 深色背景的模态框头部 */
.modal-header.bg-success,
.modal-header.bg-primary,
.modal-header.bg-danger {
    border-bottom: none;
    color: white;
}

.modal-header.bg-success {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
}

.modal-header.bg-primary {
    background: linear-gradient(135deg, #667eea 0%, #5568d3 100%);
}

.modal-header.bg-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.modal-header.bg-success .modal-title,
.modal-header.bg-primary .modal-title,
.modal-header.bg-danger .modal-title {
    color: white;
}

.modal-header.bg-success .modal-title i,
.modal-header.bg-primary .modal-title i,
.modal-header.bg-danger .modal-title i {
    color: rgba(255, 255, 255, 0.9);
}

/* 响应式优化 - 移动端 */
@media (max-width: 575.98px) {
    .modal {
        padding: 0.25rem !important;
    }
    
    .modal-dialog {
        max-width: calc(100% - 0.5rem);
        width: calc(100% - 0.5rem);
        margin: auto;
    }
    
    .modal-content {
        border-radius: 16px;
        max-height: calc(100vh - 0.5rem);
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1.25rem 1rem;
    }
    
    .modal-title {
        font-size: 1.1rem;
    }
    
    .modal-body {
        max-height: calc(100vh - 200px);
    }
    
    /* 移动端表单元素优化 */
    .modal-body .form-control,
    .modal-body .form-select {
        padding: 0.625rem 0.875rem;
        font-size: 0.9rem;
    }
    
    .modal-body .form-label {
        font-size: 0.9rem;
    }
    
    /* 移动端按钮并排显示 */
    .modal-footer {
        flex-wrap: nowrap;
        gap: 0.75rem;
        justify-content: flex-end;
    }
    
    .modal-footer .btn {
        flex: 0 0 auto;
        min-width: auto;
        max-width: none;
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
    }
    
    /* 如果只有一个按钮，仍然保持原样 */
    .modal-footer .btn:only-child {
        flex: 0 0 auto;
        min-width: auto;
        max-width: none;
    }
}

/* ==================== 导航栏样式 ==================== */
.navbar {
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0;
}


/* ==================== 侧边栏样式 ==================== */
.sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #fafbff 100%);
    height: calc(100vh - 70px);
    box-shadow: 4px 0 20px rgba(102, 126, 234, 0.08), 2px 0 8px rgba(0, 0, 0, 0.04);
    padding: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(102, 126, 234, 0.12);
    overflow: hidden;
}

/* 侧边栏头部 */
.sidebar-header {
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.03) 100%);
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
}

.sidebar-header h5 {
    color: #1a202c;
    font-weight: 700;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-header .btn-link {
    text-decoration: none;
    transition: all 0.3s ease;
    color: #64748b;
    border-radius: 8px;
    padding: 0.5rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header .btn-link:hover {
    transform: scale(1.1) rotate(90deg);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.08) 100%);
    color: #667eea;
}

/* 侧边栏菜单 */
.sidebar-menu {
    list-style: none;
    padding: 1.5rem 0.75rem;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-menu::-webkit-scrollbar {
    width: 6px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.2);
    border-radius: 3px;
}

.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.3);
}

.sidebar-menu li {
    margin-bottom: 0.5rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1.25rem;
    padding-right: 3rem; /* 为选中状态的指示点和加粗文字预留更多空间 */
    color: #4a5568;
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    font-weight: 500;
    font-size: 0.95rem;
    min-width: 0; /* 允许flex子元素缩小 */
    flex: 1; /* 允许文字部分占据剩余空间 */
    overflow: visible; /* 确保文字不被裁剪 */
}

/* 确保文字内容有足够空间 */
.sidebar-menu a > span {
    flex: 1 1 auto;
    min-width: 0;
    overflow: visible; /* 允许文字完整显示，特别是在加粗时 */
    text-overflow: clip; /* 不使用省略号，保持完整文字 */
    white-space: nowrap;
    display: block;
    /* 移除max-width限制，让文字自然显示 */
}

.sidebar-menu a:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.06) 100%);
    color: #667eea;
    transform: translateX(4px);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
}

.sidebar-menu a.active:hover {
    transform: translateX(0);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.14) 100%);
}

.sidebar-menu a.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.18) 0%, rgba(118, 75, 162, 0.12) 100%);
    color: #667eea;
    font-weight: 600; /* 改用600而不是700，避免某些字体加粗时笔画缺失 */
    box-shadow: 
        0 4px 16px rgba(102, 126, 234, 0.2); /* 移除inset阴影，可能影响文字渲染 */
    transform: none; /* 移除transform，可能影响文字渲染 */
    position: relative;
    padding-right: 3rem; /* 增加右侧内边距，确保加粗文字和指示点有足够空间 */
    overflow: visible; /* 允许指示点和文字完整显示 */
    /* 优化中文字体渲染 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /* 确保文字完整显示 */
    line-height: 1.5;
    letter-spacing: 0;
    /* 确保使用支持中文的字体 */
    font-family: 'Segoe UI', 'Microsoft YaHei', 'SimHei', 'SimSun', Tahoma, Geneva, Verdana, sans-serif;
}

/* 选中状态下文字也要有足够空间 */
.sidebar-menu a.active > span {
    flex: 1 1 auto;
    min-width: 0;
    overflow: visible; /* 允许加粗文字完整显示，不被裁剪 */
    text-overflow: clip; /* 不使用省略号，保持完整文字 */
    white-space: nowrap;
    display: block;
    /* 移除max-width限制，让文字自然显示 */
}

.sidebar-menu a.active::after {
    content: '';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.6);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
    50% {
        opacity: 0.7;
        transform: translateY(-50%) scale(1.2);
    }
}

.sidebar-menu a.active i {
    transform: scale(1.2);
    color: #667eea;
    filter: drop-shadow(0 2px 4px rgba(102, 126, 234, 0.3));
}

.sidebar-menu i {
    width: 22px;
    text-align: center;
    font-size: 1.15rem;
    transition: all 0.3s ease;
    color: #64748b;
}

.sidebar-menu a:hover i {
    transform: scale(1.1);
    color: #667eea;
}

/* 侧边栏底部 */
.sidebar-footer {
    flex-shrink: 0;
    margin-top: auto;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.03) 100%);
    border-top: 1px solid rgba(102, 126, 234, 0.1);
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

.sidebar-footer > div {
    padding: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.sidebar-footer .border-top {
    border-color: rgba(102, 126, 234, 0.1) !important;
    border-top: 1px solid rgba(102, 126, 234, 0.1) !important;
}

.sidebar-footer small {
    font-size: 0.7rem;
    color: #718096;
    transition: color 0.3s ease;
    display: block;
    line-height: 1.4;
}

.sidebar-footer .logo-z {
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
}

.sidebar-footer > div > div:first-child {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

/* ==================== 内容区域 ==================== */
.content-wrapper {
    padding: 2rem;
    min-height: calc(100vh - 70px);
}

/* 页面标题美化 - 统一标准样式 */
.page-header {
    position: relative;
    padding: 0.5rem 0 1.5rem 0;  /* 减小顶部内边距：从1.5rem改为0.5rem */
    margin-bottom: 2rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.page-header::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

.page-title {
    font-size: 2rem;
    font-weight: 600 !important; /* 改用600而不是700，避免某些字体加粗时笔画缺失 */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    color: transparent !important; /* 确保不使用普通颜色 */
    margin-bottom: 0.5rem;
    /* 优化中文字体渲染 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /* 确保使用支持中文的字体 */
    font-family: 'Segoe UI', 'Microsoft YaHei', 'SimHei', 'SimSun', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.5;
    letter-spacing: 0;
}

.page-subtitle {
    color: #718096 !important;
    font-size: 0.95rem;
    margin-bottom: 0;
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* ==================== 加载动画 ==================== */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* ==================== 工具类 ==================== */
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-hover {
    transition: box-shadow 0.2s;
}

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

.cursor-pointer {
    cursor: pointer;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 70px;
        left: 0; /* 保持在原位，用 transform 控制显示/隐藏 */
        width: 260px;
        height: calc(100vh - 70px);
        z-index: 100; /* 使用统一的 z-index */
        /* transform 和 transition 在后面统一定义 */
    }
    
    /* 移除旧的 ::before 遮罩层样式，改用独立的 .sidebar-overlay 元素 */
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    
    .content-wrapper {
        padding: 1rem;
    }
    
    .page-title {
        font-size: 1.5rem;
        /* 保持渐变效果 */
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        -webkit-background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
        background-clip: text !important;
        color: transparent !important;
    }
    
    .stat-card {
        margin-bottom: 1rem;
        height: auto; /* 移动端允许自适应高度 */
        min-height: 100px;
    }
    
    .navbar-toggler {
        display: inline-block;
    }
    
    .table-responsive {
        margin-left: 0;
        margin-right: 0;
        border-radius: 0; /* 移动端去掉圆角以适配边缘 */
        /* 确保可以完全滚动 */
        padding-left: 0;
        padding-right: 0;
        width: 100%;
        /* 允许内容超出容器以便完全滚动 */
        overflow-x: scroll;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 移动端表格容器调整 */
    .card-body.p-0 {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .card-body.p-0 .table-responsive {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
    }
    
    /* 确保表格可以滚动到最右边，但不要超出内容 */
    .table-responsive .table {
        width: auto;
        min-width: 100%; /* 最小宽度为容器宽度 */
        table-layout: auto; /* 自动布局 */
    }
    
    /* 确保表格列宽度根据内容自动调整 */
    .table-responsive .table th,
    .table-responsive .table td {
        white-space: nowrap; /* 防止内容换行 */
    }
    
    /* 确保表格的第一列和最后一列都可以看到 */
    .table-responsive {
        scroll-padding-left: 0;
        scroll-padding-right: 0;
    }
    
    /* 移动端表格滚动提示 */
    .table-responsive::after {
        display: block;
        text-align: center;
        padding: 0.5rem;
        font-size: 0.75rem;
        color: var(--text-muted);
        background: var(--light-color);
        border-top: 1px solid var(--border-color);
    }
    
    /* 如果表格已经滚动到最右边，隐藏提示 */
    .table-responsive.scrolled-end::after {
        display: none;
    }
    
    .table-actions {
        white-space: nowrap;
    }
    
    .table-actions .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
        margin: 0.125rem;
    }
    
    /* 移动端表格字体适当缩小 */
    .table {
        font-size: 0.875rem;
    }
    
    .table thead th {
        padding: 0.75rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .table tbody td {
        padding: 0.75rem 0.5rem;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .form-group, .mb-3 {
        margin-bottom: 1rem !important;
    }
}

/* 小屏幕优化 */
@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1rem;
    }
    
    .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .stat-card-value {
        font-size: 1.25rem;
    }
    
    .stat-card-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .form-control {
        font-size: 1rem; /* 防止iOS自动缩放 */
    }
}

/* ==================== 打印样式 ==================== */
@media print {
    .sidebar,
    .navbar,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .content-wrapper {
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}

/* ==================== 页脚样式 - 简化版 ==================== */
.site-footer {
    background: linear-gradient(135deg, rgba(247, 250, 252, 0.8) 0%, rgba(237, 242, 247, 0.6) 100%);
    color: #64748b;
    padding: 1.5rem 0;
    margin-top: 0;
    border-top: 1px solid rgba(102, 126, 234, 0.15);
    position: relative;
    z-index: 1;
    width: 100%;
}

.site-footer .container {
    max-width: 100%;
    padding-left: 2rem;
    padding-right: 2rem;
}

/* 确保页脚在所有页面正确显示 */
body > .site-footer {
    display: block;
    clear: both;
    margin-left: 260px;
    width: calc(100% - 260px);
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {
    body > .site-footer {
        margin-left: 0;
        width: 100%;
    }
}

.site-footer p {
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 0;
}

.site-footer strong {
    color: #1a202c;
    font-weight: 600;
}

.site-footer i {
    color: #667eea;
}

/* 移动端 footer 优化 */
@media (max-width: 576px) {
    .site-footer {
        padding: 1rem 0;
        font-size: 0.75rem;
    }
    
    .site-footer p {
        font-size: 0.75rem;
    }
    
    /* 移动端可能需要换行 */
    .site-footer .mx-2 {
        margin-left: 0.5rem !important;
        margin-right: 0.5rem !important;
    }
}

/* 登录注册页面的浮动 Footer */
.auth-page-footer {
    position: relative;
    margin-top: 2rem;
    text-align: center;
}

.auth-page-footer p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ==================== 改进的侧边栏和遮罩层 ==================== */
/* 侧边栏遮罩层 - 轻盈美观的半透明效果 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    /* 使用轻微的白色半透明，配合模糊效果 */
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(3px); /* 背景模糊效果 */
    -webkit-backdrop-filter: blur(3px); /* Safari 支持 */
    z-index: 99; /* 低于侧边栏的 100，这样侧边栏在遮罩层上面 */
    opacity: 0;
    transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
    cursor: pointer; /* 显示手型光标，提示可点击关闭 */
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* 降级方案：如果浏览器不支持 backdrop-filter，使用淡灰色遮罩 */
@supports not (backdrop-filter: blur(3px)) {
    .sidebar-overlay {
        background: rgba(0, 0, 0, 0.15);
    }
}

/* 优化侧边栏动画和阴影 */
.sidebar {
    /* 使用 transform 代替 left，性能更好，动画更流畅 */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    z-index: 100; /* 确保侧边栏在遮罩层上面 */
    /* 默认阴影 */
    box-shadow: 4px 0 20px rgba(102, 126, 234, 0.08), 2px 0 8px rgba(0, 0, 0, 0.04);
    /* 确保侧边栏始终有渐变背景 */
    background: linear-gradient(180deg, #ffffff 0%, #fafbff 100%) !important;
    /* 防止内容闪烁 */
    will-change: transform;
    backface-visibility: hidden;
    /* 确保侧边栏有固定高度，底部完整显示 */
    height: calc(100vh - 70px) !important;
    overflow: hidden;
}

/* 移动端侧边栏显示时，添加强阴影让它"浮"起来 */
@media (max-width: 768px) {
    /* 默认隐藏状态：移到左边 */
    .sidebar {
        transform: translateX(-100%);
    }
    
    /* 显示状态：移回原位 */
    .sidebar.show {
        transform: translateX(0);
        box-shadow: 8px 0 24px rgba(0, 0, 0, 0.15), 4px 0 12px rgba(0, 0, 0, 0.1);
    }
}

/* 固定定位的主内容区，防止侧边栏推动内容 */
.main-content {
    transition: margin-left 0.3s ease;
}

/* ==================== 导航栏优化 ==================== */
.navbar {
    height: 70px;
    display: flex;
    align-items: center;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* 确保导航栏容器使用flex-nowrap，防止元素换行 */
.navbar .container-fluid {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    height: 100%;
}

.navbar-brand {
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    max-width: calc(100vw - 200px); /* 预留空间给右侧菜单 */
    display: flex !important;
    align-items: center !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.navbar-brand > span:not(.logo-z) {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    vertical-align: middle;
}

/* 确保侧边栏按钮始终显示 */
#sidebarToggle {
    flex-shrink: 0 !important;
    min-width: 40px;
    height: 40px; /* 固定高度 */
}

/* 用户下拉菜单优化 */
.navbar .dropdown-menu {
    min-width: 240px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    margin-top: 0.5rem;
    position: absolute;
    z-index: 1050;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8);
    padding: 0.5rem 0;
    overflow: hidden;
}

.navbar .dropdown-header {
    background: transparent;
    padding: 1rem 1.25rem 0.75rem;
    font-weight: 600;
    color: #1a202c;
    font-size: 0.875rem;
    border-bottom: none;
    display: flex;
    align-items: center;
}

.navbar .dropdown-header i {
    color: #667eea;
    margin-right: 0.5rem;
    font-size: 1rem;
}

.navbar .dropdown-header strong {
    font-weight: 700;
    color: #1a202c;
}

.navbar .dropdown-item {
    padding: 0.625rem 1.25rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: #4a5568;
    font-weight: 500;
    font-size: 0.875rem;
    position: relative;
    display: flex;
    align-items: center;
    margin: 0.125rem 0.5rem;
    border-radius: 10px;
}

.navbar .dropdown-item:hover {
    background-color: #f7fafc;
    color: #667eea;
    transform: none;
    padding-left: 1.25rem;
}

.navbar .dropdown-item:hover i {
    transform: translateX(2px);
    color: #667eea;
}

.navbar .dropdown-item i {
    margin-right: 0.75rem;
    width: 18px;
    text-align: center;
    transition: all 0.25s ease;
    color: #64748b;
    font-size: 0.9rem;
}

.navbar .dropdown-item-text {
    padding: 0.625rem 1.25rem;
    margin: 0.125rem 0.5rem;
    color: #4a5568;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    border-radius: 10px;
}

.navbar .dropdown-item-text i {
    margin-right: 0.75rem;
    width: 18px;
    text-align: center;
    color: #f59e0b;
    font-size: 0.9rem;
}

.navbar .dropdown-item-text strong {
    color: #1a202c;
    font-weight: 600;
    margin-left: 0.25rem;
}

.navbar .dropdown-item.text-danger {
    color: #dc2626;
}

.navbar .dropdown-item.text-danger:hover {
    background-color: #fef2f2;
    color: #dc2626;
}

.navbar .dropdown-item.text-danger:hover i {
    color: #dc2626;
    transform: translateX(2px);
}

.navbar .dropdown-item.text-danger i {
    color: #dc2626;
}

.navbar .dropdown-divider {
    margin: 0.5rem 0;
    border-color: #e2e8f0;
    opacity: 1;
}

.navbar .dropdown-divider:first-of-type {
    margin-top: 0.75rem;
}

.navbar hr.dropdown-divider {
    margin: 0.5rem 0;
    border-color: #e2e8f0;
    opacity: 1;
}

/* 右侧导航区域 */
.navbar .navbar-nav {
    flex-shrink: 0;
}

/* 导航链接垂直居中优化 - 所有尺寸 */
.navbar .nav-link {
    display: flex !important;
    align-items: center !important;
    line-height: 1.5 !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    color: rgba(255, 255, 255, 0.9);
}

.navbar .nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.navbar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.navbar .nav-link:hover::before {
    opacity: 1;
}

.navbar .nav-link:hover i {
    transform: scale(1.1);
}

.navbar .nav-link i {
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.3s ease;
}

.navbar .nav-item {
    display: flex;
    align-items: center;
}

.navbar .dropdown-toggle {
    display: flex !important;
    align-items: center !important;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.navbar .dropdown-toggle::after {
    transition: transform 0.3s ease;
    margin-left: 0.5rem;
}

.navbar .dropdown-toggle:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.navbar .dropdown-toggle[aria-expanded="true"] {
    background-color: rgba(255, 255, 255, 0.2);
}

.navbar .dropdown-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

/* 侧边栏切换按钮美化 */
#sidebarToggle {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-decoration: none !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    border-radius: 12px;
    width: 40px;
    height: 40px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

#sidebarToggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#sidebarToggle:focus,
#sidebarToggle:active {
    text-decoration: none !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* 中等屏幕优化 (平板) */
@media (max-width: 768px) {
    .navbar .nav-link {
        padding: 0.5rem 0.75rem !important;
    }
    
    /* 移动端导航栏高度优化 */
    .navbar {
        height: 60px; /* 手机端稍微降低高度 */
    }
    
    /* 侧边栏位置调整 */
    .sidebar {
        top: 60px !important;
        height: calc(100vh - 60px) !important;
        overflow: hidden;
    }
    
    .sidebar-footer {
        padding: 0.75rem !important;
    }
    
    /* 遮罩层位置调整 */
    .sidebar-overlay {
        top: 60px !important;
    }
    
    /* 不需要为.main-content单独设置padding-top，因为body已经有了 */
    
    #sidebarToggle {
        height: 36px;
        width: 36px;
        min-width: 36px;
    }
}

/* 用户菜单按钮优化 - 移动端 */
@media (max-width: 576px) {
    .navbar-brand {
        max-width: calc(100vw - 150px); /* 小屏幕调整 */
        font-size: 0.95rem;
        line-height: 1.4;
    }
    
    /* 确保用户名和余额在小屏幕上适当显示 */
    .navbar .nav-link .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.4rem;
    }
    
    .navbar .nav-link {
        padding: 0.4rem 0.5rem !important; /* 小屏幕减少padding */
        font-size: 0.9rem;
    }
    
    /* Logo文字大小调整 */
    .logo-z {
        font-size: 20px;
        vertical-align: middle;
        line-height: 1;
    }
    
    .navbar-brand > span:not(.logo-z) {
        display: inline-flex;
        align-items: center;
        line-height: 1.5;
        vertical-align: middle;
    }
}

/* ==================== 深色模式支持 ==================== */
@media (prefers-color-scheme: dark) {
    /* 可以在这里添加深色模式样式 */
}

/* ==================== 动画效果 ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.3s ease-in-out;
}

/* ==================== 自定义滚动条 ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==================== Toast深度美化 ==================== */
.toast-container {
    width: auto !important;
    max-width: calc(100vw - 2rem);
    z-index: 10000 !important;
    /* 强制靠右对齐 */
    right: 1rem !important;
    left: auto !important;
    top: 1rem !important;
    bottom: auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    justify-content: flex-start !important;
    gap: 0.75rem;
}

.toast {
    width: auto !important;
    min-width: 200px !important;
    max-width: 500px;
    border-radius: 16px !important;
    border: none !important;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.15),
        0 4px 16px rgba(0, 0, 0, 0.1) !important;
    overflow: hidden;
    position: relative;
    animation: toast-slide-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: inline-block;
}

@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Toast 类型特定样式 */
.toast.bg-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: white !important;
}

.toast.bg-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: white !important;
}

.toast.bg-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: white !important;
}

.toast.bg-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    color: white !important;
}


/* Toast 内部布局 */
.toast .d-flex {
    flex-wrap: nowrap;
    align-items: center;
    gap: 0;
    width: 100%;
    position: relative;
    z-index: 1;
}

.toast-body {
    padding: 1rem 1.25rem !important;
    padding-right: 0.75rem !important;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    flex: 1;
    min-width: 0; /* 允许flex子元素缩小 */
    line-height: 1.6;
    font-weight: 500;
    font-size: 0.95rem;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    letter-spacing: 0.01em;
}

.toast-body i {
    font-size: 1.25rem;
    width: 24px;
    min-width: 24px; /* 确保图标宽度固定 */
    text-align: center;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
    opacity: 0.95;
}

/* Toast内容文本美化 */
.toast-body span {
    flex: 1;
    display: inline-block;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}


/* 关闭按钮美化 */
.toast .btn-close {
    flex-shrink: 0;
    padding: 0.5rem !important;
    margin: 0 0.75rem 0 0 !important;
    opacity: 0.9;
    transition: all 0.2s ease;
    border-radius: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast .btn-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.toast .btn-close-white {
    filter: brightness(0) invert(1);
}

/* Toast 进入和退出动画增强 */
.toast.showing {
    animation: toast-slide-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.hiding {
    animation: toast-slide-out 0.25s ease-in;
}

@keyframes toast-slide-out {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
}

/* 移动端Toast优化 - 确保靠右对齐 */
@media (max-width: 576px) {
    .toast-container {
        right: 0.75rem !important;
        left: auto !important;
        top: 0.75rem !important;
        max-width: calc(100vw - 1.5rem) !important;
    }
    
    .toast {
        min-width: 180px !important;
        max-width: calc(100vw - 1.5rem) !important;
        font-size: 0.875rem;
        border-radius: 14px !important;
        width: auto !important;
    }
    
    .toast-body {
        padding: 0.875rem 1rem !important;
        padding-right: 0.625rem !important;
        font-size: 0.875rem;
        line-height: 1.5;
    }
    
    .toast-body i {
        font-size: 1.1rem;
        width: 22px;
        min-width: 22px;
    }
    
    .toast .btn-close {
        width: 24px;
        height: 24px;
        padding: 0.375rem !important;
        margin: 0 0.625rem 0 0 !important;
    }
}


/* ==================== 侧边栏等级卡==================== */
.sidebar-level-card {
    padding: 1rem;
    margin: 1rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.15);
    transition: all 0.3s ease;
}

.sidebar-level-card:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border-color: rgba(102, 126, 234, 0.25);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.level-card-content {
    position: relative;
}
