/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #dbeafe;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ==================== 头部样式 ==================== */
.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* ==================== 搜索框样式 ==================== */
.search-box {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.half {
    width: 100%;
}

.label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.label-icon {
    margin-right: 5px;
}

.input-keywords {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s;
}

.input-keywords:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* 关键词标签 */
.keyword-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    min-height: 32px;
}

.keyword-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.keyword-tag .remove-tag {
    margin-left: 6px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.keyword-tag .remove-tag:hover {
    opacity: 1;
}

/* 复选框组 */
.checkbox-group {
    display: flex;
    gap: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
}

/* 下拉选择框 */
.select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

.select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* 搜索按钮 */
.btn-search {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow-md);
}

.btn-search:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-search:active {
    transform: translateY(0);
}

.btn-icon {
    margin-right: 8px;
}

/* ==================== 加载状态 ==================== */
.loading {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-primary);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==================== 搜索结果 ==================== */
.search-results {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
}

.results-header {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.results-header h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.results-info {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.results-info span {
    color: var(--primary-color);
    font-weight: 600;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 结果卡片 */
.result-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.result-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.rank-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.rank-badge.rank-1 {
    background: linear-gradient(135deg, #ffd700, #ffb300);
    color: white;
}

.rank-badge.rank-2 {
    background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
    color: white;
}

.rank-badge.rank-3 {
    background: linear-gradient(135deg, #cd7f32, #b8722e);
    color: white;
}

.username {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
}

.trust-score {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.trust-score.high {
    background: #d1fae5;
    color: #065f46;
}

.trust-score.medium {
    background: #fef3c7;
    color: #92400e;
}

.trust-score.low {
    background: #fee2e2;
    color: #991b1b;
}

.card-stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
}

.stat-icon {
    font-size: 1rem;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 700;
    color: var(--primary-color);
}

.stat-unit {
    color: var(--text-secondary);
}

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

.content-preview {
    color: var(--text-secondary);
    line-height: 1.6;
    max-height: 100px;
    overflow: hidden;
    position: relative;
}

.content-preview::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, var(--bg-secondary));
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.channel-name {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-detail {
    padding: 10px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-detail:hover {
    background: var(--primary-dark);
    transform: translateX(4px);
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: var(--bg-primary);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-hint {
    font-size: 0.95rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* ==================== 错误提示 ==================== */
.error-msg {
    background: #fee2e2;
    color: #991b1b;
    padding: 16px 20px;
    border-radius: 10px;
    border-left: 4px solid var(--danger-color);
    margin-bottom: 20px;
}

/* ==================== 工具类 ==================== */
.hidden {
    display: none !important;
}

/* ==================== 详情页样式 ==================== */
.detail-page {
    background: var(--bg-secondary);
}

.back-nav {
    margin-bottom: 20px;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    padding: 12px 20px;
    background: white;
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.btn-back:hover {
    background: var(--primary-light);
    transform: translateX(-4px);
}

.detail-header {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
}

.user-title {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.user-title h1 {
    font-size: 2rem;
    color: var(--primary-color);
}

.role-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.role-badge.primary {
    background: #d1fae5;
    color: #065f46;
}

.role-badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.role-badge.unknown {
    background: var(--border-color);
    color: var(--text-secondary);
}

.header-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.channel-badge,
.score-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* 详情页内容布局 */
.detail-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
}

/* 左侧面板 */
.left-panel {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.panel-header h2 {
    font-size: 1.4rem;
}

.panel-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message-item {
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.message-index {
    font-weight: 700;
    color: var(--primary-color);
}

.message-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.message-content {
    color: var(--text-primary);
    line-height: 1.7;
    word-wrap: break-word;
}

.content-ellipsis {
    color: var(--text-secondary);
}

/* 右侧面板 */
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stats-card,
.chart-card,
.tips-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.stats-card-header,
.chart-header,
.tips-header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.stats-card-header h3,
.chart-header h3,
.tips-header h3 {
    font-size: 1.2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.stat-box {
    text-align: center;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.stats-info {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 0.95rem;
}

.info-label {
    color: var(--text-secondary);
}

.info-value {
    font-weight: 600;
    color: var(--text-primary);
}

.chart-container {
    height: 200px;
    margin-top: 16px;
}

/* 月度统计 */
.month-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.month-stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.month-label {
    min-width: 80px;
    color: var(--text-secondary);
}

.month-bar {
    flex: 1;
    height: 24px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.month-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
    transition: width 0.5s ease;
}

.month-count {
    min-width: 60px;
    text-align: right;
    font-weight: 600;
    color: var(--primary-color);
}

/* 评估说明 */
.tips-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tip-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.tip-item.good {
    background: #d1fae5;
    color: #065f46;
}

.tip-item.warning {
    background: #fef3c7;
    color: #92400e;
}

.tip-icon {
    font-size: 1.2rem;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1024px) {
    .detail-content {
        grid-template-columns: 1fr;
    }

    .right-panel {
        order: -1;
    }
}

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

    .card-stats {
        flex-wrap: wrap;
        gap: 12px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .detail-content {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}
