/* TRUE COST Pro — layout.css  (Dark Premium)
   Structure only. NO colour literals — use var() only.
*/

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── App shell ── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: var(--max-width);
  margin: 0 auto;
  position: relative;
  background: var(--color-bg);
}

/* ── Hero banner — removed in dark edition, keep zero height ── */
.app-hero {
  display: none;
}

/* ── Page content area ── */
#page-content {
  flex: 1;
  overflow-y: auto;
  background: var(--color-bg);
  position: relative;
  z-index: 2;
  padding: var(--space-4) var(--space-4) calc(var(--nav-total) + var(--space-6));
}

/* ── Bottom nav ── */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  /* Stays pinned to bottom:0 and grows UPWARD by the inset instead of being
     offset up by it — offsetting would leave a transparent strip under the bar
     with page content scrolling through it, behind the system buttons.
     Everything is border-box, so height must include the padding or the icons
     and labels get squeezed into 62px-minus-the-inset and clip at the top. */
  height: var(--nav-total);
  padding-bottom: var(--safe-bottom);
  display: flex;
  align-items: stretch;
  z-index: 100;
}

/* ── Page header (inside content area) ── */
.page-header {
  padding: var(--space-3) 0 var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ── Cards ── */
.card {
  border-radius: var(--radius-card);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
}

/* Category row cards */
.cat-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  margin-bottom: var(--space-3);
}
.cat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-primary);
}
.cat-card-body { flex: 1; min-width: 0; }
.cat-card-title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
}
.cat-card-sub {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ── Grid helpers ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }

/* ── Form layout ── */
.form-group { margin-bottom: var(--space-4); }
.form-row { display: flex; gap: var(--space-3); }
.form-row .form-group { flex: 1; min-width: 0; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.form-row-3 .form-group { margin-bottom: 0; min-width: 0; }

/* ── Cost row ── */
.cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
}
.cost-row + .cost-row {
  border-top: 1px solid var(--color-border);
}

/* ── Compare grid ── */
.compare-grid {
  display: grid;
  gap: var(--space-3);
  overflow-x: auto;
}
.compare-grid[data-count="2"] { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
.compare-grid[data-count="3"] { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
.compare-grid[data-count="4"] { grid-template-columns: repeat(4, minmax(110px, 1fr)); }

/* ── Utility ── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2  { gap: var(--space-2); }
.gap-4  { gap: var(--space-4); }
.mt-4   { margin-top: var(--space-4); }
.mb-4   { margin-bottom: var(--space-4); }
.text-right { text-align: right; }
.hidden { display: none !important; }
