/* ==========================================================================
   users.css —— 用户管理（用户列表）页面样式
   说明：基础按钮 / 表单 / 表格样式复用 base.css，此处只补充列表页专属部分
   ========================================================================== */

/* ---------- 页面头部 ---------- */

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.page-head .page-title,
.page-head .page-desc {
    margin-bottom: 0;
}

.page-head .page-desc {
    margin-top: 4px;
}

.page-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* ---------- 统计卡片 ---------- */

.stat-grid-6 {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.stat-card .stat-icon.icon-gold {
    background: #fff7e6;
}

.stat-card .stat-icon.icon-green {
    background: #e9f9ef;
}

.stat-card .stat-icon.icon-red {
    background: #fdecec;
}

.stat-card .stat-icon.icon-gray {
    background: #f1f3f7;
}

/* ---------- 筛选表单 ---------- */

.filter-card {
    margin-bottom: 16px;
}

.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px 16px;
    align-items: end;
}

.filter-item {
    min-width: 0;
}

.filter-item .form-label {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 关键字搜索占两列，视觉上更突出 */
.filter-item.filter-item-wide {
    grid-column: span 2;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* 输入框前缀图标（关键字搜索框） */
.input-with-icon {
    position: relative;
}

.input-with-icon .input-icon {
    position: absolute;
    top: 50%;
    left: 11px;
    transform: translateY(-50%);
    font-size: 13px;
    line-height: 1;
    color: var(--color-text-muted);
    pointer-events: none;
}

.input-with-icon .form-input {
    padding-left: 32px;
}

/* 下拉选择框样式与输入框保持一致 */
.form-select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--color-text);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(47, 124, 246, 0.14);
}

/* 余额 / 积分区间：两个输入框并排 */
.range-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-group .form-input {
    min-width: 0;
}

.range-sep {
    color: var(--color-text-muted);
    flex-shrink: 0;
}

/* ---------- 表格工具条（条数 / 页码 / 导出） ---------- */

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 20px;
    border-bottom: 1px solid var(--color-border);
}

.table-toolbar-left,
.table-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.result-count {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.result-count strong {
    color: var(--color-primary);
}

.toolbar-inline-label {
    font-size: 13px;
    color: var(--color-text-muted);
}

/* 工具条内的下拉框 / 输入框尺寸收窄 */
.form-select-sm {
    width: auto;
    min-width: 96px;
    padding: 6px 10px;
    font-size: 13px;
}

/* 分页大小选择（表头右侧） */
.page-size-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---------- 用户表格 ---------- */

.table-wrap {
    padding: 0;
}

.users-table {
    min-width: 1120px;
}

.users-table thead th {
    padding: 12px;
    background: #f8fafc;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 1;
}

/* 可排序列头 */
.users-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color var(--transition), background var(--transition);
}

.users-table th.sortable:hover {
    color: var(--color-primary);
    background: #f1f5fd;
}

.sort-indicator {
    display: inline-block;
    margin-left: 4px;
    font-size: 10px;
    font-style: normal;
    color: var(--color-text-muted);
}

.users-table th.sortable.is-active .sort-indicator {
    color: var(--color-primary);
}

.users-table tbody tr {
    transition: background var(--transition);
}

.users-table tbody tr:hover {
    background: #f7faff;
}

.users-table tbody td {
    padding: 12px;
}

/* 序号列 */
.col-index {
    width: 54px;
    text-align: center;
    color: var(--color-text-muted);
}

/* 用户列：头像 + 昵称 + 用户名 */
.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.user-avatar-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #4f8cf7, #2f7cf6);
    border-radius: 50%;
    flex-shrink: 0;
}

.user-cell-meta {
    min-width: 0;
}

.user-cell-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

.user-cell-username {
    font-size: 12px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

/* 用户ID 列：等宽字体 + 可复制提示 */
.mono {
    font-family: Menlo, Consolas, monospace;
    font-size: 12px;
}

.user-id-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.copy-text {
    padding: 0 4px;
    font-size: 12px;
    color: var(--color-text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}

.copy-text:hover {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

/* 金额 / 积分列 */
.amount {
    font-family: Menlo, Consolas, monospace;
    font-size: 13px;
    font-weight: 600;
    color: #0f8a49;
    white-space: nowrap;
}

.amount-zero {
    color: var(--color-text-muted);
    font-weight: 500;
}

.points-value {
    font-family: Menlo, Consolas, monospace;
    font-size: 13px;
    font-weight: 600;
    color: #b4770b;
    white-space: nowrap;
}

/* 上级ID：无上级时展示占位符 */
.text-placeholder {
    color: var(--color-text-muted);
}

/* ---------- 状态标签 ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    border-radius: 999px;
    white-space: nowrap;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.badge-normal {
    color: #0f8a49;
    background: #e9f9ef;
}

.badge-banned {
    color: #b91c1c;
    background: #fdecec;
}

.badge-blocked {
    color: #b45309;
    background: #fff7e6;
}

.badge-muted {
    color: #64748b;
    background: #f1f3f7;
}

.badge-primary {
    color: var(--color-primary-dark);
    background: var(--color-primary-light);
}

/* 语言代码标签 */
.lang-tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-family: Menlo, Consolas, monospace;
    color: var(--color-text-secondary);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

/* 快捷筛选标签 */
.quick-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 0 20px 16px;
}

.quick-filter-label {
    font-size: 12px;
    color: var(--color-text-muted);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    font-size: 12px;
    font-family: inherit;
    color: var(--color-text-secondary);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    cursor: pointer;
    transition: all var(--transition);
}

.chip:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.chip.active {
    color: #fff;
    background: var(--color-primary);
    border-color: var(--color-primary);
}

/* ---------- 加载态 ---------- */

.table-loading {
    padding: 42px 20px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
}

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 8px;
    vertical-align: -3px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* 骨架屏行（首次加载时避免表格塌陷） */
.skeleton-row td {
    padding: 12px;
}

.skeleton-bar {
    height: 12px;
    background: linear-gradient(90deg, #eef1f6 25%, #f7f9fc 37%, #eef1f6 63%);
    background-size: 400% 100%;
    border-radius: var(--radius-sm);
    animation: shimmer 1.3s ease infinite;
}

@keyframes shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ---------- 空状态 ---------- */

.empty-state {
    padding: 54px 20px;
    text-align: center;
}

.empty-icon {
    font-size: 38px;
    line-height: 1;
    margin-bottom: 12px;
}

.empty-title {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 600;
}

.empty-desc {
    margin: 0 0 16px;
    font-size: 13px;
    color: var(--color-text-muted);
}

/* ---------- 分页 ---------- */

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 20px;
    border-top: 1px solid var(--color-border);
}

.pagination-info {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 34px;
    padding: 6px 10px;
    font-size: 13px;
    font-family: inherit;
    color: var(--color-text-secondary);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
}

.page-btn:hover:not(:disabled) {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.page-btn.active {
    color: #fff;
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.page-btn:disabled {
    color: var(--color-text-muted);
    background: #f8fafc;
    cursor: not-allowed;
}

.page-ellipsis {
    padding: 0 2px;
    color: var(--color-text-muted);
}

/* 跳页输入 */
.page-jump {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.page-jump .form-input {
    width: 62px;
    padding: 6px 8px;
    font-size: 13px;
    text-align: center;
}

/* ---------- 用户详情弹层 ---------- */

.modal-mask {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.48);
}

.modal {
    width: 100%;
    max-width: 720px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    max-height: 88vh;
    overflow-y: auto;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: modal-in 0.18s ease;
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

.modal-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.modal-close {
    padding: 2px 8px;
    font-size: 18px;
    line-height: 1;
    color: var(--color-text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.modal-close:hover {
    color: var(--color-danger);
    background: #fdecec;
}

.modal-body {
    padding: 20px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.detail-item {
    padding: 10px 12px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
}

.detail-label {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 2px;
}

.detail-value {
    font-size: 13px;
    font-weight: 500;
    word-break: break-all;
}

/* ---------- 详情编辑表单 ---------- */

.detail-section-title {
    margin: 4px 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.detail-section-title:not(:first-child) {
    margin-top: 22px;
}

.detail-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.detail-field .detail-label {
    margin-bottom: 4px;
}

.detail-field .form-input,
.detail-field .form-select {
    padding: 8px 10px;
    font-size: 13px;
}

.detail-hint {
    margin-top: 4px;
    font-size: 11px;
    color: var(--color-text-muted);
}

.detail-form-tip {
    margin-top: 16px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border-radius: var(--radius-md);
}

.detail-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.detail-form-actions .btn[disabled] {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
    .filter-item.filter-item-wide {
        grid-column: span 1;
    }

    .page-head {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    .filter-form {
        grid-template-columns: 1fr;
    }

    .stat-grid-6 {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .pagination-bar {
        justify-content: center;
    }

    .table-toolbar {
        padding: 12px 14px;
    }
}

