/* =====================================================================
 * shared/styles.css  —  Macy's red-theme intake form (ported from jul4)
 * Vanilla CSS, no Bootstrap dependency — but the layout metrics below
 * (container widths, 12-col grid, control padding, button sizes) are
 * copied from Bootstrap 4 so the page renders pixel-close to the legacy
 * jul4/july4 promo pages.
 * ===================================================================== */

:root {
  --macys-red: #E01E2D;
  --macys-red-dark: #bd1824;
  --ink: #212529;
  --muted: #6c757d;
  --line: #ced4da;
  --bg-light: #fff;
  --radius: 0.25rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  line-height: 1.5;
}

img { max-width: 100%; height: auto; }

/* Bootstrap-reboot parity: form controls inherit the page font. Without this
   buttons render in the UA default (Arial) and date inputs in monospace —
   visibly different from the legacy Bootstrap pages. Weight intentionally
   NOT inherited (reboot behavior: controls stay 400 inside the 500 section). */
button, input, select, textarea {
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

h3, h4, h5 { font-weight: 500; line-height: 1.2; margin: 0 0 0.5rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }

/* Bootstrap-4 responsive container (legacy pages rely on these widths) */
.container {
  width: 100%;
  padding: 0 15px;
  margin: 0 auto;
}
@media (min-width: 576px)  { .container { max-width: 540px; } }
@media (min-width: 768px)  { .container { max-width: 720px; } }
@media (min-width: 992px)  { .container { max-width: 960px; } }
@media (min-width: 1200px) { .container { max-width: 1140px; } }

a, a:active, a:visited, a:hover { color: var(--macys-red); }

/* ---- Red theme blocks ---- */
.fullBg {
  background-color: var(--macys-red);
  color: #fff;
  font-weight: 500;
}
.whiteBg { background: #fff; }

/* ---- Header / intro ---- */
.intro { text-align: center; padding-top: 1rem; }
.intro h3 { margin: 0 0 1rem; padding-bottom: 1rem; }
.intro p { margin: 0 0 1rem; }
.intro .other-promo { margin: 1.5rem 0; }
.header-img { display: block; margin: 0 auto 1.5rem; }
/* Text banner alternative to header.png (config.json `headerTitle`). Colors
   through the theme var so Bloomies programs render it navy automatically. */
.header-title {
  margin: 0 auto 1.5rem;
  text-align: center;
  color: var(--macys-red);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ---- Buttons (Bootstrap 4 metrics) ---- */
.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  background: #e9ecef;
  color: var(--ink);
  transition: background-color 0.15s ease-in-out;
}
.btn:hover { background: #dde1e5; }
.btn.fullBg { background-color: var(--macys-red); color: #fff; font-weight: 500; }
.btn.fullBg:hover { background-color: var(--macys-red-dark); color: #fff; font-weight: 500; }
.btn.btn-light { background: #f8f9fa; color: var(--ink); border-color: #f8f9fa; }
.btn.btn-light:hover { background: #e2e6ea; }
.btn.btn-secondary { background: var(--muted); color: #fff; border-color: var(--muted); }
.btn.btn-secondary:hover { background: #5a6268; }
/* legacy submit = .btn-lg.px-5 (large + extra-wide) */
.btn-lg { padding: 0.5rem 3rem; font-size: 1.25rem; line-height: 1.5; border-radius: 0.3rem; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* ---- Red form section (legacy: section.fullBg.pt-5.pb-2) ---- */
.form-section {
  background-color: var(--macys-red);
  color: #fff;
  /* legacy section is .fullBg, whose font-weight:500 the whole form inherits */
  font-weight: 500;
  padding: 3rem 0 0.5rem;
}
.form-section h4 { margin: 0 0 0.5rem; padding: 0 15px; }
.form-section .section-heading { padding-top: 0.5rem; }
.form-section a { color: #fff; text-decoration: underline; }

/* ---- 12-column grid (matches Bootstrap .form-group.row + .col-md-*) ---- */
.frow {
  display: flex;
  flex-wrap: wrap;
  /* Bootstrap .row pulls -15px against the container's 15px padding, so the
     columns span the full container width (1140 at xl, not 1110). */
  margin: 0 -15px 1rem;
}
.frow > [class*="fcol"] {
  padding: 0 15px;
  width: 100%;
  min-width: 0;
}
/* labels: Bootstrap .col-form-label. The `.frow > .flabel` variant matters:
   it out-specifies `.frow > [class*="fcol"]` above, which would otherwise
   zero the vertical padding and leave labels sitting high of their fields. */
.flabel,
.frow > .flabel {
  display: block;
  margin: 0;
  padding: calc(0.375rem + 1px) 15px;
  font-size: 1rem;
  line-height: 1.5;
  width: 100%;
}
@media (min-width: 768px) {
  .flabel { text-align: right; }
  .frow > .fcol-md-1  { width: 8.3333%; }
  .frow > .fcol-md-2  { width: 16.6667%; }
  .frow > .fcol-md-3  { width: 25%; }
  .frow > .fcol-md-4  { width: 33.3333%; }
  .frow > .fcol-md-5  { width: 41.6667%; }
  .frow > .fcol-md-6  { width: 50%; }
  .frow > .fcol-md-7  { width: 58.3333%; }
  .frow > .fcol-md-8  { width: 66.6667%; }
  .frow > .fcol-md-10 { width: 83.3333%; }
  .frow > .fcol-md-12 { width: 100%; }
}
/* legacy styles.css: shrink labels a touch on mid-size screens */
@media (max-width: 992px) and (min-width: 768px) {
  label { font-size: 0.8rem !important; }
}
.mx-auto { margin-left: auto !important; margin-right: auto !important; }
.text-center { text-align: center !important; }

/* ---- Controls (Bootstrap 4 .form-control / .custom-select metrics) ---- */
.form-control,
.custom-select {
  display: block;
  width: 100%;
  /* Bootstrap pins control height; without it date inputs render 2px taller
     than text inputs (the native calendar affordance pads them out). */
  height: calc(1.5em + 0.75rem + 2px);
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  color: #495057;
  background-color: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
/* Bootstrap custom-select caret (legacy selects don't show the native arrow) */
.custom-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 1.75rem;
  background: #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='4' height='5' viewBox='0 0 4 5'%3e%3cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3e%3c/svg%3e") no-repeat right 0.75rem center / 8px 10px;
}
.form-control:focus,
.custom-select:focus {
  outline: none;
  border-color: var(--macys-red);
  box-shadow: 0 0 0 0.15rem rgba(224, 30, 45, 0.25);
}
/* A missed field keeps its amber ring even while focused (the first miss is
   auto-focused on submit — without this the most important ring vanished). */
.form-control.field-error:focus,
.custom-select.field-error:focus {
  outline: 3px solid #ffc107;
  border-color: #ffc107;
  box-shadow: 0 0 0 0.15rem rgba(255, 193, 7, 0.35);
}

/* ---- Radios (legacy custom-radio blocks are inline) ---- */
.radio-group { display: inline-block; }
.radio-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0;
}
.radio-inline + .radio-inline { padding-left: 3rem; padding-right: 3rem; }
/* 1rem radios match the legacy Bootstrap custom-radio size (native radios
   are ~13px); accent-color reproduces its primary-blue checked state. */
.radio-inline input { width: 1rem; height: 1rem; margin: 0; accent-color: #007bff; }
.hint { font-size: 80%; font-style: italic; display: inline-block; }

/* ---- Delivery method (new digital option — no legacy counterpart) ---- */
.delivery-group { margin-bottom: 1rem; text-align: center; }
.delivery-group .radio-inline + .radio-inline { padding-left: 2rem; padding-right: 0; }

/* ---- File upload + preview (legacy input-group: [Browse...][filename]) ---- */
.file-hidden { position: absolute; visibility: hidden; width: 0; height: 0; }
.input-group { display: flex; width: 100%; }
.input-group .btn {
  flex: 0 0 auto;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.input-group .filename-box {
  flex: 1 1 auto;
  width: 1%;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  background: #fff;
}
.img-thumbnail {
  padding: 0.25rem;
  background-color: #fff;
  border: 1px solid #dee2e6;
  border-radius: var(--radius);
  max-width: 100%;
  height: auto;
}

/* ---- Reward display ---- */
.reward-label {
  display: block;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
  min-height: 1.5rem;
}

/* ---- Submit ---- */
.submit-row { text-align: center; padding: 0.25rem 0 1rem; }
.submit-row .btn { margin: 1.5rem 3rem 0.5rem; }
.submitting { display: none; margin-top: 2rem; font-size: 1.15rem; }
/* Motion while the submit is in flight — the receipt payload can take a few
   seconds on a slow uplink, and a static "Submitting..." reads as frozen. */
.submitting .spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  margin-right: 0.6rem;
  vertical-align: -0.25rem;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: gwp-spin 0.75s linear infinite;
}
@keyframes gwp-spin { to { transform: rotate(360deg); } }

/* ---- Modal (mirrors Bootstrap centered modal) ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff;
  color: var(--ink);
  border-radius: 0.3rem;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid #e9ecef;
}
.modal-head h5 { margin: 0; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #000;
  opacity: 0.5;
}
.modal-close:hover { opacity: 0.8; }
.modal-body { padding: 1rem; text-align: center; }
.modal-body .frow { margin-bottom: 0.5rem; }
.modal-body .flabel { padding-left: 0; }

/* ---- Alerts (Bootstrap 4, for the success/error status pages) ---- */
.alert {
  padding: 0.75rem 1.25rem;
  margin: 1.5rem auto 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  max-width: 640px;
}
.alert-success { color: #155724; background-color: #d4edda; border-color: #c3e6cb; }
.alert-danger  { color: #721c24; background-color: #f8d7da; border-color: #f5c6cb; }

/* ---- Terms section ---- */
.terms { padding: 3rem 0; }
.terms .cols { display: flex; flex-wrap: wrap; }
.terms .col { flex: 1 1 300px; padding: 0 15px; }
.terms ul { padding-left: 2.5rem; }
.terms .heading { font-weight: 700; text-transform: uppercase; }
.terms .legal { font-size: 12px; display: block; margin-top: 1.5rem; padding: 0 15px; }
.red { color: red; }

/* ---- Status pages (success / error) ---- */
.status-page { text-align: center; padding: 1rem 15px 3rem; }
.status-page h3 { margin-top: 1rem; }
.status-page .cs-ref {
  display: inline-block;
  font-size: 1.25rem;
  font-weight: 700;
  background: #f8f9fa;
  border: 1px dashed var(--macys-red);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  margin: 0.5rem 0 1rem;
  letter-spacing: 0.05em;
}
.status-page.error h3 { color: red; }

/* ---- Validation surface ---- */
/* Missed-field marks: amber, not red — a red border is invisible against the
   red form section (and the navy Bloomies one). Radio groups and the receipt
   uploader have no input box of their own, so they get a group-level ring. */
.field-error {
  border-color: #ffc107 !important;
  background: #fffdf0;
  outline: 3px solid #ffc107;
  outline-offset: 1px;
}
.group-error {
  outline: 3px solid #ffc107;
  outline-offset: 4px;
  border-radius: var(--radius);
}
.form-error-banner {
  display: none;
  background: #fff3cd;
  color: #664d03;
  border: 2px solid #ffc107;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0 15px 1rem;
  font-weight: 600;
}
.form-error-banner.show { display: block; }

/* =====================================================================
 * Bloomingdale's theme — applied when config.json sets "retailer":
 * "bloomies" (app.js adds this class to <body>). Every accent in the
 * sheet routes through the two custom properties, so overriding them
 * here restyles the whole page. Navy matches the legacy BLM promo CSS
 * (#063d71); the dark variant is our hover shade (legacy reused the
 * same color for hover).
 * ===================================================================== */
body.theme-bloomies {
  --macys-red: #063d71;
  --macys-red-dark: #04294d;
}
