/* Currency converter - vanilla JS, vanilla canvas chart, mobile-first.
 * Generic patterns (tabs/input/select/actions/field) live in the design
 * system. This file carries: section wrapper, top-form custom layout,
 * result hero card with success/loading/error states, history sub-tabs,
 * stats row, vanilla canvas chart container. */

.cc-section { display: flex; flex-direction: column; gap: 1rem; }

/* ===== Top form (custom 4-col layout on desktop, stack on mobile) ===== */

.cc-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
    background: var(--c-bg-card, #fff);
    border: 1px solid var(--c-line, #e2e8f0);
    border-radius: 12px;
    padding: 1rem 1.1rem;
}

@media (min-width: 720px) {
    .cc-form { grid-template-columns: 1fr 1fr 1fr auto; align-items: end; }
}

/* ===== Result hero card with success/loading/error variants ===== */

.cc-result {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 2px solid #86efac;
    border-radius: 12px;
    padding: 1.4rem 1.2rem;
    margin-top: 0.6rem;
    text-align: center;
}

.cc-result.is-loading {
    background: var(--c-bg, #f8fafc);
    border-color: var(--c-line, #e2e8f0);
    color: var(--c-ink-mute, #64748b);
}

.cc-result.is-error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-color: #fca5a5;
    color: #b91c1c;
}

.cc-result-amount {
    font-size: 2.5rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    font-family: var(--font-mono, ui-monospace, monospace);
    line-height: 1.1;
}

.cc-result-meta {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--c-ink-soft, #334155);
}

.cc-result-meta strong { color: #0f172a; font-family: var(--font-mono, ui-monospace, monospace); }

/* ===== History panel with inner sub-tabs ===== */

.cc-history {
    margin-top: 1.2rem;
    border: 1px solid var(--c-line, #e2e8f0);
    border-radius: 12px;
    background: var(--c-bg-card, #fff);
    padding: 1rem;
}

.cc-history-tabs {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 0.8rem;
    border-bottom: 1px solid var(--c-line, #e2e8f0);
}

.cc-history-tab {
    background: transparent;
    border: none;
    padding: 0.5rem 0.85rem;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--c-ink-soft, #334155);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-family: inherit;
    transition: color 120ms, border-color 120ms;
}

.cc-history-tab:hover { color: var(--c-blue, #0065c0); }
.cc-history-tab.is-active {
    color: var(--c-blue, #0065c0);
    border-bottom-color: var(--c-blue, #0065c0);
    font-weight: 600;
}

/* ===== Stats grid (auto-fit at desktop) ===== */

.cc-history-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

@media (min-width: 720px) {
    .cc-history-stats { grid-template-columns: repeat(4, 1fr); }
}

.cc-stat {
    background: var(--c-bg, #f8fafc);
    border-radius: 8px;
    padding: 0.55rem 0.8rem;
    text-align: center;
}

.cc-stat-label {
    font-size: 0.7rem;
    color: var(--c-ink-mute, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cc-stat-val {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}

.cc-stat.is-positive .cc-stat-val { color: #15803d; }
.cc-stat.is-negative .cc-stat-val { color: #b91c1c; }

/* ===== Vanilla canvas chart container ===== */

.cc-chart-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 7;
    max-width: 100%;
}

.cc-chart-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

@media print {
    .cc-history-tabs { display: none !important; }
    .cc-result, .cc-history { page-break-inside: avoid; }
}
