/* Career Lab Dashboard */
:root {
    --pico-font-size: 15px;
}

body {
    min-height: 100vh;
}

/* Nav */
header.container-fluid {
    padding-top: 0.5rem;
    padding-bottom: 0;
    border-bottom: 1px solid var(--pico-muted-border-color);
    margin-bottom: 1.5rem;
}
.nav-link {
    text-decoration: none;
    color: var(--pico-muted-color);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.15s;
}
.nav-link:hover {
    color: var(--pico-primary-inverse);
    background: var(--pico-primary);
}
.nav-link.active {
    color: var(--pico-primary-inverse);
    background: var(--pico-primary);
    font-weight: 600;
}

footer.container-fluid {
    padding: 1rem 0;
    text-align: center;
    border-top: 1px solid var(--pico-muted-border-color);
    margin-top: 2rem;
}

/* Period selector */
.period-selector {
    display: flex;
    gap: 0;
}
.period-selector a {
    padding: 0.3rem 0.8rem;
    border: 1px solid var(--pico-muted-border-color);
    text-decoration: none;
    font-size: 0.85rem;
    color: var(--pico-muted-color);
    transition: all 0.15s;
}
.period-selector a:first-child { border-radius: 4px 0 0 4px; }
.period-selector a:last-child { border-radius: 0 4px 4px 0; }
.period-selector a:not(:first-child) { border-left: none; }
.period-selector a.active,
.period-selector a:hover {
    background: var(--pico-primary);
    color: var(--pico-primary-inverse);
    border-color: var(--pico-primary);
}

/* KPI cards */
.kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}
.kpi-card {
    text-align: center;
    padding: 1rem 0.75rem;
    margin: 0;
}
.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0.25rem 0;
}
.green { color: #4caf50; }
.red { color: #f44336; }

/* Charts */
.charts-grid {
    grid-template-columns: 1.5fr 1fr;
    gap: 0.75rem;
}
.charts-grid article {
    margin-bottom: 0;
}
.chart-wrap {
    position: relative;
    min-height: 220px;
}
.chart-wrap canvas {
    max-height: 280px;
}

/* Telegram detail */
.tg-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.tg-stats {
    margin: 0;
}
.tg-stats td {
    padding: 0.35rem 0.5rem;
    border: none;
    border-bottom: 1px solid var(--pico-muted-border-color);
}

/* Helpers */
.muted { color: var(--pico-muted-color); }
.center { text-align: center; }

article header {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* Insights */
.insights-block {
    margin-top: 1rem;
}
.insight-card {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    border-left: 4px solid transparent;
}
.insight-card.growth {
    background: rgba(76, 175, 80, 0.08);
    border-left-color: #4caf50;
}
.insight-card.warning {
    background: rgba(244, 67, 54, 0.08);
    border-left-color: #f44336;
}
.insight-card.info {
    background: rgba(99, 102, 241, 0.08);
    border-left-color: #6366f1;
}
.insight-card.action {
    background: rgba(245, 158, 11, 0.08);
    border-left-color: #f59e0b;
}
.insight-icon {
    font-size: 1.2rem;
    line-height: 1.4;
    flex-shrink: 0;
    width: 1.5rem;
    text-align: center;
}
.insight-body p {
    margin: 0.25rem 0 0;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--pico-muted-color);
}
.insight-body strong {
    font-size: 0.92rem;
}

/* Mini post cards (telegram page) */
.mini-post-card {
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.4rem;
    border-left: 3px solid var(--pico-muted-border-color);
    border-radius: 0 4px 4px 0;
}
.mini-post-card.perf-high { border-left-color: #4caf50; }
.mini-post-card.perf-low { border-left-color: #f44336; }
.mini-post-stats {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    margin-bottom: 0.25rem;
}
.mini-post-text {
    font-size: 0.82rem;
    line-height: 1.35;
    color: var(--pico-muted-color);
    margin-bottom: 0.15rem;
}

/* Posts page */
.posts-header { margin-bottom: 1rem; }
.posts-header h2 { margin-bottom: 0.25rem; }

.sort-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 1.5rem;
}
.sort-controls a {
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--pico-muted-border-color);
    text-decoration: none;
    font-size: 0.8rem;
    color: var(--pico-muted-color);
    transition: all 0.15s;
    white-space: nowrap;
}
.sort-controls a:first-child { border-radius: 4px 0 0 4px; }
.sort-controls a:last-child { border-radius: 0 4px 4px 0; }
.sort-controls a:not(:first-child) { border-left: none; }
.sort-controls a.active,
.sort-controls a:hover {
    background: var(--pico-primary);
    color: var(--pico-primary-inverse);
    border-color: var(--pico-primary);
}

.post-card {
    padding: 1rem 1.25rem;
    margin-bottom: 0.5rem;
    border-left: 4px solid var(--pico-muted-border-color);
}
.post-card.perf-high { border-left-color: #4caf50; }
.post-card.perf-low { border-left-color: #f44336; }
.post-card.perf-mid { border-left-color: #6366f1; }

.post-meta {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.post-date { color: var(--pico-muted-color); font-size: 0.85rem; }
.post-media-badge, .post-fwd-badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: var(--pico-muted-border-color);
    color: var(--pico-muted-color);
}
.post-fwd-badge { background: #f4433620; color: #f44336; }

.post-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}
.post-stat-main .stat-number {
    font-size: 1.3rem;
    font-weight: 700;
}
.stat-number { font-weight: 600; }
.stat-number.perf-high { color: #4caf50; }
.stat-number.perf-low { color: #f44336; }
.stat-number.perf-mid { color: #6366f1; }
.stat-label { display: block; font-size: 0.75rem; color: var(--pico-muted-color); }

.post-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}
.reaction-chip {
    font-size: 0.8rem;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    background: var(--pico-muted-border-color);
}

.post-text {
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--pico-color);
    margin-bottom: 0.5rem;
    max-height: 4.2em;
    overflow: hidden;
}

.post-hypothesis {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}
.post-hypothesis.good { background: #4caf5015; color: #81c784; }
.post-hypothesis.bad { background: #f4433615; color: #e57373; }

.post-link { font-size: 0.8rem; }
.post-link a { color: var(--pico-primary); }

/* ===== TGStat-style stat cards ===== */
.stat-cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.stat-card {
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
}
.stat-card-wide {
    grid-column: span 1;
}
.stat-card-body {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}
.stat-card-main {
    flex: 1;
}
.stat-card-right {
    text-align: right;
    flex-shrink: 0;
    max-width: 50%;
}
.stat-big-number {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 0.4rem;
}
.stat-big-number-sm {
    font-size: 1.4rem;
    font-weight: 700;
}
.stat-card-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--pico-muted-color);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}
.stat-sub-metrics {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--pico-muted-color);
}
.stat-sub-metrics span {
    font-weight: 600;
    color: var(--pico-color);
}
.stat-mini-chart {
    margin-top: 0.25rem;
}
.stat-mini-chart canvas {
    max-width: 160px;
}
.stat-detail-box {
    margin-top: 0.5rem;
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}
.stat-detail-label {
    font-size: 0.7rem;
    color: var(--pico-muted-color);
    line-height: 1.3;
}

/* Mini post rows */
.mini-post-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--pico-muted-border-color);
    font-size: 0.82rem;
}
.mini-post-row:last-child {
    border-bottom: none;
}
.mini-post-views {
    font-weight: 700;
    min-width: 50px;
    flex-shrink: 0;
}
.mini-post-reactions {
    color: var(--pico-muted-color);
    min-width: 60px;
    flex-shrink: 0;
}
.mini-post-excerpt {
    color: var(--pico-muted-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* KE Funnel */
.ke-funnel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.funnel-step {
    width: 100%;
}
.funnel-bar {
    padding: 0.6rem 1rem;
    border-radius: 4px;
    font-size: 0.88rem;
    font-weight: 600;
    background: var(--pico-muted-border-color);
    color: var(--pico-color);
    min-width: 120px;
    transition: width 0.3s;
}
.funnel-bar.funnel-new {
    background: rgba(99, 102, 241, 0.25);
}
.funnel-bar.funnel-paid {
    background: rgba(76, 175, 80, 0.3);
}
.funnel-bar.funnel-cancel {
    background: rgba(244, 67, 54, 0.2);
}

@media (max-width: 768px) {
    .charts-grid { grid-template-columns: 1fr; }
    .tg-grid { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .kpi-value { font-size: 1.4rem; }
    .stat-cards-grid { grid-template-columns: 1fr; }
    .stat-big-number { font-size: 1.6rem; }
}
