/* ============================================================
   后台管理端公共样式  static/css/admin.css
   在 user.css 之后加载；基础布局/卡片/表格/表单/按钮 复用 user.css
   ============================================================ */

/* ---------- 列表工具栏（卡片头部右侧操作区） ---------- */
.admin-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ---------- 卡片内并列 form-row 的垂直间距（与前台一致） ---------- */
.card-body>.form-row:not(:last-child) {
    margin-bottom: 28px;
}

.admin-toolbar .btn {
    height: 36px;
    padding: 0 16px;
    font-size: 14px;
}

/* ---------- 筛选栏（行内表单） ---------- */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    background: #fcfdfe;
}

.filter-bar .form-item {
    margin-bottom: 0;
}

.filter-bar .form-label {
    margin-bottom: 6px;
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.filter-bar .form-input,
.filter-bar .form-select {
    height: 40px;
    min-width: 180px;
}

.filter-bar .filter-actions {
    display: flex;
    gap: 10px;
}

/* ---------- 表格（后台紧凑） ---------- */
.admin-table {
    width: 100%;
}

.admin-table th,
.admin-table td {
    padding: 12px 14px;
    font-size: 13.5px;
    text-align: left;
    vertical-align: middle;
}

.admin-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    white-space: nowrap;
}

.admin-table tbody tr:hover {
    background: #f8fafc;
}

.admin-table .col-center,
.admin-table th.col-center {
    text-align: center;
}

/* ---------- 单元格内的小按钮组 ---------- */
.row-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

/* ---------- 状态文字 ---------- */
.st-unsold {
    color: #94a3b8;
    font-weight: 600;
}

.st-sold {
    color: #2563eb;
    font-weight: 600;
}

.st-used {
    color: #16a34a;
    font-weight: 600;
}

.st-expired {
    color: #ef4444;
    font-weight: 600;
}

/* ---------- 分页容器 ---------- */
.pagination {
    padding: 18px 0 4px;
    display: flex;
    justify-content: center;
}

/* ---------- 卡片内直接放表格时，去掉多余内边距 ---------- */
.card-body.flush {
    padding: 0;
}

.card-body.flush .table-wrap {
    border-radius: 0 0 14px 14px;
}

/* ---------- 描述列表（详情展示） ---------- */
.desc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px 24px;
}

.desc-grid .desc-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 14px;
}

.desc-grid .desc-item .k {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.desc-grid .desc-item .v {
    color: var(--text);
    font-weight: 500;
    text-align: right;
    word-break: break-all;
}

/* ---------- 提示条 ---------- */
.notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 20px;
}

.notice i {
    margin-top: 3px;
}

.notice-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

.notice-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #b45309;
}

.notice-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

/* ---------- 统计卡片（概览页） ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 22px;
}

.stat-card .stat-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-card .stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 15px;
    flex-shrink: 0;
}

.stat-card .stat-value {
    font-size: 30px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    margin: 12px 0 10px;
    font-variant-numeric: tabular-nums;
}

.stat-card .stat-today {
    font-size: 13px;
    color: var(--text-tertiary);
}

.stat-card .stat-today em {
    font-style: normal;
    font-weight: 600;
    color: var(--primary);
    margin-left: 2px;
}

/* 宽统计卡（跨整行，左侧总览 + 右侧明细） */
.stat-card-wide {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.stat-card-wide .stat-main {
    flex: 1 1 260px;
}

.stat-card-wide .stat-value {
    margin: 10px 0 6px;
}

.stat-breakdown {
    display: flex;
    align-items: center;
    gap: 28px;
}

.stat-bd-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: right;
}

.stat-bd-item .bd-label {
    font-size: 12px;
    color: var(--text-tertiary);
}

.stat-bd-item .bd-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.stat-bd-divider {
    width: 1px;
    height: 36px;
    background: var(--border);
}

/* ---------- 进度条 ---------- */
.progress {
    height: 8px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.progress .progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 6px;
    transition: width .3s ease;
}

@media (max-width: 1200px) {
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- 等高双栏（TOP20 排行等） ---------- */
.top-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: stretch;
}

@media (max-width: 991.98px) {
    .top-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- 可点击数字按钮（如用户盒子数） ---------- */
.box-count-btn,
.game-count-btn {
    min-width: 30px;
    height: 26px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.box-count-btn:hover,
.game-count-btn:hover {
    border-color: var(--primary);
    background: #eff6ff;
}

/* ---------- QQ 单元格（头像 + 号码 + 复制） ---------- */
.qq-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qq-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
    background: #f1f5f9;
    flex-shrink: 0;
    display: block;
}

.qq-num {
    font-size: 13px;
    color: var(--text);
}

.qq-copy-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background .15s ease, color .15s ease;
}

.qq-copy-btn:hover {
    background: #eff6ff;
    color: var(--primary);
}

/* ---------- 页面切换卡（Tab） ---------- */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    margin-bottom: -1px;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 8px 8px 0 0;
    background: transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: color .15s ease, background .15s ease, border-color .15s ease;
}

.tab-btn:hover {
    color: var(--primary);
    background: #f8fafc;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: transparent;
}

.tab-btn .tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    border-radius: 9px;
    background: #e2e8f0;
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
}

.tab-btn.active .tab-count {
    background: var(--primary-light);
    color: var(--primary);
}

/* ---------- 表头排序链接 ---------- */
.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: color .15s ease;
}

.sort-link:hover,
.sort-link:hover i {
    color: var(--primary);
}

.sort-link i {
    font-size: 11px;
    color: #94a3b8;
}

/* ---------- 可点击数字（打开明细弹层） ---------- */
.num-btn {
    padding: 0;
    border: none;
    background: transparent;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline dotted;
    text-underline-offset: 3px;
    transition: opacity .15s ease;
}

.num-btn:hover {
    opacity: .72;
}

/* ---------- 通用复制小图标 ---------- */
.copy-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    margin-left: 6px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    vertical-align: middle;
    transition: background .15s ease, color .15s ease;
}

.copy-btn:hover {
    background: #eff6ff;
    color: var(--primary);
}

/* ---------- 盒子 LOGO / 二维码预览 ---------- */
.logo-preview {
    width: 130px;
    height: 36px;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #f8fafc;
}

.qr-preview {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
}

/* 动态行（幻灯片 / 盒子菜单） */
.dyn-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.dyn-row .form-input {
    flex: 1;
    min-width: 0;
}

.dyn-row:last-child {
    margin-bottom: 12px;
}

/* ---------- 模式选择卡片（列表模式等） ---------- */
.mode-option {
    flex: 1 1 220px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.mode-option:hover {
    border-color: #93c5fd;
    background: #f8fafc;
}

.mode-option.active {
    border-color: var(--primary);
    background: #eff6ff;
}

.mode-option input {
    display: none;
}

.mode-option .mode-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.mode-option .mode-desc {
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.6;
}

/* ---------- 代码 / 密钥 ---------- */
.code-text {
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    word-break: break-all;
    color: #334155;
}

/* ---------- 表单只读展示 ---------- */
.readonly-value {
    display: inline-block;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: #475569;
    word-break: break-all;
}

/* ---------- 移动端 ---------- */
@media (max-width: 991.98px) {
    .filter-bar {
        padding: 16px;
    }

    .filter-bar .form-input,
    .filter-bar .form-select {
        min-width: 0;
        width: 100%;
    }

    .filter-bar .form-item {
        flex: 1 1 100%;
    }
}
