/**
 * 四川评估扩展样式
 * 复用 variables.css 和 common.css 的设计 token
 * 为 timeline、garbage-time、netchain、statistics 页面提供样式
 */

/* ============================================
   Timeline 课程脉络
   ============================================ */
.timeline-bar {
    display: flex;
    height: 40px;
    background: var(--color-bg, #f0f2f5);
    border-radius: var(--radius-md, 12px);
    overflow: hidden;
    margin-bottom: 24px;
}

.timeline-bar-segment {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-right: 2px solid #fff;
    cursor: pointer;
    font-size: 11px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.timeline-bar-segment:hover {
    filter: brightness(1.1);
}

.segment-card {
    border: 1px solid var(--color-border, #e8e8e8);
    border-radius: var(--radius-md, 12px);
    padding: 20px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.2s;
    cursor: pointer;
}

.segment-card:hover {
    border-color: var(--color-primary, #4A90E2);
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0,0,0,0.04));
}

.segment-card.active {
    border-color: var(--color-primary, #4A90E2);
    background: var(--color-primary-light, #E6F7FF);
    box-shadow: 0 0 0 1px var(--color-primary-light, #E6F7FF);
}

.segment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.phase-index {
    width: 24px;
    height: 24px;
    background: var(--color-primary, #4A90E2);
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    margin-right: 8px;
}

.phase-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-main, #1F1F1F);
}

.time-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--color-primary-light, #E6F7FF);
    color: var(--color-primary, #4A90E2);
    border-radius: 6px;
    font-size: 12px;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
}

.duration-text {
    font-size: 12px;
    color: var(--color-text-weak, #8C8C8C);
    margin-left: 8px;
}

.segment-body {
    font-size: 14px;
    color: var(--color-text-sub, #595959);
    line-height: 1.6;
}

.segment-body strong {
    color: var(--color-text-main, #1F1F1F);
}

.kp-tag {
    display: inline-block;
    padding: 2px 10px;
    background: rgba(79, 70, 229, 0.08);
    color: var(--color-primary, #4A90E2);
    border-radius: 12px;
    font-size: 12px;
    margin: 2px 4px 2px 0;
}

.ai-box {
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
}

.ai-box .ai-label {
    font-weight: 600;
    color: #059669;
    font-size: 13px;
    margin-bottom: 4px;
}

.confidence-high { color: #059669; }
.confidence-medium { color: #d97706; }
.confidence-low { color: #dc2626; }

/* ============================================
   Garbage Time 低效时段
   ============================================ */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    text-align: center;
    margin-bottom: 24px;
}

.summary-item {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--color-border, #e8e8e8);
    border-radius: var(--radius-md, 12px);
    padding: 20px;
}

.summary-item .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text-main, #1F1F1F);
}

.summary-item .stat-label {
    font-size: 13px;
    color: var(--color-text-weak, #8C8C8C);
    margin-top: 4px;
}

.video-bar-track {
    position: relative;
    height: 32px;
    background: var(--color-bg, #f0f2f5);
    border-radius: var(--radius-sm, 6px);
    overflow: hidden;
    margin-bottom: 8px;
}

.garbage-marker {
    position: absolute;
    top: 4px;
    bottom: 4px;
    border-radius: 3px;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.garbage-marker:hover {
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.2);
}

.video-bar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--color-text-weak, #8C8C8C);
    font-family: 'Consolas', monospace;
}

.type-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.type-tag.silence { background: #f3f4f6; color: #4b5563; }
.type-tag.low-info { background: #fef3c7; color: #d97706; }
.type-tag.unclassified { background: #fce7f3; color: #db2777; }

/* ============================================
   Netchain Tree 网链组织树
   ============================================ */
.union-block {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--color-border, #e8e8e8);
    border-radius: var(--radius-md, 12px);
    margin-bottom: 16px;
    overflow: hidden;
}

.union-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: background 0.15s;
}

.union-header:hover { background: rgba(255, 255, 255, 0.5); }

.expand-icon {
    color: var(--color-text-weak, #8C8C8C);
    transition: transform 0.2s;
    flex-shrink: 0;
    font-size: 12px;
}

.expand-icon.expanded { transform: rotate(90deg); }

.union-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-main, #1F1F1F);
}

.union-children {
    border-top: 1px solid var(--color-border, #e8e8e8);
}

.group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px 12px 48px;
    cursor: pointer;
    transition: background 0.15s;
}

.group-header:hover { background: rgba(255, 255, 255, 0.5); }

.group-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-sub, #595959);
}

.school-list {
    padding: 8px 20px 12px 80px;
}

.school-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.15s;
}

.school-item:hover { background: rgba(255, 255, 255, 0.5); }

.school-name {
    font-size: 13px;
    color: var(--color-text-sub, #595959);
    flex: 1;
}

.role-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.role-tag.leader { background: #fce7f3; color: #db2777; }
.role-tag.guide { background: #fef3c7; color: #d97706; }
.role-tag.node { background: #f3f4f6; color: #4b5563; }

/* ============================================
   Statistics 统计
   ============================================ */
.stats-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--color-border, #e8e8e8);
    padding-bottom: 8px;
    margin-bottom: 20px;
}

.stats-tab {
    padding: 8px 20px;
    border: none;
    background: none;
    font-size: 14px;
    color: var(--color-text-sub, #595959);
    cursor: pointer;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
}

.stats-tab:hover { background: rgba(255, 255, 255, 0.5); }
.stats-tab.active {
    background: var(--color-primary, #4A90E2);
    color: #fff;
}

.stats-panel { display: none; }
.stats-panel.active { display: block; }

.chart-container {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: var(--radius-md, 12px);
    padding: 18px 18px 14px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.04));
    overflow: visible;
    min-width: 0;
}

.chart-container.stats-chart-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.96) 100%);
}

.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: stretch;
}

.chart-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-main, #1F1F1F);
    margin-bottom: 0;
    letter-spacing: -0.01em;
}

.chart-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px 12px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.chart-subtitle {
    font-size: 12px;
    color: var(--color-text-weak, #8C8C8C);
    font-weight: 500;
}

/* Statistics — filter / KPI / progress / expand */
.stats-filter-panel {
    margin-bottom: 18px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.04));
    padding: 14px 16px;
}

.stats-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    align-items: flex-end;
}

.stats-filter-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stats-filter-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-sub, #595959);
}

.stats-segmented {
    display: inline-flex;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}

.stats-segmented-btn {
    border: none;
    background: transparent;
    color: var(--color-text-sub, #595959);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.stats-segmented-btn:hover {
    color: var(--color-text-main, #1F1F1F);
}

.stats-segmented-btn.active {
    background: #fff;
    color: var(--color-primary, #4A90E2);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.stats-filter-check {
    justify-content: flex-end;
    min-height: 34px;
}

.stats-filter-hint {
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--color-text-weak, #8C8C8C);
}

.stats-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-main, #1F1F1F);
    cursor: pointer;
    user-select: none;
}

.stats-checkbox-label input {
    width: 15px;
    height: 15px;
    accent-color: var(--color-primary, #4A90E2);
    cursor: pointer;
}

.stats-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stats-kpi-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: var(--radius-md, 12px);
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.04));
    padding: 16px 18px;
    min-height: 88px;
}

.stats-kpi-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-sub, #595959);
    margin-bottom: 8px;
}

.stats-kpi-value {
    font-family: 'Outfit', 'Inter', system-ui, sans-serif;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-text-main, #1F1F1F);
    letter-spacing: -0.02em;
}

.stats-rate-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 120px;
}

.stats-progress {
    flex: 1;
    height: 6px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    min-width: 64px;
}

.stats-progress-bar {
    height: 100%;
    background: var(--color-primary, #4A90E2);
    border-radius: 999px;
    transition: width 0.25s ease;
}

.stats-rate-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-sub, #595959);
    min-width: 48px;
    text-align: right;
}

.stats-chart-box {
    height: 340px;
    width: 100%;
    min-height: 280px;
    /* 避免轴标签被父级裁切 */
    overflow: visible;
}

.stats-chart-box-tall {
    min-height: 320px;
}

.stats-chart-box canvas {
    /* echarts canvas 自身不裁切父级文案 */
    max-width: 100%;
}

.stats-chart-empty,
.stats-table-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    color: var(--color-text-weak, #8C8C8C);
    text-align: center;
    gap: 8px;
}

.stats-chart-empty i,
.stats-table-empty i {
    font-size: 28px;
    opacity: 0.45;
}

.stats-chart-empty p,
.stats-table-empty p {
    margin: 0;
    font-size: 13px;
}

.stats-error-card {
    border-left: 4px solid #ef4444;
    background: #fef2f2;
    padding: 16px 18px;
}

.stats-error-text {
    color: #dc2626;
    margin: 0;
}

.stats-expand-table .stats-union-row {
    cursor: pointer;
}

.stats-expand-table .stats-union-row:hover {
    background: rgba(74, 144, 226, 0.06);
}

.stats-expand-cell {
    color: var(--color-text-sub, #595959);
    width: 36px;
    text-align: center;
}

.stats-group-header-row td {
    padding-top: 4px;
    padding-bottom: 4px;
    background: rgba(249, 250, 251, 0.85);
}

.stats-group-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-sub, #595959);
}

.stats-group-row td {
    background: rgba(249, 250, 251, 0.55);
    color: var(--color-text-sub, #595959);
}

.stats-group-name {
    padding-left: 28px !important;
    font-weight: 500;
}

.stats-group-type {
    font-size: 12px;
    color: var(--color-text-weak, #8C8C8C);
}

.stats-group-empty {
    font-size: 12px;
    color: var(--color-text-weak, #8C8C8C);
    padding-left: 28px !important;
}

/* ============================================
   Common Data Table
   ============================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-md, 12px);
    overflow: hidden;
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0,0,0,0.04));
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    background: rgba(249, 250, 251, 0.5);
    font-weight: 600;
    color: var(--color-text-sub, #595959);
    font-size: 13px;
    border-bottom: 1px solid var(--color-border, #e8e8e8);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    font-size: 13px;
    color: var(--color-text-main, #1F1F1F);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: rgba(255, 255, 255, 0.6); }

/* ============================================
   Textbook 教材
   ============================================ */
.textbook-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--color-border, #e8e8e8);
    border-radius: var(--radius-md, 12px);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.textbook-card:hover {
    border-color: var(--color-primary, #4A90E2);
    box-shadow: var(--shadow-md, 0 4px 6px rgba(0,0,0,0.08));
    transform: translateY(-2px);
}

.textbook-card.selected {
    border-color: var(--color-primary, #4A90E2);
    background: var(--color-primary-light, #E6F7FF);
}

.textbook-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.textbook-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-main, #1F1F1F);
    margin-bottom: 4px;
}

.textbook-meta {
    font-size: 13px;
    color: var(--color-text-weak, #8C8C8C);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.info-item .info-label {
    font-size: 12px;
    color: var(--color-text-weak, #8C8C8C);
    display: block;
}

.info-item .info-value {
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text-main, #1F1F1F);
    margin-top: 2px;
    display: block;
}

.quality-high { color: #059669; }
.quality-medium { color: #d97706; }
.quality-low { color: #dc2626; }

.content-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--color-text-sub, #595959);
    white-space: pre-wrap;
}

.page-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.page-chip {
    display: inline-block;
    padding: 2px 10px;
    background: var(--color-bg, #f0f2f5);
    border-radius: 12px;
    font-size: 12px;
    color: var(--color-text-sub, #595959);
    font-family: 'Consolas', monospace;
}

/* ============================================
   Loading & Empty States
   ============================================ */
.sc-loading {
    text-align: center;
    padding: 40px;
    color: var(--color-text-weak, #8C8C8C);
}

.sc-loading i {
    font-size: 24px;
    margin-bottom: 12px;
    display: block;
    color: var(--color-primary, #4A90E2);
}

.sc-empty {
    text-align: center;
    padding: 60px;
    color: var(--color-text-weak, #8C8C8C);
}

.sc-empty i {
    font-size: 36px;
    margin-bottom: 12px;
    display: block;
    opacity: 0.5;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .stats-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
    .chart-row { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr 1fr; }
    .textbook-grid { grid-template-columns: 1fr; }
    .stats-kpi-grid { grid-template-columns: 1fr; }
    .stats-kpi-value { font-size: 24px; }
}
