/* ============================================================
   NotePage Order Selector — form skin
   Layers the legacy AngularJS order-form markup onto the live
   NotePage design system (tokens + site.css). The page-hero,
   header, footer and .btn styles come straight from site.css;
   this file only refines the order form itself.
   ============================================================ */

/* ---- Sticky footer: keep the footer at the bottom on short pages ---- */
body { display: flex; flex-direction: column; min-height: 100vh; }
body > ng-view, ng-view { display: block; flex: 1 0 auto; }
.site-header, .site-footer { flex-shrink: 0; }

/* ---- Full-width content, matching the live purchase page (.wrap = 1200) ---- */
.page-hero .wrap { max-width: 1200px; }
.order-wrap { max-width: 1200px; margin: 0 auto; padding: 32px 24px 72px; }

/* The whole order form is ONE price-card: dark product header at the top,
   inner sections as light sub-headers inside the same card. */
.order-content {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  padding: 0;
}
/* Reveal overflow while a dropdown is open so its menu isn't clipped. */
.order-content:has(.cselect.open) { overflow: visible; }

/* Section wrappers are structural only — no card chrome of their own. */
.order-content > div:has(> h2),
.order-content > form > div:has(> h2) {
  background: transparent;
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 0;
}

/* Default heading = light inner sub-section header (not a new card). */
.order-content h2 {
  background: var(--np-gray-50);
  color: var(--np-navy-800);
  margin: 0;
  padding: 11px 20px;
  border: none;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 9px;
}
.order-content h2 svg { width: 16px; height: 16px; color: var(--np-blue-600); flex-shrink: 0; }

/* The FIRST heading (marked .card-head by the enhancer) = dark product header. */
.order-content h2.card-head {
  background: var(--np-navy-800);
  color: #fff;
  padding: 14px 20px;
  border-top: none;
  border-bottom: none;
  /* keep the card's rounded top even when overflow is visible (open dropdown) */
  border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: normal;
  text-transform: none;
  gap: 12px;
}
.order-content h2.card-head svg { width: 22px; height: 22px; color: var(--np-blue-300); }
.order-content input::placeholder { color: var(--np-gray-300); font-variant-numeric: normal; }
.order-content h1 { display: none; } /* legacy centered title, replaced by page-hero */

/* Column header strip (ITEM / PRICE) inserted under each dark header. */
.pt-colhead {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 20px;
  background: var(--np-blue-50);
  border-bottom: 2px solid var(--border-subtle);
  font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--np-navy-700);
}

/* ---- Option rows ---- */
.order-content .spacer-t20 { margin-top: 10px; }

/* Each selectable line = a full-width table row (price-table style). */
.order-content div.spacer-b5,
.order-content .spacer-t20 > .indent {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 12px;
  padding: 11px 20px;
  margin: 0;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0;
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.45;
  transition: background .12s ease, box-shadow .12s ease;
}
/* Last row in a section loses its divider. */
.order-content div.spacer-b5:last-child,
.order-content .spacer-t20 > .indent:last-child,
.order-content .indent > div.spacer-b5:last-child { border-bottom: none; }
/* Inner wrapper that some rows use around input+label+price becomes a flex line */
.order-content div.spacer-b5 > div:not(.text-small),
.order-content .spacer-t20 > .indent > div:not(.text-small) {
  display: flex; align-items: center; gap: 10px; flex: 1 1 100%; min-width: 0;
}
/* The Interfaces .indent is a WRAPPER of rows, not a row itself — reset it. */
.order-content .spacer-t20 > .indent:has(> div.spacer-b5) {
  display: block; padding: 0; margin: 0; border: none; background: transparent;
}
.order-content div.spacer-b5:hover,
.order-content .spacer-t20 > .indent:not(:has(> div.spacer-b5)):hover { background: var(--np-gray-50); }
/* Rows that carry a checkbox read as clickable; their inputs keep their own cursor */
.order-content div.spacer-b5:has(input[type="checkbox"]),
.order-content .spacer-t20 > .indent:has(> input[type="checkbox"]) { cursor: pointer; }
.order-content input, .order-content select, .order-content a { cursor: auto; }
.order-content input[type="checkbox"] { cursor: pointer; }
/* Selected state — highlight rows whose checkbox is ticked */
.order-content div.spacer-b5:has(input[type="checkbox"]:checked),
.order-content .spacer-t20 > .indent:has(> input[type="checkbox"]:checked) {
  background: var(--np-blue-50);
  box-shadow: inset 3px 0 0 var(--np-blue-500);
}

/* Inputs that carry the spacer-b5 class must stay inline, not become rows */
.order-content input.spacer-b5 {
  display: inline-block; position: static;
  padding: 0 10px; margin: 0 6px 0 0; border: 1px solid var(--border-default);
}

/* ---- Checkboxes ---- */
.order-content input[type="checkbox"] {
  width: 17px; height: 17px;
  margin: 0 10px 0 0;
  vertical-align: -4px;
  accent-color: var(--np-blue-600);
  cursor: pointer;
}

/* ---- Price presentation — pushed to the row's trailing edge via flex ---- */
.order-content .indent {
  padding-left: 0;
  color: var(--np-navy-800);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.order-content div.spacer-b5 > .indent,
.order-content div.spacer-b5 > div:not(.text-small) > .indent,
.order-content .spacer-t20 > .indent > .indent,
.order-content .spacer-t20 > .indent > div:not(.text-small) > .indent {
  margin-left: auto;
}
.order-content del { color: var(--text-faint); font-weight: 500; margin-right: 5px; }

/* Sub notes under a row — start at the row's left edge (consistent everywhere) */
.text-small {
  flex-basis: 100%;              /* drop to its own line inside the flex row */
  display: block;
  clear: both;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 6px;
  padding-left: 0;
  line-height: 1.5;
}
.indent-2, .indent-3, .indent-4 { padding-left: 0; }
.text-small.indent-4 { margin-top: 4px; }
.highlight { color: var(--np-green-600); font-weight: 700; }

/* Non-.spacer-b5 option rows (Support Options, Filter, Connectors, etc.) */
.order-content .indent {
  font-weight: inherit;
}
.order-content .spacer-t20 > .indent,
.order-content .indent > div { line-height: 1.6; }

/* ---- Text / tel / number inputs ---- */
.order-content input[type="text"],
.order-content input[type="tel"],
input.qty, input.qty-sm {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-body);
  background: var(--surface-card);
  transition: border-color .12s ease, box-shadow .12s ease;
}
/* Free-text (serial numbers) */
.order-content input[type="text"] { height: 40px; padding: 0 12px; min-width: 280px; }
/* Compact quantity/number controls */
input.qty, input.qty-sm,
.order-content input[type="tel"] {
  height: 32px;
  padding: 0 8px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
  flex: 0 0 auto;
}
input.qty { width: 58px; }
input.qty-sm, .order-content input[type="tel"] { width: 44px; }

/* A line that holds a number input becomes a flex row (box, label, price aligned).
   Excludes section cards (which contain an <h2>) so the whole card isn't flexed. */
.order-content div:has(> input[type="tel"]):not(:has(> h2)) {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
/* Push the price to the trailing edge of that flex line */
.order-content div:has(> input[type="tel"]):not(:has(> h2)) > .indent {
  margin-left: auto;
  float: none;
}
/* "Quantity:" line inside a card */
.qline {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  font-size: 15px; color: var(--text-body); font-weight: 500;
}
/* Tier tables sit inside the card body with breathing room */
.order-content > div:has(> h2) > table,
.order-content > form > div:has(> h2) > table { margin: 4px 20px 18px; }
.order-content > div:has(> h2) > .error { margin: 0 20px 14px; }

/* ---- Loose card content (dropdown pickers, labels, notes) gets row padding ---- */
.order-content > div:has(> h2) > h5,
.order-content > form > div:has(> h2) > h5 {
  margin: 16px 0 6px;
  padding: 0 20px;
  font-family: var(--font-sans);
  font-size: 13px; font-weight: 700; letter-spacing: 0;
  text-transform: none; color: var(--text-strong);
}
.order-content > div:has(> h2) > .cselect,
.order-content > form > div:has(> h2) > .cselect {
  margin: 0 20px 4px;
  width: calc(100% - 40px); max-width: 420px;
}
/* A picker directly under the header (no label above it) needs its own gap */
.order-content h2 + .cselect,
.order-content .pt-colhead + .cselect { margin-top: 18px !important; }
.order-content > div:has(> h2) > p,
.order-content > div:has(> h2) > .text-small,
.order-content > div:has(> h2) > .req-note { margin: 8px 0 4px; padding: 0 20px; }

/* Cards whose body is loose content (no table rows) get bottom breathing room. */
.order-content > div:has(> h2):not(:has(div.spacer-b5)) { padding-bottom: 18px; }

/* Caption paragraph between sections (now inside the single card) */
.order-content > p.text-small,
.order-content > form > p.text-small { margin: 4px 0 14px; padding: 0 20px; color: var(--text-muted); }

/* Notes drop to their own line within a flex row, keeping the label indent */
.order-content div:has(> input[type="tel"]) > .text-small { flex-basis: 100%; }
/* Number-input rows: indent the note to sit under the LABEL (past the wider
   number box + gap), matching how checkbox-row notes sit under their labels. */
/* Notes in stepper rows start at the row's left edge, aligned with the stepper */
.order-content div.spacer-b5:has(input[type="tel"]) > .text-small,
.order-content div.spacer-b5:has(input[type="tel"]) .text-small,
.order-content .spacer-t20 > .indent:has(input[type="tel"]) > .text-small { padding-left: 0; }
.order-content input:hover { border-color: var(--border-strong); }
.order-content input:focus {
  outline: none;
  border-color: var(--np-blue-500);
  box-shadow: var(--ring-focus);
}
/* When a tel/number input carries spacer-b5, don't let it become a padded row */
.order-content input.spacer-b5 { padding: 0 8px; margin: 0 4px 0 0; }

/* Serial-number block: flat padded area inside the card, split by a hairline */
.order-content .spacer-t20:has(> input[type="text"]) {
  background: transparent;
  border: none;
  border-top: 1px solid var(--border-subtle);
  border-radius: 0;
  padding: 18px 20px 20px;
  margin: 0;
  font-size: 14px;
  color: var(--text-strong);
  font-weight: 600;
}
.order-content .spacer-t20:has(> input[type="text"]) input {
  display: block;
  margin-top: 10px;
  width: 100%;
  max-width: 340px;
  font-weight: 400;
}

/* ---- Native select dropdowns (license pickers) ---- */
.order-content select {
  height: 40px;
  min-width: 280px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 0 38px 0 12px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-body);
  background-color: var(--surface-card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231279A0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  cursor: pointer;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.order-content select:hover { border-color: var(--border-strong); }
.order-content select:focus { outline: none; border-color: var(--np-blue-500); box-shadow: var(--ring-focus); }

/* Labels above selects (Current License / Upgrade To) */
.order-content b, .order-content strong { color: var(--text-strong); }

/* ---- Quantity stepper ( − n + ) wrapping the native number input ---- */
.stepper { display: inline-flex; align-items: stretch; flex: 0 0 auto; }
.stepper button {
  width: 30px;
  min-height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-default);
  background: var(--np-gray-50);
  color: var(--np-blue-600);
  font-size: 16px; font-weight: 600; line-height: 1;
  cursor: pointer; padding: 0;
  transition: background .12s ease, color .12s ease;
}
.stepper button:hover { background: var(--np-blue-50); color: var(--np-blue-700); }
.stepper button:active { background: var(--np-blue-100); }
.stepper .st-minus { border-radius: var(--radius-sm) 0 0 var(--radius-sm); border-right: none; }
.stepper .st-plus  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: none; }
.stepper input,
.order-content .stepper input[type="tel"] {
  border-radius: 0;
  margin: 0;
  width: 40px;
  text-align: center;
}
.stepper input:focus { position: relative; z-index: 1; }

/* ---- Custom branded dropdown (wraps the native select) ---- */
.cselect { position: relative; width: 100%; max-width: 420px; }
/* While open, lift the whole control (and its card) above later cards so the
   menu floats cleanly over the next section's dark header. */
.cselect.open { z-index: 90; }
.order-content > div:has(.cselect.open),
.order-content > form > div:has(.cselect.open) { position: relative; z-index: 80; }
.cselect select { display: none !important; }              /* native stays for ng-model */
.cselect-btn {
  width: 100%; height: 42px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 12px 0 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  font-family: var(--font-sans); font-size: 14px; font-weight: 500;
  color: var(--text-body); text-align: left; cursor: pointer;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.cselect-btn:hover { border-color: var(--border-strong); }
.cselect-btn:focus, .cselect.open .cselect-btn {
  outline: none; border-color: var(--np-blue-500); box-shadow: var(--ring-focus);
}
.cselect-btn.placeholder { color: var(--text-faint); font-weight: 400; }
.cselect-btn .chev { flex-shrink: 0; width: 17px; height: 17px; color: var(--np-blue-600); transition: transform .15s ease; }
.cselect.open .cselect-btn .chev { transform: rotate(180deg); }

.cselect-menu {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; right: 0;
  margin: 0; padding: 6px; list-style: none;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 288px; overflow-y: auto;
  display: none;
}
.cselect.open .cselect-menu { display: block; }
.cselect-menu li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-body); cursor: pointer;
  transition: background .1s ease;
}
.cselect-menu li:hover { background: var(--np-gray-50); }
.cselect-menu li.sel { background: var(--np-blue-50); color: var(--np-navy-800); font-weight: 600; }
.cselect-menu li.placeholder { color: var(--text-faint); }
.cselect-menu li .ck { width: 16px; height: 16px; flex-shrink: 0; color: var(--np-blue-600); opacity: 0; }
.cselect-menu li.sel .ck { opacity: 1; }
.cselect-menu li .opt-price { color: var(--np-navy-800); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cselect-menu li .opt-name { flex: 1; }

/* ---- Pricing tier tables ---- */
.order-content table {
  border-collapse: collapse;
  margin: 12px 0 4px;
  font-size: 13.5px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  min-width: 280px;
}
.order-content thead, .order-content th {
  background: var(--np-gray-100);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--np-navy-700);
}
.order-content th, .order-content td {
  text-align: left;
  padding: 8px 16px;
  border-bottom: 1px solid var(--divider);
}
.order-content td { color: var(--text-body); font-variant-numeric: tabular-nums; }
.order-content tr:last-child td { border-bottom: none; }
.order-content tbody tr:hover td { background: var(--np-gray-50); }

/* ---- Error banner ---- */
.error {
  display: flex; align-items: flex-start; gap: 9px;
  background: var(--danger-bg);
  border: 1px solid var(--np-red-500);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  margin: 14px 0;
  color: var(--np-red-600);
  font-size: 14px;
  font-weight: 500;
}

/* ---- Buy button: card footer — tinted action band with divider ---- */
.buy-button {
  display: flex; justify-content: flex-end;
  margin: 0;
  padding: 16px 20px;
  background: var(--np-gray-50);
  border-top: 1px solid var(--border-subtle);
}
.buy-button .btn {
  height: 50px;
  padding: 0 36px;
  font-size: 15.5px;
  font-weight: 700;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.buy-button .btn:hover { box-shadow: var(--shadow-md); }
.buy-button .btn svg, .buy-button .btn i { width: 18px; height: 18px; }

/* ---- Trust bar ---- */
.order-trust {
  display: flex; gap: 14px 26px; flex-wrap: wrap; justify-content: center;
  margin: 26px auto 0; padding-top: 4px;
  font-size: 13px; color: var(--text-muted);
}
.order-trust .ti { display: inline-flex; align-items: center; gap: 7px; }
.order-trust svg { width: 15px; height: 15px; color: var(--np-green-500); }

/* Lock icon flows inline with the sentence so wrapped lines stay attached */
.footnote {
  display: block;
  font-size: 12.5px; text-align: center; color: var(--text-faint);
  margin: 14px auto 0; max-width: 560px; line-height: 1.55;
}
.footnote svg { width: 13px; height: 13px; display: inline-block; vertical-align: -2px; margin-right: 4px; }

.divider { display: none; }
.hidden { display: none; }
.pointer { cursor: pointer; }

/* ============================================================
   Responsive / mobile
   ============================================================ */
@media (max-width: 768px) {
  .page-hero .wrap { padding: 28px 20px; gap: 16px; align-items: center; }
  .page-hero .icon { width: 48px; height: 48px; }
  .page-hero .icon svg { width: 26px; height: 26px; }
  .page-hero h1 { font-size: 26px; line-height: 1.18; letter-spacing: -0.01em; }
  .page-hero p { font-size: 15px; }
  .order-wrap { padding: 24px 16px 56px; }
}

@media (max-width: 560px) {
  .page-hero .wrap { padding: 22px 16px; gap: 12px; align-items: flex-start; }
  .page-hero .icon { width: 40px; height: 40px; border-radius: var(--radius-md); }
  .page-hero .icon svg { width: 22px; height: 22px; }
  .page-hero h1 { font-size: 21px; line-height: 1.22; }
  .page-hero p { font-size: 13.5px; line-height: 1.5; margin-top: 4px; }

  .order-wrap { padding: 18px 12px 48px; }

  /* Headers scale down but keep their bar look */
  .order-content h2 { padding: 10px 14px; font-size: 12px; }
  .order-content h2.card-head { font-size: 14.5px; padding: 12px 14px; gap: 9px; }
  .order-content h2.card-head svg { width: 18px; height: 18px; }
  .pt-colhead { padding: 8px 14px; font-size: 11px; }

  /* Mobile type scale — label + price fit on one line */
  .order-content div.spacer-b5,
  .order-content .spacer-t20 > .indent {
    padding: 10px 14px;
    font-size: 13.5px;
    gap: 2px 8px;
  }
  .order-content .indent { font-size: 14px; }
  .order-content del { font-size: 12.5px; }
  .text-small { font-size: 11.5px; }
  .order-content input[type="checkbox"] { width: 16px; height: 16px; margin-right: 8px; }
  .qline { padding: 12px 14px; }
  .order-content > div:has(> h2) > h5 { padding: 0 14px; }
  .order-content > div:has(> h2) > .cselect { margin: 0 14px 4px; width: calc(100% - 28px); }
  .order-content > div:has(> h2) > table,
  .order-content > form > div:has(> h2) > table { margin: 4px 14px 16px; }

  /* Inputs go full-width and easy to tap */
  .order-content input[type="text"] { min-width: 0; width: 100%; height: 42px; }
  .cselect, .cselect select { max-width: 100%; }
  .cselect-btn { height: 44px; }

  /* Compact number boxes so box + label share a line; note aligns to left edge */
  input.qty, input.qty-sm, .order-content input[type="tel"] { height: 32px; }
  input.qty-sm, .order-content input[type="tel"] { width: 40px; }
  .order-content div.spacer-b5:has(input[type="tel"]) > .text-small,
  .order-content div.spacer-b5:has(input[type="tel"]) .text-small,
  .order-content .spacer-t20 > .indent:has(input[type="tel"]) > .text-small { padding-left: 0; }

  /* Serial-number well spacing */
  .order-content .spacer-t20:has(> input[type="text"]) { padding: 14px; }

  /* Full-width primary action */
  .buy-button { justify-content: stretch; padding-top: 18px; }
  .buy-button .btn { width: 100%; }

  /* Trust bar: tighter, centered */
  .order-trust { gap: 10px 18px; font-size: 12.5px; }
  .footnote { font-size: 12px; padding: 0 6px; }
}

@media (max-width: 380px) {
  .page-hero h1 { font-size: 19px; }
  .order-content h2.card-head { font-size: 13.5px; }
  /* Prices drop under the label on very narrow screens, left-aligned to it */
  .order-content div.spacer-b5 > .indent,
  .order-content div.spacer-b5 > div:not(.text-small) > .indent { margin-left: 27px; }
}
