/* Simple, dependency-free styling for the trade calculator. */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #f3f5f7;
  color: #1c2530;
}

header, footer { text-align: center; padding: 20px 16px; }
header { background: #14532d; color: white; }
header h1 { margin: 0 0 6px; font-size: 1.6rem; }
header p { margin: 0; opacity: 0.85; }
footer { color: #6b7785; font-size: 0.85rem; }

main { max-width: 900px; margin: 0 auto; padding: 0 16px; }

section {
  background: white;
  border: 1px solid #dde2e8;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

h2 { margin: 0 0 12px; font-size: 1.1rem; }

/* ---- Ad spots ----
   Space is reserved at the ad's size so the page doesn't jump when it loads. */
.ad {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px auto;
}
.ad-banner { min-height: 90px; }
.ad-box { min-height: 250px; }

/* Phones get the 320x50 banner instead (matches PHONE_MAX_WIDTH in ads.js). */
@media (max-width: 759px) {
  .ad-banner { min-height: 50px; }
}

/* ---- Settings row ---- */
.settings { display: flex; flex-wrap: wrap; gap: 20px; align-items: end; }
.settings label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; font-weight: 600; }
.settings label.checkbox { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 8px; }
select { padding: 6px 8px; font-size: 1rem; }

/* ---- The two trade sides ---- */
.trade {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  background: none;
  border: none;
  padding: 0;
}
.side { background: white; border: 1px solid #dde2e8; border-radius: 8px; padding: 16px; }

.search { position: relative; }
.search input { width: 100%; padding: 8px 10px; font-size: 1rem; border: 1px solid #b6bec8; border-radius: 6px; }

/* Dropdown of search matches */
.results {
  position: absolute;
  left: 0; right: 0;
  z-index: 10;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  background: white;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.results li { padding: 8px 10px; cursor: pointer; }
.results li:hover { background: #e8f5ec; }

/* Assets added to a side */
.assets { list-style: none; margin: 12px 0; padding: 0; min-height: 40px; }
.assets li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #eef1f4; }
.assets .value { font-weight: 600; }
.assets .trend { margin-left: auto; font-size: 0.75rem; white-space: nowrap; }
.trend.up { color: #15803d; }
.trend.down { color: #b42318; }
.load-error { background: #fdeceb; border-color: #e39a94; }
.assets button { border: none; background: none; color: #b42318; font-size: 1.2rem; cursor: pointer; }

.total { margin: 0; text-align: right; }

/* ---- Verdict ---- */
.verdict { text-align: center; }
.verdict h2 { font-size: 1.3rem; margin-bottom: 4px; }
.verdict p { margin: 0; color: #4a5562; }
.verdict.fair   { background: #e8f5ec; border-color: #7cc497; }
.verdict.slight { background: #fff7e0; border-color: #e3c25a; }
.verdict.heavy  { background: #fdeceb; border-color: #e39a94; }

/* ---- Pro teaser ---- */
.pro { opacity: 0.75; }
.pro p { margin: 0; }
.badge { font-size: 0.7rem; background: #14532d; color: white; padding: 2px 8px; border-radius: 10px; vertical-align: middle; }

/* Stack the two sides on phones */
@media (max-width: 640px) {
  .trade { grid-template-columns: 1fr; }
}
