/* 管理后台主样式文件 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4361ee;
    --secondary: #3f37c9;
    --success: #4cc9f0;
    --danger: #f72585;
    --warning: #f8961e;
    --info: #4895ef;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fb;
    color: #333;
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background-color: var(--secondary);
}

.btn-outline {
    background: white;
    color: #5a67d8;
    border: 1px solid #5a67d8;
}

.admin-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: linear-gradient(135deg, var(--dark), #161a1d);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

main {
    flex: 1;
    padding: 2rem 0;
}

footer {
    background-color: var(--dark);
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
}

.wm-amount-copy,
.wm-address-copy {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.wm-address-copy span {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9rem;
    word-break: break-all;
}

.wm-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 9999px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wm-copy-btn i {
    font-size: 0.7rem;
}

.wm-copy-btn:hover {
    background: #eef2ff;
    color: #4338ca;
    border-color: #4338ca;
}

.wm-copy-btn-success {
    border-color: #34d399;
    background: #ecfdf5;
    color: #059669;
}

.wm-copy-btn-success:hover {
    background: #d1fae5;
    color: #047857;
}

.dashboard-page {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.dashboard-title h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
}

.dashboard-subtitle {
    margin: 0.25rem 0 0;
    color: #6b7280;
}

.dashboard-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dashboard-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.2rem;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #6366f1, #4338ca);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.dashboard-btn:hover {
    transform: translateY(-1px);
}

.dashboard-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #374151;
}

.dashboard-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.dashboard-switch .slider {
    width: 42px;
    height: 22px;
    background: #d1d5db;
    border-radius: 999px;
    position: relative;
    transition: background 0.2s ease;
}

.dashboard-switch .slider:before {
    content: '';
    position: absolute;
    left: 4px;
    top: 3px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.dashboard-switch input:checked + .slider {
    background: #6366f1;
}

.dashboard-switch input:checked + .slider:before {
    transform: translateX(18px);
}

.dashboard-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem 0;
    color: #4b5563;
}

.dashboard-loading .spinner-border {
    width: 2.5rem;
    height: 2.5rem;
    border: 0.25rem solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: dashboard-spin 0.8s linear infinite;
}

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

.metrics-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.metrics-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}

.metric-card {
    padding: 1.4rem;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.08);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.metric-card:before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(99,102,241,0.08), rgba(79,70,229,0.02));
    opacity: 0;
    transition: opacity 0.2s ease;
}

.metric-card:hover:before {
    opacity: 1;
}

.metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.metric-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
}

.metric-badge {
    font-size: 0.75rem;
    color: #6b7280;
    background: #f3f4f6;
    border-radius: 999px;
    padding: 0.2rem 0.75rem;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: #111827;
}

.metric-note {
    font-size: 0.75rem;
    color: #6b7280;
}

.metric-user {
    border-left: 4px solid #60a5fa;
}

.metric-finance {
    border-left: 4px solid #34d399;
}

.metric-challenge {
    border-left: 4px solid #f59e0b;
}

.metric-invite {
    border-left: 4px solid #ec4899;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.overview-card {
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.overview-card header {
    padding: 1rem 1.25rem;
    background: #f8fafc;
    font-weight: 600;
    color: #1f2937;
}

.overview-content {
    display: flex;
    justify-content: space-between;
    padding: 1.25rem;
    gap: 1rem;
}

.overview-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

.overview-label {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* VIP挑战实时分布卡片 */
.overview-content-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem;
}

.overview-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 12px;
}

.overview-value-large {
    font-size: 2.25rem;
    font-weight: 700;
    color: #f59e0b;
}

.vip-level-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.vip-level-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: #f8fafc;
    border-radius: 10px;
    transition: background 0.2s ease;
}

.vip-level-item:hover {
    background: #f1f5f9;
}

.vip-level-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.vip-level-name {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
}

.vip-level-count {
    font-size: 0.9rem;
    font-weight: 600;
    color: #6366f1;
    background: #eef2ff;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

.vip-level-empty {
    text-align: center;
    padding: 1rem;
    color: #9ca3af;
    font-size: 0.875rem;
}

.dashboard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border-radius: 14px;
    padding: 1rem 1.5rem;
    color: #4b5563;
}

.dashboard-footer i {
    color: #6366f1;
    margin-right: 0.5rem;
}

/* 账变记录弹窗：增加宽度以显示所有6列，确保居中 */
/* 增强账变记录弹窗宽度，覆盖Bootstrap默认的modal-xl max-width */
@media (min-width: 576px) {
    .modal-dialog {
        max-width: 500px !important; /* 覆盖Bootstrap的默认值 */
        width: auto !important;
    }
}

@media (min-width: 992px) {
    .modal-lg {
        max-width: 1200px !important; /* 覆盖Bootstrap的modal-lg */
        width: auto !important;
    }
    .modal-xl {
        max-width: 1600px !important; /* 强制模态框最大宽度 */
        width: auto !important;
    }
}

@media (min-width: 1400px) {
    .modal-xl {
        max-width: 1800px !important; /* 在超大屏幕上进一步扩大 */
        width: auto !important;
    }
}

/* 确保modal-body不会引入额外的水平滚动 */
#transactionsModal .modal-body {
    overflow-x: visible !important;
}

/* 账变记录表格：防止文字换行，设置列宽 */
#transactionsModal table {
    table-layout: fixed;
    width: 100%;
    min-width: 1400px; /* 确保表格有最小宽度 */
}

#transactionsModal table th,
#transactionsModal table td {
    white-space: nowrap; /* 强制所有单元格不换行，除非备注列特别指定 */
    padding: 1rem; /* 统一内边距 */
    border-bottom: 1px solid #dee2e6; /* 统一边框 */
}

#transactionsModal table th:nth-child(1),
#transactionsModal table td:nth-child(1) {
    width: 180px; /* 时间 */
}

#transactionsModal table th:nth-child(2),
#transactionsModal table td:nth-child(2) {
    width: 200px; /* 类型 */
}

#transactionsModal table th:nth-child(3),
#transactionsModal table td:nth-child(3) {
    width: 180px; /* 之前余额 */
    text-align: right;
}

#transactionsModal table th:nth-child(4),
#transactionsModal table td:nth-child(4) {
    width: 180px; /* 变动金额 */
    text-align: right;
}

#transactionsModal table th:nth-child(5),
#transactionsModal table td:nth-child(5) {
    width: 180px; /* 变动后余额 */
    text-align: right;
}

#transactionsModal table th:nth-child(6),
#transactionsModal table td:nth-child(6) {
    width: auto; /* 备注，自适应剩余空间 */
    min-width: 250px; /* 最小宽度 */
    white-space: normal; /* 允许备注列换行 */
}

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-controls {
        width: 100%;
        justify-content: space-between;
    }

    .dashboard-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

#transactionsModal.modal .modal-content { /* 更高优先级 */
    width: 100% !important;
    max-width: 100% !important;
}