/* ══════════════════════════════════════
   自定义表格组件样式
   ══════════════════════════════════════ */

.ct-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

/* ── 工具栏 ── */
.ct-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
}
.ct-search {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ct-search input {
    height: 32px;
    width: 200px;
    padding: 0 10px;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition-fast);
    outline: none;
}
.ct-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2);
}
.ct-search input::placeholder { color: var(--text-muted); }
.ct-search-icon {
    color: var(--text-muted);
    font-size: 14px;
}

/* ── 表格 ── */
.ct-table {
    width: 100%;
    border-collapse: collapse;
}
.ct-table thead th {
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    text-align: left;
    user-select: none;
}
.ct-table thead th.ct-sortable {
    cursor: pointer;
    transition: color var(--transition-fast);
}
.ct-table thead th.ct-sortable:hover {
    color: var(--text-primary);
}
.ct-table thead th.ct-sort-asc,
.ct-table thead th.ct-sort-desc {
    color: var(--accent);
}
.ct-table thead th .ct-sort-icon {
    margin-left: 4px;
    font-size: 10px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.ct-table thead th.ct-sort-asc .ct-sort-icon,
.ct-table thead th.ct-sort-desc .ct-sort-icon {
    opacity: 1;
}

.ct-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-primary);
    font-size: 14px;
}
.ct-table tbody tr {
    transition: background var(--transition-fast);
}
.ct-table tbody tr:hover {
    background: rgba(var(--primary-rgb), 0.04);
}
.ct-table tbody tr:last-child td {
    border-bottom: none;
}
.ct-table img {
    border-radius: var(--radius-sm);
    object-fit: cover;
}
.table-avatar {
    width: 32px;
    height: 32px;
}

/* ── 加载态 ── */
.ct-loading {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.ct-loading .spinner-border {
    color: var(--primary);
    width: 24px;
    height: 24px;
    border-width: 2px;
    margin-bottom: 8px;
}

/* ── 空数据 ── */
.ct-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.ct-empty i {
    font-size: 36px;
    display: block;
    margin-bottom: 8px;
    opacity: 0.4;
}

/* ── 错误态 ── */
.ct-error {
    text-align: center;
    padding: 48px 20px;
    color: var(--danger);
}
.ct-error i {
    font-size: 36px;
    display: block;
    margin-bottom: 8px;
}
.ct-retry {
    margin-top: 12px;
}

/* ── 分页 ── */
.ct-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}
.ct-pagination-info {
    font-size: 13px;
    color: var(--text-secondary);
}
.ct-pagination-pages {
    display: flex;
    align-items: center;
    gap: 2px;
}
.ct-page-btn {
    height: 32px;
    min-width: 32px;
    padding: 0 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ct-page-btn:hover:not(:disabled) {
    background: var(--border);
    color: var(--text-primary);
}
.ct-page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.ct-page-btn.active {
    background: var(--gradient-primary);
    color: #fff;
    border-color: transparent;
}

.ct-page-select {
    height: 32px;
    padding: 0 8px;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* ── 响应式 ── */
@media (max-width: 768px) {
    .ct-toolbar { flex-direction: column; align-items: stretch; }
    .ct-search input { width: 100%; }
    .ct-pagination { flex-direction: column; align-items: center; }
    .ct-table { font-size: 13px; }
    .ct-table thead th,
    .ct-table tbody td { padding: 8px 10px; }
}
