/* Currency Exchange: only what is specific to this tool. Shared look lives in ui.css. */

.fx .window-body > * + * { margin-top: var(--space-4); }
.fx.is-loading .fx-main { opacity: 0.6; }

/* From / swap / To */
.fx-pair { display: grid; grid-template-columns: 1fr; gap: var(--space-2); align-items: end; }
.fx-swap {
  justify-self: center; display: inline-grid; place-items: center; width: 44px; height: 44px; margin: 0;
  color: var(--text); background: var(--surface-2); border: 1.5px solid var(--border-strong); border-radius: 50%; cursor: pointer;
  transition: transform 0.25s, background 0.2s;
}
.fx-swap:hover { background: var(--bg); transform: rotate(180deg); }
@media (min-width: 560px) {
  .fx-pair { grid-template-columns: 1fr auto 1fr; gap: var(--space-3); }
  .fx-swap { margin-bottom: 2px; }
  .fx-swap svg { transform: rotate(90deg); }
}
.fx select { text-overflow: ellipsis; }

/* flags */
.fx-flag { display: inline-block; width: 24px; height: 16px; vertical-align: -2px; margin-right: var(--space-2); object-fit: cover; border: 1px solid var(--border-strong); border-radius: 2px; background: var(--surface-2); flex: none; }
.fx-flag[hidden] { display: none; }
.fx-flag-lg { width: 36px; height: 24px; vertical-align: -3px; }
.fx-selectwrap { position: relative; }
.fx-selectwrap .fx-flag { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); margin: 0; pointer-events: none; z-index: 1; }
.fx-selectwrap .fx-flag:not([hidden]) + select { padding-left: 48px; }
.fx-table th .fx-flag { margin-right: var(--space-2); }
.fx-r-name .fx-flag { margin-right: var(--space-2); }

/* result readout */
.fx-result { padding: var(--space-4); background: var(--bg); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.fx-result p { margin: 0; max-width: none; }
.fx-line { font: 600 1rem var(--font-mono); color: var(--muted); overflow-wrap: anywhere; }
.fx-eq { color: var(--accent); margin-left: var(--space-1); }
.fx-main { margin-top: var(--space-1) !important; font: 800 clamp(1.5rem, 6vw, 2.2rem) var(--font-mono); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.fx-names { margin-top: var(--space-2) !important; font-size: 0.9rem; color: var(--muted); }
.fx-rate { margin-top: var(--space-1) !important; font: 0.82rem var(--font-mono); color: var(--muted); }
.fx-names + .fx-rate { margin-top: var(--space-2) !important; }
.fx-result.invalid .fx-main { color: var(--danger); font-size: 1.1rem; letter-spacing: 0; }

.fx-status { margin: 0; max-width: none; font: 0.8rem/1.6 var(--font-mono); color: var(--muted); }
.fx-status .badge { margin-right: var(--space-1); }
.fx-status a { color: var(--muted); }
.fx-status.bad { color: var(--danger); }
.fx-status.bad a { color: var(--danger); }
.fx-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.fx-actions .btn { min-height: 44px; }

/* sections under the converter */
.fx-section { margin-top: var(--space-6); }
.fx-more { margin: var(--space-5) 0 0; max-width: none; font: 0.9rem var(--font-mono); color: var(--muted); }
.fx-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.fx-title { margin: 0; font: 700 0.9rem var(--font-mono); color: var(--muted); }
.fx-title::before { content: "// "; content: "// " / ""; color: var(--prompt); }
.seg-sm { width: auto; }
.seg-sm span { min-height: 34px; padding: 0 var(--space-4); font-size: 0.85rem; white-space: nowrap; }

.fx-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: var(--space-2); list-style: none; padding: 0; margin: 0; }
.fx-list li { margin: 0; max-width: none; }
.fx-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); width: 100%; min-height: 48px;
  padding: var(--space-2) var(--space-3); text-align: left; color: var(--text); font: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
}
.fx-row:hover { border-color: var(--accent); }
.fx-row[aria-current="true"] { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.fx-r-name { font-size: 0.85rem; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-r-val { font: 700 0.95rem var(--font-mono); text-align: right; overflow-wrap: anywhere; }

.fx-table { width: 100%; border-collapse: collapse; font: 0.92rem var(--font-mono); margin: 0; }
.fx-table th, .fx-table td { padding: var(--space-2) var(--space-4); text-align: right; border: 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
.fx-table th { background: var(--surface-2); color: var(--muted); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: none; position: sticky; top: 0; }
.fx-table th:first-child, .fx-table td:first-child { text-align: left; }
.fx-table tbody th { background: none; color: var(--text); font: 700 0.92rem var(--font-mono); position: static; }
.fx-table tr:last-child > * { border-bottom: 0; }
.fx-table td:last-child { font-weight: 700; }
.fx-table tr.is-current td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }

.learn { margin-top: var(--space-7); }
.learn-title { font: 700 0.85rem var(--font-mono); letter-spacing: 0.02em; color: var(--muted); margin: 0 0 var(--space-2); }
.learn-title::before { content: "// "; color: var(--prompt); }
.noscript { color: var(--muted); }

/* rate history */
.fx-readout { margin: 0; min-height: 1.5em; max-width: none; font: 700 0.85rem var(--font-mono); color: var(--text); }
.fx-chart { margin-top: var(--space-2); }
.fxh-svg { display: block; width: 100%; height: auto; max-height: 340px; font-family: var(--font-mono); touch-action: pan-y; }
.fxh-svg:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.fxh-grid { stroke: var(--border); stroke-width: 1; }
.fxh-axis { fill: var(--muted); font-size: 11px; }
.fxh-line { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.fxh-area { fill: color-mix(in srgb, var(--accent) 14%, transparent); stroke: none; }
.fxh-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.fxh-dot { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.fxh-hit { cursor: crosshair; }
.fx-hist-msg { margin: 0; padding: var(--space-6) var(--space-3); text-align: center; font: 0.9rem var(--font-mono); color: var(--muted); }
.fx-hist-msg.bad { color: var(--danger); }
.fx-hstats { display: grid; grid-template-columns: 1fr 1fr; margin: var(--space-3) 0 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
@media (min-width: 700px) { .fx-hstats { grid-template-columns: repeat(4, 1fr); } }
.fx-hstats div { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); }
.fx-hstats dt { font: 0.75rem var(--font-mono); color: var(--muted); }
.fx-hstats dd { margin: 0; font: 700 0.85rem var(--font-mono); overflow-wrap: anywhere; }
.fx-hstats dd.up { color: var(--accent); }
.fx-hstats dd.down { color: var(--danger); }
#fx-history .window-body > * + * { margin-top: var(--space-3); }
