/* styles.css — Pure HTML & CSS, mobile-first, no JavaScript */
:root{
  --bg:#ffffff;
  --ink:#161616;
  --muted:#6b7280;
  --line:#e6e6e6;
  --accent:#e11d2e;
  --accent-ink:#fff;
  --chip:#f5f5f5;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--ink);
  background:var(--bg);
  font:16px/1.45 system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Helvetica,Arial,sans-serif;
}

/* Topbar */
.topbar{
  position:sticky; top:0; z-index:20;
  display:flex; align-items:center; justify-content:space-between;
  padding:.75rem 1rem; border-bottom:1px solid var(--line);
  background:rgba(255,255,255,.92); backdrop-filter:saturate(180%) blur(10px);
}
.brand{display:flex; align-items:center; gap:.5rem}
.brand .dot{width:.75rem; height:.75rem; background:var(--accent); border-radius:50%}

/* Top-right CSS-only menu */
.kebab{
  position:relative;
}
.kebab summary{
  list-style:none; cursor:pointer; font-size:1.25rem; line-height:1; user-select:none;
  border:1px solid var(--line); border-radius:10px; padding:.3rem .5rem; background:#fff;
}
.kebab[open] summary{background:var(--accent); color:var(--accent-ink); border-color:var(--accent)}
.kebab .menu{
  position:absolute; right:0; margin:.35rem 0 0 0; padding:.35rem; min-width:10rem;
  background:#fff; border:1px solid var(--line); border-radius:10px; box-shadow:0 10px 30px rgba(0,0,0,.08);
}
.kebab .menu li{list-style:none}
.kebab .menu a{display:block; padding:.5rem .6rem; border-radius:.6rem; text-decoration:none; color:var(--ink)}
.kebab .menu a:hover{background:var(--chip)}

/* App wrapper */
.app{max-width:980px; margin:1rem auto; padding:0 1rem}

/* Mode toggle with CSS-only panel switch */
.mode-toggle{display:flex; gap:.5rem; align-items:center; margin:.5rem 0 1rem}
.mode-toggle input[type="radio"]{position:absolute; left:-9999px}
.radio-chip{
  display:inline-block; padding:.5rem .9rem; border:1px solid var(--line); border-radius:999px; cursor:pointer; user-select:none;
}
#mode-offer:checked + label{background:var(--accent); color:var(--accent-ink); border-color:var(--accent)}
#mode-want:checked + label{background:var(--accent); color:var(--accent-ink); border-color:var(--accent)}

.panels{display:grid; gap:1rem}
.card{border:1px solid var(--line); border-radius:12px; padding:1rem; background:#fff}
.h-inline{margin:.1rem 0 .5rem 0}

.row{display:flex; gap:.75rem; align-items:center; margin:.5rem 0; flex-wrap:wrap}
.row.compact{gap:.35rem}
.col{min-width:220px}
.split-vert{display:grid; gap:.5rem; align-content:start}

.label{min-width:92px; font-weight:600}
.input{
  flex:1; min-width:160px; width:100%;
  border:1px solid var(--line); border-radius:10px;
  padding:.6rem .7rem; background:#fff;
}
textarea.input{min-height:96px}
.input--sm{max-width:90px; padding:.35rem .5rem}

.checkbox{display:flex; gap:.45rem; align-items:center; cursor:pointer}
.chip{background:var(--chip); border-radius:999px; padding:.35rem .6rem; border:1px solid var(--line)}
.row-tags{align-items:center}

.muted{color:var(--muted)}

/* Currencies: checkbox -> label button -> number field */
.currencies .currency-grid{
  display:grid; grid-template-columns:auto auto; align-items:center; gap:.45rem .65rem;
}
.currencies .cbox-curr{position:absolute; left:-9999px}
.currencies .currency{
  display:inline-block; padding:.35rem .8rem; border-radius:999px; border:1px solid var(--ink); cursor:pointer; font-weight:700; background:#fff;
}
.currencies .amount{display:none}
/* Reveal the amount only when its preceding checkbox is checked */
#c-H:checked + label + .amount,
#c-MS:checked + label + .amount,
#c-CR:checked + label + .amount,
#c-USD:checked + label + .amount{display:inline-flex}
/* Button active style when checked */
#c-H:checked + label,
#c-MS:checked + label,
#c-CR:checked + label,
#c-USD:checked + label{background:var(--ink); color:#fff}

/* Bottom sticky actions */
.bottom-actions{
  position:sticky; bottom:0; z-index:10;
  display:flex; justify-content:center; gap:.5rem;
  padding:.75rem; margin-top:1rem;
  background:rgba(255,255,255,.95); border-top:1px solid var(--line);
}
.pill{
  display:inline-flex; align-items:center; justify-content:center;
  padding:.6rem 1rem; border-radius:999px; border:1px solid var(--ink);
  background:#fff; font-weight:600; cursor:pointer;
}
.pill.primary{background:var(--accent); color:var(--accent-ink); border-color:var(--accent)}

/* Footer */
.footer{padding:2rem 1rem; text-align:center; color:var(--muted)}

/* Responsive */
@media (min-width:800px){
  .row.exchange{align-items:flex-start}
}

/* CSS-only: toggle panels based on radio state using sibling combinators.
   Structure: [mode radios + labels] [panels]. */
.mode-toggle + .panels #wantArea{display:none}
#mode-want:checked ~ .panels #offerArea{display:none}
#mode-want:checked ~ .panels #wantArea{display:block}
