/* ==============================================================================
 * Mentifyll: Töltsd fel az elméd! — Diagram-stílusok (MentiCharts)
 * A public/assets/js/charts.js által generált HTML/SVG-hez. Csak CSS változókat
 * használ (fallback-kel), így a sötét és a világos téma is működik.
 * Készítők: Kormos Attila, Google Gemini és Claude Opus
 * ============================================================================== */

.mc-chart {
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    color: var(--color-card-text, #e2e8f0);
    font-size: 12px;
    line-height: 1.4;
}

.mc-chart *,
.mc-chart *::before,
.mc-chart *::after {
    box-sizing: border-box;
}

.mc-svg {
    display: block;
    max-width: 100%;
    height: auto;
}

.mc-svg text {
    font-family: inherit;
    user-select: none;
    -webkit-user-select: none;
}

/* Az egysoros (inline) sparkline-ra nem kell blokk-elrendezés */
svg.mc-spark {
    display: inline-block;
    vertical-align: middle;
}

/* Üres állapot */
.mc-empty {
    color: var(--color-text-muted, #94a3b8);
}

/* ---------- Jelmagyarázat ---------- */
.mc-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    font-size: 12px;
    line-height: 1.35;
    color: var(--color-card-text, #e2e8f0);
}

.mc-legend li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.mc-dot {
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.mc-lg-label {
    min-width: 0;
    overflow-wrap: anywhere;
}

.mc-lg-val {
    flex: none;
    margin-left: auto;
    padding-left: 8px;
    color: var(--color-text-muted, #94a3b8);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Értékes jelmagyarázat (donut, halmozott sáv): soronként egy elem, jobbra igazított értékkel */
.mc-legend--vals {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 6px;
}

.mc-legend--vals li {
    display: flex;
    width: 100%;
}

/* ---------- Vonal- / oszlopdiagram ---------- */
.mc-line .mc-legend,
.mc-bars .mc-legend {
    justify-content: center;
}

/* ---------- Donut ---------- */
.mc-donut-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px 24px;
}

.mc-donut-wrap > .mc-svg {
    flex: 0 1 auto;
    margin: 0;
}

.mc-donut-wrap > .mc-legend {
    flex: 1 1 170px;
    margin: 0;
    max-width: 100%;
}

/* ---------- Gyűrű: a fix szélességet inline style adja (width:Npx; max-width:100%) ---------- */

/* ---------- Vízszintes sávok ---------- */
.mc-hb-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
    min-width: 0;
}

.mc-hb-row {
    display: grid;
    grid-template-columns: minmax(64px, 34%) minmax(60px, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.mc-hb-label {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mc-hb-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: var(--color-card-text, #e2e8f0);
}

.mc-hb-sub {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    color: var(--color-text-muted, #94a3b8);
}

.mc-hb-bar {
    display: block;
    min-width: 0;
}

.mc-hb-svg {
    display: block;
    width: 100%;
    overflow: hidden;
}

.mc-hb-val {
    min-width: 3ch;
    text-align: right;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--color-card-text, #e2e8f0);
}

/* ---------- Naptár hőtérkép ---------- */
.mc-heatmap-scroll {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.mc-hm-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 6px;
    font-size: 11px;
    color: var(--color-text-muted, #94a3b8);
}

.mc-hm-swatches {
    flex: none;
    display: block;
}

/* ---------- Változásjelző (delta) ---------- */
.mc-delta {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-muted, #94a3b8);
    background: var(--color-surface-variant, #1c263f);
}

.mc-delta.mc-good {
    color: var(--success-fg, #6ee7b7);
    background: var(--success-bg, rgba(16, 185, 129, 0.16));
}

.mc-delta.mc-bad {
    color: var(--danger-fg, #fca5a5);
    background: var(--danger-bg, rgba(239, 68, 68, 0.16));
}

.mc-delta.mc-neutral,
.mc-delta.mc-flat {
    color: var(--color-text-muted, #94a3b8);
    background: var(--color-surface-variant, #1c263f);
}

/* ---------- Nyomtatás: a diagramok színei maradjanak meg ---------- */
@media print {
    .mc-chart,
    .mc-chart *,
    .mc-delta,
    .mc-dot {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .mc-chart {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .mc-heatmap-scroll {
        overflow: visible;
    }
}
