/* ============================================================
   UOES Tools — shared chrome for the calculator-style pages
   ------------------------------------------------------------
   Used by workload_estimator.html and credit_hour_planner.html.
   Both are wide, multi-column tools built from the same parts:
   a centred header, red section headings, white cards holding
   number/select fields, a results block of stat tiles and a
   breakdown table, and a print view that shows only the report.

   Load order: base.css -> calculator.css -> <page>.css
   Anything the two pages do differently lives in the page file.
   ============================================================ */

* { box-sizing: border-box; }

body {
  font-family: Georgia, serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0 1rem 3rem;
  line-height: 1.5;
}

main { max-width: 1080px; margin: 0 auto; }

header { text-align: center; padding: 2rem 0 1rem; }
h1 { color: var(--red); font-size: 1.9rem; margin: 0 0 .4rem; }
header p { color: var(--muted); margin: .3rem auto; font-size: .95rem; }

h2 {
  color: var(--red);
  font-size: 1.25rem;
  margin: 2rem 0 .75rem;
  border-bottom: 2px solid var(--blue-mid);
  padding-bottom: .3rem;
}

h3 {
  color: var(--red);
  font-size: 1rem;
  margin: 0 0 .75rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 2px solid var(--blue);
  border-radius: 8px;
  padding: 1rem 1.1rem 1.1rem;
}

/* ---- form controls ---- */

.field { margin-bottom: .85rem; }
.field:last-child { margin-bottom: 0; }

label { display: block; font-size: .9rem; margin-bottom: .25rem; }

input[type="number"], select {
  font-family: Georgia, serif;
  font-size: 1rem;
  width: 100%;
  padding: .35rem .1rem;
  color: var(--text);
  background: var(--surface);
  border: none;
  border-bottom: 2px solid var(--blue);
  border-radius: 0;
}
select { padding-right: .5rem; }

/* The focus outline itself comes from base.css; this is the wash on top. */
input[type="number"]:focus, select:focus { background: var(--blue-light); }

.hint { font-size: .8rem; color: var(--muted); margin: .2rem 0 0; }

/* ---- collapsible methodology panels ---- */

details { margin-top: .75rem; font-size: .85rem; }
summary { cursor: pointer; color: var(--blue); }
details .body {
  background: var(--blue-light);
  border-radius: 6px;
  padding: .6rem .7rem;
  margin-top: .5rem;
  color: var(--text);
}
details .body p { margin: 0 0 .55rem; }
details .body p:last-child { margin: 0; }

/* ---- results ---- */

.results {
  background: var(--surface);
  border: 2px solid var(--blue);
  border-radius: 8px;
  padding: 1rem 1.1rem;
}
.totals {
  display: grid;
  gap: .75rem;
  margin-bottom: 1rem;
}
.total {
  background: var(--blue-light);
  border-radius: 8px;
  padding: .8rem;
  text-align: center;
}
.total .num { display: block; font-size: 1.7rem; color: var(--red); font-weight: bold; line-height: 1.2; }
.total .lab { display: block; font-size: .85rem; color: var(--text); }
.total .sub { display: block; font-size: .75rem; color: var(--muted); margin-top: .2rem; }
.total.primary { background: var(--red); }
.total.primary .num { color: var(--surface); }
.total.primary .lab { color: var(--surface); }
.total.primary .sub { color: var(--red-pale); }

/* ---- breakdown table ---- */

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
caption { text-align: left; font-size: .9rem; color: var(--muted); padding-bottom: .4rem; }
th, td { padding: .35rem .4rem; text-align: left; border-bottom: 1px solid var(--blue-mid); }
thead th { background: var(--blue-light); color: var(--text); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: bold; border-top: 2px solid var(--blue); border-bottom: none; }

/* ---- callouts ---- */

.warn {
  background: var(--red-wash);
  border-left: 4px solid var(--red);
  padding: .6rem .8rem;
  margin: .75rem 0;
  font-size: .88rem;
}

/* ---- buttons ---- */

.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
button {
  font-family: Georgia, serif;
  font-size: .95rem;
  padding: .5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid var(--red);
  background: var(--red);
  color: var(--surface);
}
button:hover { background: var(--red-dark); border-color: var(--red-dark); }
button.secondary { background: var(--surface); color: var(--blue); border-color: var(--blue); }
button.secondary:hover { background: var(--blue-light); }

footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--blue-mid);
  font-size: .82rem;
  color: var(--muted);
  text-align: center;
}
footer a { color: var(--blue); }

/* ---- printing: show only the generated report ----
   The hide rule must target `main > :not(#reportWrap)`. An earlier
   `body > ...` selector hid <main> itself and printed a blank page. */
@media print {
  body { background: var(--surface); padding: 0; }
  main > :not(#reportWrap) { display: none !important; }
  #reportWrap { display: block !important; }
  .card, .results { border: 1px solid var(--muted); }
  .total.primary { background: var(--surface); }
  .total.primary .num, .total.primary .lab { color: #000; }
  .actions { display: none !important; }
}
