/* ========== 用户详情样式 ========== */
.user-detail {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.detail-section {
    padding: 20px;
    background: var(--bg-hover);
    border-radius: var(--radius-md);
}

.detail-section h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

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

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-value {
    font-size: 14px;
    color: var(--text-primary);
}

.detail-value code {
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

/* ========== 额度管理表单 ========== */
.quota-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    margin-top: 16px;
}

.quota-form h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.quota-inputs {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.quota-inputs input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
}

.quota-inputs button {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quota-inputs button:hover {
    background: var(--primary-dark);
}

/* ========== 聊天记录样式 ========== */
.chat-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.chat-group {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.chat-group-header {
    padding: 16px 20px;
    background: var(--bg-hover);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.chat-group-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-group-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.chat-messages {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: white;
    border: 1px solid var(--border);
}

.chat-message.user {
    background: var(--primary-light);
    border-color: var(--primary);
}

.chat-message.assistant {
    background: var(--bg-hover);
}

.chat-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.chat-message-role {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.chat-message-time {
    font-size: 11px;
    color: var(--text-muted);
}

.chat-message-content {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* ========== 查询详情 ========== */
.query-item {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    transition: all 0.2s;
}

.query-item:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--primary);
}

.query-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 12px;
}

.query-input {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.query-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.query-status.completed {
    background: #d1fae5;
    color: #065f46;
}

.query-status.pending {
    background: #fef3c7;
    color: #92400e;
}

.query-status.failed {
    background: #fee2e2;
    color: #991b1b;
}

.query-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.query-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ========== 操作按钮组 ========== */
.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--text-secondary);
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-link {
    background: transparent;
    color: var(--primary);
    border: none;
    padding: 4px 8px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
}

.btn-link:hover {
    color: var(--primary-dark);
}

/* ========== 加载状态 ========== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
}

.loading::after {
    content: "加载中...";
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: "加载中"; }
    40% { content: "加载中."; }
    60% { content: "加载中.."; }
    80%, 100% { content: "加载中..."; }
}

/* ========== 分页器 ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination button {
    padding: 8px 14px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ========== 标签 ========== */
.tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    background: var(--bg-hover);
    color: var(--text-secondary);
}

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

.tag.success {
    background: #d1fae5;
    color: #065f46;
}

.tag.danger {
    background: #fee2e2;
    color: #991b1b;
}

.tag.warning {
    background: #fef3c7;
    color: #92400e;
}

/* ========== 信息提示 ========== */
.info-box {
    padding: 16px;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--info);
    background: #eff6ff;
    color: #1e40af;
    font-size: 13px;
    margin: 16px 0;
}

.info-box.success {
    border-left-color: var(--success);
    background: #d1fae5;
    color: #065f46;
}

.info-box.warning {
    border-left-color: var(--warning);
    background: #fef3c7;
    color: #92400e;
}

.info-box.danger {
    border-left-color: var(--danger);
    background: #fee2e2;
    color: #991b1b;
}

/* ========== 响应式调整 ========== */
@media (max-width: 768px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .quota-inputs {
        flex-direction: column;
        align-items: stretch;
    }
    
    .quota-inputs button {
        width: 100%;
    }
    
    .chat-group-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .query-header {
        flex-direction: column;
        gap: 8px;
    }
    
    .query-meta {
        flex-direction: column;
        gap: 4px;
    }
}
