/* --- 1. 字体与基础设置 --- */
@font-face {
    font-family: 'Rajdhani';
    src: url('../fonts/Rajdhani-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

:root {
    --bg-deep: #f0f4f8;
    --bg-panel: rgba(255, 255, 255, 0.9);
    --primary: #39c5bb;
    --accent: #ff7eb3;
    --success: #00b894;
    --text-main: #2d3436;
    --text-muted: #636e72;
    --font-ui: system-ui, -apple-system, "Microsoft YaHei", sans-serif;
    --font-tech: 'Rajdhani', sans-serif;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: var(--font-ui);
    overflow: hidden;
    position: relative;
    background-image: radial-gradient(circle at 10% 20%, rgba(255, 126, 179, 0.1), transparent 30%), radial-gradient(circle at 90% 80%, rgba(57, 197, 187, 0.15), transparent 30%);
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 8px; height: 8px; } 
::-webkit-scrollbar-track { background: #fff; }
::-webkit-scrollbar-thumb { background: #dfe6e9; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* 让背景色切换有丝滑淡入淡出效果 */
.transition-all {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* 通用工具类 */
.cursor-pointer { cursor: pointer; }
.text-primary { color: var(--primary) !important; }
.text-accent { color: var(--accent) !important; }

/* --- 2. 布局容器 --- */
.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
    height: 100vh;
}

#content {
    width: 100%;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: auto;
}

#main-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- 3. 侧边栏 --- */
#sidebar {
    min-width: 250px;
    max-width: 250px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.02);
}

#sidebar.active { margin-left: -250px; }

#sidebar .sidebar-header { padding: 35px 20px; text-align: center; }
#sidebar .sidebar-header h3 { font-family: var(--font-tech); font-weight: 800; color: #2d3436; letter-spacing: 2px; margin: 0; font-size: 2rem; }
#sidebar .sidebar-header .status-badge { display: inline-block; font-size: 12px; color: var(--success); background: rgba(0, 184, 148, 0.1); border: 1px solid var(--success); padding: 4px 12px; border-radius: 20px; margin-top: 10px; font-weight: bold; }

#sidebar ul.components { padding: 10px 15px; }
#sidebar ul li { margin-bottom: 5px; }
#sidebar ul li a { padding: 14px 20px; display: flex; align-items: center; font-size: 1rem; color: var(--text-muted); text-decoration: none; transition: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); border-radius: 12px; font-weight: 500; }
#sidebar ul li a:hover { color: var(--primary); background: rgba(57, 197, 187, 0.08); transform: translateX(5px) scale(1.02); }
#sidebar ul li.active > a { color: #fff; background: linear-gradient(45deg, var(--primary), #81ecec); box-shadow: 0 5px 15px rgba(57, 197, 187, 0.3); transform: translateX(5px); }
#sidebar ul li a i { margin-right: 15px; width: 24px; text-align: center; font-size: 1.1rem; }

/* --- 4. 顶部导航 --- */
.navbar {
    position: relative;
    z-index: 1050 !important;
    background: rgba(255, 255, 255, 0.8) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(15px);
    padding: 15px 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}
.dropdown-menu { z-index: 1051 !important; }

.btn-toggle-menu { color: var(--text-main); background: #fff; border: 1px solid #dfe6e9; transition: 0.3s; border-radius: 8px; }
.btn-toggle-menu:hover { transform: scale(1.1); color: var(--primary); border-color: var(--primary); }
.clock-display { font-family: var(--font-tech); font-size: 1.2rem; font-weight: 600; color: var(--text-main); }
#top-loader { height: 4px !important; background: var(--primary) !important; box-shadow: 0 2px 10px var(--primary); }

/* --- 5. 卡片与面板 --- */
.card {
    z-index: 1;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.card:hover { transform: translateY(-5px) scale(1.01); box-shadow: 0 20px 40px rgba(57, 197, 187, 0.15); border-color: rgba(57, 197, 187, 0.3); }

.card-header { background: #fff; border-bottom: 1px solid rgba(0, 0, 0, 0.03); color: var(--text-main); font-size: 1.05rem; font-weight: 700; padding: 20px 25px; display: flex; align-items: center; }
.card-body { padding: 25px; }

/* 仪表盘专用状态卡片 */
.status-card { position: relative; border-left: 5px solid var(--primary); cursor: pointer; }
.status-card:hover { transform: translateY(-5px); box-shadow: 0 15px 30px rgba(57, 197, 187, 0.15) !important; }
.status-card h2 { font-family: var(--font-tech); font-size: 3rem; font-weight: 700; margin: 0; color: #2d3436; }
.status-card .icon-bg { position: absolute; right: 25px; bottom: 15px; font-size: 4rem; opacity: 0.1; transform: rotate(-10deg); color: var(--text-main); }

/* --- 6. 表格与列表 --- */
.table { color: var(--text-main); border-color: #f1f2f6; }
.table > :not(caption) > * > * { border-bottom-width: 1px; border-color: #f1f2f6; padding: 15px 10px; }

/* 表格交互效果 */
.table-hover tbody tr { transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); border-left: 3px solid transparent; }
body:not(.modal-open) .table-hover tbody tr:hover { background-color: #e8fcfb !important; box-shadow: inset 3px 0 0 var(--primary) !important; transform: none !important; z-index: auto !important; position: static !important; }
/* 弹窗内表格复原 */
.modal .table-hover tbody tr:hover { box-shadow: none !important; background-color: rgba(0, 0, 0, 0.02) !important; border-left-color: transparent; }

.table thead th { border-bottom: 2px solid #e1e1e1; color: var(--text-muted); font-weight: 600; background: #fdfdfd; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px; }
.table td { vertical-align: middle; font-size: 0.95rem; }

/* --- 7. 按钮与徽章 --- */
.badge { font-weight: 600; padding: 6px 12px; border-radius: 8px; letter-spacing: 0.5px; border: 1px solid transparent; background: transparent !important; }
.bg-success { color: var(--success); background: rgba(0, 184, 148, 0.1) !important; border-color: rgba(0, 184, 148, 0.2); }
.bg-danger { color: var(--accent); background: rgba(255, 118, 117, 0.1) !important; border-color: rgba(255, 118, 117, 0.2); }
.bg-secondary { color: var(--text-muted); background: #dfe6e9 !important; }
.bg-primary { color: var(--primary); background: rgba(57, 197, 187, 0.1) !important; border-color: rgba(57, 197, 187, 0.2); }
.bg-light { color: #636e72; background: #f5f6fa !important; border-color: #dcdde1; }

.btn { border-radius: 10px; font-weight: 600; transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); position: relative; overflow: hidden; font-size: 0.9rem; border: none; padding: 8px 16px; }
.btn:hover { transform: translateY(-3px) scale(1.05); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn-primary { background: linear-gradient(45deg, #39c5bb, #0fb9b1); color: #fff; box-shadow: 0 4px 15px rgba(57, 197, 187, 0.4); }
.btn-danger { background: linear-gradient(45deg, #ff7eb3, #ff4757); color: #fff; box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4); }
.btn-success { background: linear-gradient(45deg, #55efc4, #00b894); color: #fff; box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4); }
.btn-warning { background: linear-gradient(45deg, #ffeaa7, #fdcb6e); color: #636e72; }
.btn-outline-secondary { color: var(--text-muted); background: #f1f2f6; }
.btn-outline-secondary:hover { background: #dfe4ea; color: #2d3436; }
.btn-group-toggle .btn.active { background: linear-gradient(45deg, #39c5bb, #0fb9b1); color: #fff; border: none; }

/* --- 8. 表单组件 --- */
.form-control, .form-select {
    background: #f8f9fa; border: 2px solid #e9ecef; color: #2d3436;
    border-radius: 10px; padding: 10px 15px; font-weight: 500; transition: all 0.2s;
}
.form-control:focus, .form-select:focus {
    background: #fff; border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(57, 197, 187, 0.15); transform: translateY(-2px);
}
::placeholder { color: #b2bec3; }

/* 修复浏览器自动填充背景色 */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, input:-webkit-autofill:active {
    -webkit-transition-delay: 99999s; -webkit-transition: background-color 99999s ease-out;
}

/* --- 9. 弹窗与遮罩 --- */
.modal-backdrop { z-index: 1060 !important; }
.modal { z-index: 1070 !important; }
.modal-content { background: #fff; border: none; border-radius: 20px; box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15); }
.modal-header { border-bottom: 1px solid #f1f2f6; padding: 20px 30px; }
.modal-body { padding: 30px; }
.modal-footer { border-top: 1px solid #f1f2f6; padding: 20px 30px; }

/* --- 9.1 全局弹窗动效（可复用） --- */
:root {
    --app-modal-duration: 220ms;
    --app-modal-backdrop-duration: 180ms;
    --app-modal-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --app-modal-offset-y: 14px;
    --app-modal-scale-from: 0.985;
    --app-layer-duration: 220ms;
    --app-layer-backdrop-duration: 180ms;
    --app-layer-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --app-layer-offset-y: 16px;
    --app-layer-scale-from: 0.985;
}

.modal.app-modal-animate .modal-dialog {
    transform: translateY(var(--app-modal-offset-y)) scale(var(--app-modal-scale-from));
    opacity: 0;
    transition:
        transform var(--app-modal-duration) var(--app-modal-ease),
        opacity var(--app-modal-duration) ease;
    will-change: transform, opacity;
}

.modal.app-modal-animate.show .modal-dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal.app-modal-animate.app-modal-closing .modal-dialog {
    transform: translateY(calc(var(--app-modal-offset-y) * 0.6)) scale(0.992);
    opacity: 0;
}

.modal.app-modal-animate .modal-content {
    transition: box-shadow var(--app-modal-duration) ease;
}

.modal-backdrop {
    transition: opacity var(--app-modal-backdrop-duration) ease !important;
}

@media (prefers-reduced-motion: reduce) {
    .modal.app-modal-animate .modal-dialog,
    .modal.app-modal-animate .modal-content,
    .modal-backdrop {
        transition: none !important;
    }
}

/* --- 9.2 全局浮层窗口动效（可复用） --- */
.app-layer-motion {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity var(--app-layer-backdrop-duration) ease,
        visibility 0s linear var(--app-layer-backdrop-duration);
}

.app-layer-motion.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition:
        opacity var(--app-layer-backdrop-duration) ease,
        visibility 0s linear 0s;
}

.app-layer-motion .app-layer-motion-window {
    transform: translateY(var(--app-layer-offset-y)) scale(var(--app-layer-scale-from));
    opacity: 0;
    transition:
        transform var(--app-layer-duration) var(--app-layer-ease),
        opacity var(--app-layer-duration) ease;
    will-change: transform, opacity;
}

.app-layer-motion.show .app-layer-motion-window {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.app-layer-motion.app-layer-closing {
    pointer-events: none;
}

.app-layer-motion.app-layer-closing .app-layer-motion-window {
    transform: translateY(calc(var(--app-layer-offset-y) * 0.5)) scale(0.992);
    opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
    .app-layer-motion,
    .app-layer-motion .app-layer-motion-window {
        transition: none !important;
    }
}

/* --- 9.5 浮层窗口通用控制 --- */
.app-window-controls {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.app-window-icon-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    cursor: pointer;
    transition: all 0.18s ease;
}

.app-window-icon-btn:hover {
    background: #eef2ff;
    color: #334155;
}

.app-window-icon-btn.is-active {
    background: #e0f2fe;
    color: #0369a1;
}

.app-window-fullscreen {
    width: 96vw !important;
    height: 94vh !important;
    max-width: 96vw !important;
    max-height: 94vh !important;
}

@media (max-width: 768px) {
    .app-window-fullscreen {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }
}

/* --- 10. 底部批量操作栏 --- */
.batch-bar {
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid #f1f2f6;
    backdrop-filter: blur(20px);
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.05);
    position: fixed; bottom: 0; left: 250px; right: 0;
    padding: 15px 40px; display: none; z-index: 999;
    transition: left 0.4s;
}

/* --- 11. 特殊组件 --- */
.real-device-tag { background-color: #f8f9fa; border: 1px solid #dee2e6; border-radius: 6px; padding: 2px 8px; font-size: 0.75rem; color: #6c757d; display: inline-flex; align-items: center; max-width: 100%; margin-top: 4px; font-weight: 600; }
.real-device-tag i { color: #ffc107; margin-right: 5px; }

.chart-donut { width: 120px; height: 120px; border-radius: 50%; background: conic-gradient(var(--primary) calc(var(--pct)*1%), #f1f2f6 0); position: relative; display: flex; justify-content: center; align-items: center; margin: 0 auto; transition: all 1s ease-out; }
.chart-donut::after { content: attr(data-pct)"%"; position: absolute; width: 80%; height: 80%; background: #fff; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-weight: 800; color: var(--text-main); font-family: var(--font-tech); font-size: 1.5rem; }

.log-timeline { list-style: none; padding: 0; margin: 0; }
.log-timeline li { padding-left: 20px; position: relative; padding-bottom: 20px; border-left: 2px solid #f1f2f6; }
.log-timeline li::before { content: ""; position: absolute; left: -6px; top: 0; width: 10px; height: 10px; border-radius: 50%; background: #dfe6e9; border: 2px solid #fff; box-shadow: 0 0 0 2px #f1f2f6; }
.log-timeline li:first-child::before { background: var(--primary); box-shadow: 0 0 0 3px rgba(57, 197, 187, 0.2); }
.log-timeline li:last-child { border-left: transparent; }
.log-timeline li > div { transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1); border: 1px solid transparent; }
.log-timeline li:hover > div { background-color: #fff; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(57, 197, 187, 0.05); transform: translateX(5px) scale(1.01); border-color: rgba(57, 197, 187, 0.2); z-index: 10; position: relative; }

.progress-thin { height: 6px; border-radius: 3px; background-color: #f1f2f6; }

/* 选项卡交互优化 */
.nav-tabs .nav-link { border: none; border-bottom: 3px solid transparent; color: #636e72; margin-bottom: -1px; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); border-radius: 8px 8px 0 0; }
.nav-tabs .nav-link:not(.active):hover { color: var(--primary); background-color: rgba(57, 197, 187, 0.08) !important; border-bottom-color: rgba(57, 197, 187, 0.4); transform: translateY(-2px) scale(1.02); }
.nav-tabs .nav-link.active { color: var(--primary) !important; background-color: transparent !important; border-bottom-color: var(--primary) !important; font-weight: 800; }
.nav-pills .nav-link { transition: all 0.2s; border: 1px solid transparent; }
.nav-pills .nav-link:not(.active):hover { background-color: #e9ecef !important; color: #2d3436 !important; transform: translateY(-1px); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); }

/* 日期选择器 */
input[type="date"] { transition: all 0.2s ease; cursor: pointer; }
input[type="date"]:hover { background-color: rgba(57, 197, 187, 0.08) !important; color: var(--primary) !important; box-shadow: 0 4px 12px rgba(57, 197, 187, 0.15) !important; transform: translateY(-1px); }
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; border-radius: 50%; padding: 5px; transition: all 0.2s ease; filter: invert(0.4); }
input[type="date"]::-webkit-calendar-picker-indicator:hover { background-color: rgba(57, 197, 187, 0.2); transform: scale(1.2); filter: invert(0); }

/* --- 代码/回执显示框通用样式 --- */
.code-box {
    font-family: 'Consolas', monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-all;
    resize: none;
}

/* --- 12. 移动端适配 --- */
@media (max-width: 768px) {
    #sidebar { margin-left: -250px; position: fixed; height: 100%; box-shadow: 5px 0 30px rgba(0, 0, 0, 0.1); }
    #sidebar.active { margin-left: 0; }
    .batch-bar { left: 0; }
    #sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.5); z-index: 90; backdrop-filter: blur(2px); }
    #sidebar.active + #sidebar-overlay { display: block; }
}

/* --- 13. 全局浮动通知 --- */
.alert-success.animate-toast {
    position: fixed !important; top: 25px; left: 50%; transform: translate(-50%, -100px) !important;
    opacity: 0; z-index: 999999 !important; display: inline-flex !important;
    align-items: center; justify-content: center; width: auto !important; min-width: 280px;
    padding: 12px 25px !important; background: rgba(44, 181, 171, 0.95) !important;
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    color: #fff !important; border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.4s ease !important;
}
.alert-success.animate-toast.show { transform: translate(-50%, 0) !important; opacity: 1; }

/* =========================================
   14. 移动端深度优化 (Mobile Optimization)
   放在文件最后，确保覆盖前面的样式
   ========================================= */
@media (max-width: 768px) {
    /* --- 1. 布局调整 --- */
    #content {
        width: 100vw; /* 强制占满宽度 */
        overflow-x: hidden; /* 禁止横向滚动 */
    }
    
    #main-content {
        padding: 15px !important; /* 缩小内边距，给内容腾地儿 */
    }

    /* --- 2. 侧边栏 (抽屉式交互) --- */
    #sidebar {
        margin-left: -260px; /* 默认隐藏 */
        position: fixed;
        height: 100%;
        top: 0;
        left: 0;
        z-index: 1050; /* 必须高于主要内容 */
        box-shadow: 5px 0 15px rgba(0,0,0,0.2);
    }
    #sidebar.active {
        margin-left: 0; /* 激活时滑出 */
    }
    
    /* 遮罩层 (点击空白关闭菜单) */
    #sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1040; /* 在侧边栏之下，内容之上 */
        backdrop-filter: blur(3px);
    }
    #sidebar.active + #sidebar-overlay {
        display: block; /* 侧边栏出现时，遮罩层也出现 */
    }

    /* --- 3. 顶部导航栏 --- */
    .navbar {
        padding: 10px 15px !important; /* 减小导航栏高度 */
    }
    .clock-display {
        display: none !important; /* 手机端隐藏时间，太占地 */
    }
    .user-status .dropdown-menu {
        position: absolute !important; /* 修复下拉菜单错位 */
        right: 0;
        left: auto;
    }

    /* --- 4. 表格优化 (关键) --- */
    /* 强制表格容器横向滚动，防止撑破页面 */
    .table-responsive {
        border: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* 顺滑滚动 */
    }
    
    /* 隐藏次要列 (根据需要选择性隐藏) */
    /* 例如：在手机上隐藏 "绑定时间"、"备注" 等不紧急的列 */
    /* 你可以在 HTML 表格对应的 th/td 上加 class="d-none d-md-table-cell" */

    /* 缩小表格字号 */
    .table td, .table th {
        font-size: 13px !important;
        padding: 10px 5px !important; /* 减小单元格间距 */
        white-space: nowrap; /* 强制文字不换行，保持整齐，允许横向滚动 */
    }

    /* --- 5. 卡片与间距 --- */
    .card {
        margin-bottom: 15px !important; /* 减小卡片间距 */
    }
    .card-body {
        padding: 15px !important; /* 减小卡片内部留白 */
    }
    
    /* 仪表盘统计数字变小一点 */
    .status-card h2 {
        font-size: 2.2rem !important;
    }

    /* --- 6. 底部批量操作栏 --- */
    .batch-bar {
        left: 0 !important; /* 强制贴左 */
        padding: 10px 15px !important; /* 缩小内边距 */
        flex-direction: column; /* 上下排列 */
        gap: 10px;
        align-items: flex-start !important;
    }
    .batch-bar > div {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    /* 调整批量操作按钮的大小 */
    .batch-bar .btn {
        font-size: 12px;
        padding: 5px 10px;
    }

    /* --- 7. 弹窗 (Modal) --- */
    .modal-dialog {
        margin: 10px !important; /* 让弹窗几乎占满屏幕 */
    }

    /* --- 8. 邀请码表格特别优化 (新增) --- */
    /* 缩小输入框字体，确保能显示更多内容 */
    .code-input-mobile {
        font-size: 12px !important;
        padding: 5px 2px !important; /* 极小的内边距 */
        letter-spacing: -0.5px; /* 稍微紧凑一点 */
    }
    
    /* 调整输入框组合的高度 */
    .input-group-sm > .form-control,
    .input-group-sm > .btn {
        min-height: 28px;
        height: 28px;
    }
    
    /* 强制表格列宽度，防止被挤压 */
    /* 邀请码列 */
    .table td:nth-child(2) { 
        width: 50% !important; 
        min-width: 140px; 
    }
    
    /* 状态列 */
    .table td:nth-child(3) {
        width: 60px;
    }
    
    /* 操作列 */
    .table td:last-child {
        width: 50px;
    }
}

/* =========================================
   15. 密码强度校验反馈 (Password Feedback)
   优化：适配白底卡片，增加醒目的背景色
   ========================================= */

/* 基础容器 */
.pwd-feedback {
    font-size: 13px;
    font-weight: 700; /* 加粗文字 */
    margin-top: 8px;
    min-height: 28px; /* 预留高度防止抖动 */
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    transition: all 0.3s ease;
    opacity: 0; /* 默认隐藏 */
}

/* --- 错误状态 (醒目红) --- */
.pwd-feedback.error {
    opacity: 1;
    color: #d63031;               /* 深红色文字 */
    background-color: #ff767520;  /* 浅红色背景 (20%透明度) */
    border-left: 3px solid #d63031; /* 左侧加一道深红竖线增强提示 */
    animation: shake 0.4s ease-in-out; /* 错误时轻微抖动一下 */
}

/* --- 成功状态 (放心绿) --- */
.pwd-feedback.success {
    opacity: 1;
    color: #00b894;               /* 青绿色文字 */
    background-color: #55efc420;  /* 浅绿色背景 (20%透明度) */
    border-left: 3px solid #00b894; /* 左侧加一道绿竖线 */
}

/* --- 输入框边框颜色增强 --- */
.form-control.is-invalid {
    border-color: #ff7675 !important;
    background-image: none !important; /* 去掉Bootstrap默认的红叉图标，保持界面清爽 */
    box-shadow: 0 0 0 3px rgba(255, 118, 117, 0.2) !important;
}

.form-control.is-valid {
    border-color: #55efc4 !important;
    background-image: none !important;
    box-shadow: 0 0 0 3px rgba(85, 239, 196, 0.2) !important;
}

/* 错误抖动动画 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* =========================================
   16. 实时审计列表视觉优化 (Audit Log Visuals)
   解决悬停反馈不明显和形状生硬的问题
   ========================================= */

/* 1. 基础状态 (未悬停) */
.log-timeline li > div {
    /* 【形状优化】增加圆角，消除生硬感 */
    border-radius: 12px;
    
    /* 【布局优化】增加内边距，给悬停背景色留出呼吸空间 */
    padding: 10px 15px;
    
    /* 【位置修正】因为加了padding，为了保持文字和左侧圆点对齐，需要向左拉回一点 */
    margin-left: -15px; 
    margin-right: -5px;
    
    /* 预设透明属性，确保过渡平滑 */
    border: 1px solid transparent;
    background-color: transparent;
    
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); /* 有弹性的过渡动画 */
}

/* 2. 悬停状态 (鼠标移上去) */
.log-timeline li:hover > div {
    /* 【颜色反馈】使用淡青色背景 (Opacity 8%)，比纯白更明显 */
    background-color: rgba(57, 197, 187, 0.08) !important;
    
    /* 【边框反馈】边框颜色加深 */
    border-color: rgba(57, 197, 187, 0.3) !important;
    
    /* 【立体感】投影带上主题色，产生发光感 */
    box-shadow: 0 8px 20px rgba(57, 197, 187, 0.15) !important;
    
    /* 【动效】向右浮动 + 微微放大 */
    transform: translateX(8px) scale(1.01);
    
    /* 确保层级在最上 */
    z-index: 10;
    position: relative;
    
    /* 鼠标手型 */
    cursor: default; 
}

/* (可选) 针对里面图标的微调，让它悬停时也动一下 */
.log-timeline li:hover .rounded-circle {
    transform: scale(1.1) rotate(10deg);
    transition: transform 0.3s ease;
    box-shadow: 0 0 10px rgba(57, 197, 187, 0.3);
}

/* =========================================
   17. 表格卡片化与悬浮动效 (Floating Table Cards)
   ========================================= */

.table {
    border-collapse: separate !important;
    border-spacing: 0 12px !important;
    margin-top: -10px;
    width: 100%;
}

.table-responsive {
    padding: 5px 15px 5px 5px;
    overflow-x: visible !important;
}
@media (max-width: 768px) {
    .table-responsive {
        padding-right: 5px;
        overflow-x: auto !important;
    }
}

.table > :not(caption) > * > * {
    border-width: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
.table thead th {
    border-bottom: 0 !important;
    padding-bottom: 5px;
    padding-left: 15px;
    color: var(--text-muted);
    font-size: 0.85rem;
    opacity: 0.8;
}

.table tbody tr {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    border-radius: 12px;
}

/* --- 🎨 核心修改：卡片单元格颜色 --- */
.table tbody td {
    /* 使用极淡的冷灰色，区别于纯白背景 */
    background-color: #fcfdfe !important; 
    
    /* 增加上下边框 */
    border-top: 1px solid #eef2f6 !important;
    border-bottom: 1px solid #eef2f6 !important;
    
    padding: 18px 10px;
    vertical-align: middle;
}

/* 修复圆角和左右边框 */
.table tbody tr td:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    border-left: 1px solid #eef2f6 !important; /* 左边框 */
    padding-left: 20px;
}
.table tbody tr td:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    border-right: 1px solid #eef2f6 !important; /* 右边框 */
    padding-right: 20px;
}

/* 初始状态阴影 (加深一点点) */
.table tbody tr td {
    box-shadow: 0 2px 6px rgba(0,0,0,0.03); 
}

/* --- 交互效果 --- */
body:not(.modal-open) .table-hover tbody tr:hover {
    transform: translateX(10px) !important;
    z-index: 10;
    position: relative;
}

/* 悬停时变色：变成淡青色背景，边框变深色 */
body:not(.modal-open) .table-hover tbody tr:hover td {
    background-color: #f0fdfd !important; /* 悬停变淡青色 */
    border-color: rgba(57, 197, 187, 0.2) !important; /* 边框变青色 */
    box-shadow: 0 8px 25px rgba(57, 197, 187, 0.15), 0 5px 10px rgba(0,0,0,0.05);
}

body:not(.modal-open) .table-hover tbody tr:hover td:first-child {
    box-shadow: inset 4px 0 0 var(--primary), 0 8px 25px rgba(57, 197, 187, 0.15);
}

@media (max-width: 768px) {
    body:not(.modal-open) .table-hover tbody tr:hover {
        transform: none !important;
    }
}

/* =========================================
   18. 仪表盘交互增强 (Dashboard Interactions)
   针对：圆环图 & 跳转链接
   ========================================= */

/* --- A. 圆环图 (Donut Chart) 悬停特效 --- */
.chart-donut {
    /* 增加鼠标手型，提示可交互 */
    cursor: pointer;
    /* 确保过渡动画丝滑 (利用贝塞尔曲线制造弹性感) */
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chart-donut:hover {
    /* 1. 整体放大 10% */
    transform: scale(1.1);
    
    /* 2. 增加底部投影，制造悬浮立体感 */
    box-shadow: 0 15px 35px rgba(57, 197, 187, 0.25);
}

/* 悬停时，中间的百分比文字变色 */
.chart-donut:hover::after {
    color: var(--primary); /* 变成主题青色 */
    transition: color 0.3s ease;
}


/* --- B. "更多 ->" 链接 (More Link) 悬停特效 --- */
.hover-arrow-link {
    display: inline-block; /* 必须是块级或行内块才能应用 transform */
    transition: all 0.3s ease;
    position: relative;
}

.hover-arrow-link:hover {
    /* 1. 颜色变亮 */
    color: var(--primary) !important;
    text-shadow: 0 0 8px rgba(57, 197, 187, 0.4);
    
    /* 2. 向右平移 5px (产生引导点击的感觉) */
    transform: translateX(5px);
}

/* --- 快速生成卡密模块样式优化 --- */

/* 1. 分段控制器 (Segmented Control) */
.nav-segment .btn {
    border: none;
    color: #636e72;
    background: transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-segment .btn.active-segment {
    background-color: #fff;
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.nav-segment .btn:hover:not(.active-segment) {
    color: var(--text-main);
}

/* 2. 输入框组优化 (Input Merge) */
/* 移除默认边框，使用阴影代替，看起来更干净 */
.input-group-merge {
    background-color: #fff;
    border: 1px solid rgba(0,0,0,0.05); /* 极淡的边框 */
    transition: all 0.2s;
}

.input-group-merge:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(57, 197, 187, 0.15) !important;
    transform: translateY(-1px);
}

/* 3. 浮动标签输入框优化 */
.form-floating > .form-control {
    border-radius: 12px;
    box-shadow: none !important; /* 移除默认阴影，使用背景色 */
}
.form-floating > .form-control:focus {
    background-color: #fff !important; /* 聚焦变白 */
    box-shadow: 0 0 0 4px rgba(57, 197, 187, 0.15) !important;
}

/* 4. 按钮悬浮动效 */
.hover-scale {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hover-scale:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 10px 25px rgba(57, 197, 187, 0.4) !important;
}

/* =========================================
   19. 全局浮动通知样式 (Toast)
   ========================================= */
.alert-success.animate-toast {
    position: fixed !important;
    top: 25px;
    left: 50%;
    transform: translate(-50%, -100px) !important; /* 默认隐藏在顶部 */
    opacity: 0;
    z-index: 999999 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: auto !important;
    min-width: 280px;
    padding: 12px 25px !important;
    background: rgba(44, 181, 171, 0.95) !important; /* 主题青色 */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: #fff !important;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.4s ease !important;
}

/* 显示状态 */
.alert-success.animate-toast.show {
    transform: translate(-50%, 0) !important;
    opacity: 1;
}

/* 警告类型的颜色覆盖 (可选) */
.alert.alert-warning {
    background: rgba(255, 159, 67, 0.95) !important; /* 橙色 */
}
.alert.alert-danger {
    background: rgba(238, 82, 83, 0.95) !important; /* 红色 */
}

/* =========================================
   20. 后台卡片内 错误提示样式优化 (新增)
   覆盖 Bootstrap 默认样式，使其更柔和精致
   ========================================= */

/* 针对 .card-body 内的 alert-danger (如个人中心报错) */
.card-body .alert-danger {
    /* 1. 背景：极淡的红色/粉色背景，干净清爽 */
    background-color: #fff0f3 !important; /* 接近你的 --bg-deep 但偏红 */

    /* 2. 边框：柔和的粉红边框 */
    border: 1px solid #ffc9c9 !important;

    /* 3. 文字：使用柔和的深红色，保证可读性又不刺眼 */
    color: #ff6b6b !important;

    /* 4. 视觉：圆角与阴影 */
    border-radius: 10px !important;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.08) !important;
    
    /* 5. 排版 */
    font-size: 0.9rem;
    font-weight: 600; /* 加粗文字 */
    padding: 12px 20px;
    display: flex;
    align-items: center;
}

/* 修正图标颜色，使其比文字稍浅，增加层次感 */
.card-body .alert-danger i {
    color: #ff8787 !important;
    margin-right: 8px; /* 确保图标和文字有间距 */
    font-size: 1.1em;
}

/* 如果有链接，也调整颜色 */
.card-body .alert-danger a {
    color: #e03131 !important;
    text-decoration: underline;
}

/* =========================================
   21. BOGE LOGO 悬停特效 (Zoom & Glow)
   ========================================= */

/* 1. 基础过渡 */
#sidebar .sidebar-header h3 {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s;
    transform-origin: center center;
    display: inline-block;
    /* 预设透明边框防止裁切时抖动 */
    border: 1px solid transparent; 
}

/* 2. 悬停状态 */
#sidebar .sidebar-header:hover h3 {
    /* 放大 */
    transform: scale(1.12);
    
    /* 【核心】文字渐变色：从主题青渐变到深海蓝 */
    background: linear-gradient(135deg, #39c5bb 0%, #2d98da 100%);
    
    /* 标准写法 + Webkit兼容写法：将背景裁切到文字上 */
    -webkit-background-clip: text;
    background-clip: text;
    
    /* 将文字本身设为透明，从而漏出背景的渐变色 */
    color: transparent;
    
    /* 【投影】使用 drop-shadow 替代 text-shadow，效果更细腻 */
    filter: drop-shadow(0 4px 12px rgba(45, 152, 218, 0.3));
    
    cursor: pointer;
}

/* 3. 修正右上角 R 标的颜色 (设为渐变尾色) */
#sidebar .sidebar-header:hover h3 span {
    color: #2d98da; 
    text-shadow: none;
}

/* =========================================
   22. 顶部用户信息区：卷帘门式联动交互 (Roller Shutter)
   包含：下拉卷帘动画、收起回弹、全状态保持
   ========================================= */

/* --- A. 下拉菜单容器：卷帘门核心动画 --- */

/* 1. 菜单基础状态 (卷起/隐藏) */
.user-status .dropdown-menu {
    display: block !important; /* 强制覆盖 Bootstrap */
    
    /* --- 核心动画属性 --- */
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    
    /* --- 📍 新增：居中对齐关键代码 --- */
    left: 50% !important;           /* 左侧移动到父容器中心 */
    right: auto !important;         /* 清除右侧定位干扰 */
    transform: translateX(-50%);    /* 向回移动自身宽度的50%，实现完美居中 */
    width: max-content;             /* 宽度根据内容自适应，防止被压缩 */
    min-width: 100%;                /* 至少和上面按钮一样宽 */
    text-align: center;             /* (可选) 让菜单内部文字也居中 */

    /* --- 视觉微调 --- */
    margin-top: 0 !important;       /* 紧贴按钮下沿 */
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    
    /* --- 动画配置 --- */
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    
    /* --- 阴影边框 --- */
    border: 1px solid rgba(0,0,0,0.05);
    border-top: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* 2. 菜单激活状态 (放下卷帘) */
.user-status .dropdown:hover .dropdown-menu {
    /* 核心 3：设置一个足够大的最大高度，实现展开 */
    max-height: 300px; /* 根据菜单内容多少调整，300px通常足够 */
    opacity: 1;
}

/* 3. "隐形桥" (防止鼠标从按钮移向菜单时，经过空隙导致菜单消失) */
.user-status .dropdown-menu::before {
    content: "";
    position: absolute;
    top: -20px; /* 向上延伸，覆盖按钮下半部分 */
    left: 0;
    width: 100%;
    height: 20px;
    background: transparent;
    z-index: 1;
}


/* --- B. 触发按钮容器 (Trigger) --- */

.user-status .dropdown-toggle {
    padding: 6px 12px;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid transparent; 
    position: relative;
    z-index: 1052; /* 确保按钮在菜单之上 */
}


/* --- C. 内部元素联动 (保持高亮状态) --- */

/* 1. 用户名 (lxr) */
.user-status .dropdown-toggle span.fw-bold {
    transition: all 0.3s ease;
    display: inline-block;
}

.user-status .dropdown:hover .dropdown-toggle span.fw-bold {
    color: var(--primary) !important;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 10px rgba(57, 197, 187, 0.4);
}

/* 2. 徽章 (超级管理员) */
.user-status .dropdown-toggle .badge {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.user-status .dropdown:hover .dropdown-toggle .badge {
    transform: translateY(-2px) scale(1.1); /* 保持放大 */
}

/* 红色徽章专属状态 */
.user-status .dropdown:hover .dropdown-toggle .badge.bg-danger {
    background-color: rgba(255, 118, 117, 0.2) !important;
    box-shadow: 0 8px 20px rgba(255, 71, 87, 0.35);
    border-color: rgba(255, 118, 117, 0.6) !important;
}

/* 青色徽章专属状态 */
.user-status .dropdown:hover .dropdown-toggle .badge.bg-primary {
    background-color: rgba(57, 197, 187, 0.2) !important;
    box-shadow: 0 8px 20px rgba(57, 197, 187, 0.35);
    border-color: rgba(57, 197, 187, 0.6) !important;
}

/* 3. 下拉箭头 (▼) */
.user-status .dropdown-toggle::after {
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55), border-top-color 0.3s;
    margin-left: 0.6em;
    opacity: 0.6;
}

/* 保持旋转状态 */
.user-status .dropdown:hover .dropdown-toggle::after {
    opacity: 1;
    border-top-color: var(--primary);
    transform: rotate(180deg) scale(1.2);
}

/* =========================================
   23. 审计列表样式微调 (Audit Log Tweaks)
   适配新的点击交互和截断样式
   ========================================= */

/* 新增：通用的浅色悬停背景类 */
.hover-bg-light:hover {
    background-color: rgba(0, 0, 0, 0.03) !important; /* 极淡的灰色背景，增加 !important 确保生效 */
}

/* 修正：调整列表项圆角，使其更精致 */
.log-timeline li > div {
    border-radius: 8px !important; /* 覆盖之前可能的 12px 设置 */
    
    /* 确保鼠标手型 (防止部分浏览器不继承) */
    cursor: pointer;
    
    /* 保持过渡动画 (继承自第16部分，这里再次声明以防万一) */
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
