/* ==========================================================================
   app.css — ProductMatch AI application layout
   A Retail AI MVP by A!thera Partners

   Every value here is derived from the brand tokens defined in brand.css.
   No raw hex, no off-brand spacing — only var(--athera-*) and the brand's
   8/16/24/32/48/64/80/120 spacing scale. Load brand.css BEFORE this file.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--athera-off-white);
  color: var(--athera-charcoal);
  font-family: var(--athera-sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--athera-blue-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Page container — max 1200px, 48px desktop / 24px mobile padding
   -------------------------------------------------------------------------- */

.pm-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
}

.pm-main {
  flex: 1 0 auto;
  width: 100%;
  padding-top: 56px;
  padding-bottom: 96px;
}

/* Section heading block: eyebrow → title → thin blue rule → intro */
.pm-section-head { margin-bottom: 40px; }
.pm-section-head .athera-blue-rule { margin: 20px 0 24px; }
.pm-section-head .pm-intro { max-width: 560px; }

/* --------------------------------------------------------------------------
   Top navigation bar
   -------------------------------------------------------------------------- */

.pm-nav {
  flex: 0 0 auto;
  background: var(--athera-white);
  border-bottom: 1px solid var(--athera-line);
}
.pm-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 48px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.pm-nav-brand {
  display: flex;
  align-items: baseline;
  gap: 16px;
  min-width: 0;
}
.pm-nav-brand .athera-wordmark { font-size: 26px; line-height: 1; }
.pm-nav-product {
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--athera-grey);
  padding-left: 16px;
  border-left: 1px solid var(--athera-line);
  white-space: nowrap;
}

/* Step indicator — Home / Context / Catalogue / Recommendations / Brief */
.pm-steps {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin-top: 0;
  margin-bottom: 0;
}
.pm-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--athera-mono);
  font-size: 11px;
  color: var(--athera-grey-light);
  white-space: nowrap;
}
.pm-step .pm-step-num {
  font-family: var(--athera-mono);
  font-size: 11px;
  color: var(--athera-grey-light);
}
.pm-step .pm-step-label {
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.pm-step-sep {
  width: 16px;
  height: 1px;
  background: var(--athera-line);
}
.pm-step.is-done { color: var(--athera-charcoal-light); }
.pm-step.is-done .pm-step-label { color: var(--athera-charcoal-light); }
.pm-step.is-current .pm-step-num { color: var(--athera-blue-deep); }
.pm-step.is-current .pm-step-label { color: var(--athera-charcoal); }
.pm-step.is-current { position: relative; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.pm-footer {
  flex: 0 0 auto;
  background: var(--athera-navy);
  color: rgba(255, 255, 255, 0.7);
}
.pm-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: start;
}
.pm-footer-line {
  font-family: var(--athera-display);
  font-weight: 300;
  font-size: 22px;
  line-height: 1.3;
  color: #fff;
  letter-spacing: -0.01em;
}
.pm-footer-disclaimer {
  margin-top: 16px;
  max-width: 640px;
  font-family: var(--athera-sans);
  font-size: 13px;
  font-weight: 300;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.55);
}
.pm-footer-emblem {
  width: 40px;
  height: auto;
  opacity: 0.9;
  justify-self: end;
}

/* --------------------------------------------------------------------------
   Shopping-context form controls
   -------------------------------------------------------------------------- */

.pm-form { display: grid; gap: 28px; }
.pm-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 32px;
}
.pm-field { display: flex; flex-direction: column; gap: 8px; }
.pm-field-full { grid-column: 1 / -1; }

.pm-field label {
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--athera-grey);
}
.pm-field .pm-field-hint {
  font-family: var(--athera-sans);
  font-size: 12px;
  font-weight: 300;
  color: var(--athera-grey-light);
  letter-spacing: normal;
  text-transform: none;
}

.pm-input,
.pm-select,
.pm-textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 2px;
  font-family: var(--athera-sans);
  font-size: 15px;
  font-weight: 400;
  color: var(--athera-charcoal);
  transition: border-color 0.2s ease;
}
.pm-textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
.pm-input::placeholder,
.pm-textarea::placeholder { color: var(--athera-grey-light); }
.pm-input:focus,
.pm-select:focus,
.pm-textarea:focus {
  outline: none;
  border-color: var(--athera-blue-deep);
}
.pm-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236B7280' stroke-width='1.2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.pm-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: center;
}

.pm-form-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  padding-top: 8px;
}

/* --------------------------------------------------------------------------
   Catalogue product card
   -------------------------------------------------------------------------- */

.pm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}

.pm-product-card {
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 4px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s ease;
}
.pm-product-card:hover { border-color: var(--athera-mist); }
.pm-product-tile {
  font-size: 40px;
  line-height: 1;
  height: 56px;
  display: flex;
  align-items: center;
}
.pm-product-meta {
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--athera-grey);
}
.pm-product-name {
  font-family: var(--athera-display);
  font-weight: 400;
  font-size: 21px;
  line-height: 1.2;
  color: var(--athera-charcoal);
}
.pm-product-price {
  font-family: var(--athera-sans);
  font-size: 16px;
  font-weight: 500;
  color: var(--athera-charcoal);
}
.pm-product-price .pm-price-was {
  font-weight: 400;
  font-size: 13px;
  color: var(--athera-grey-light);
  text-decoration: line-through;
  margin-left: 8px;
}
.pm-product-foot {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--athera-line-light);
}
.pm-product-rating {
  font-family: var(--athera-mono);
  font-size: 11px;
  color: var(--athera-grey);
}

/* --------------------------------------------------------------------------
   Recommendation card — type badge + relevance score
   -------------------------------------------------------------------------- */

.pm-recs { display: grid; gap: 20px; }

.pm-rec-card {
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 4px;
  padding: 28px 32px;
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 24px;
  align-items: start;
}
.pm-rec-tile {
  font-size: 44px;
  line-height: 1;
}
.pm-rec-body { min-width: 0; }
.pm-rec-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.pm-rec-name {
  font-family: var(--athera-display);
  font-weight: 400;
  font-size: 24px;
  line-height: 1.15;
  color: var(--athera-charcoal);
}
.pm-rec-reason {
  font-family: var(--athera-sans);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.65;
  color: var(--athera-charcoal-light);
  margin: 0 0 12px;
}
.pm-rec-notes {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}
.pm-rec-note {
  display: flex;
  gap: 10px;
  font-family: var(--athera-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--athera-grey);
}
.pm-rec-note .pm-rec-note-label {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--athera-grey-light);
  min-width: 92px;
  padding-top: 1px;
}

/* Recommendation type badge */
.pm-type-badge {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--athera-line);
  border-radius: 2px;
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--athera-charcoal-light);
  background: var(--athera-off-white);
  white-space: nowrap;
}
/* The single most important type is the one that earns the blue accent. */
.pm-type-badge.is-top {
  color: var(--athera-blue-deep);
  border-color: var(--athera-blue-light);
  background: var(--athera-white);
}

/* Relevance score dial */
.pm-score {
  flex: 0 0 auto;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.pm-score-value {
  font-family: var(--athera-display);
  font-weight: 300;
  font-size: 40px;
  line-height: 1;
  color: var(--athera-charcoal);
}
.pm-score-value .pm-score-max {
  font-family: var(--athera-mono);
  font-size: 13px;
  color: var(--athera-grey-light);
}
.pm-score-label {
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--athera-grey);
}
.pm-score-bar {
  width: 84px;
  height: 2px;
  background: var(--athera-line);
  border-radius: 2px;
  overflow: hidden;
}
.pm-score-bar > span {
  display: block;
  height: 100%;
  background: var(--athera-blue);
}

/* --------------------------------------------------------------------------
   Bundle panel & substitutes panel
   -------------------------------------------------------------------------- */

.pm-panel {
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 4px;
  padding: 32px;
}
.pm-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.pm-panel-title {
  font-family: var(--athera-display);
  font-weight: 400;
  font-size: 26px;
  color: var(--athera-charcoal);
}

/* Bundle */
.pm-bundle { display: grid; gap: 20px; }
.pm-bundle-items {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}
.pm-bundle-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--athera-line);
  border-radius: 2px;
  background: var(--athera-off-white);
}
.pm-bundle-item.is-anchor { border-color: var(--athera-blue-light); background: var(--athera-white); }
.pm-bundle-item .pm-bundle-emoji { font-size: 22px; line-height: 1; }
.pm-bundle-item .pm-bundle-name {
  font-family: var(--athera-sans);
  font-size: 13px;
  color: var(--athera-charcoal);
}
.pm-bundle-plus {
  display: flex;
  align-items: center;
  font-family: var(--athera-mono);
  font-size: 14px;
  color: var(--athera-grey-light);
}
.pm-bundle-summary {
  display: flex;
  align-items: baseline;
  gap: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--athera-line-light);
}
.pm-bundle-total {
  font-family: var(--athera-display);
  font-weight: 300;
  font-size: 32px;
  color: var(--athera-charcoal);
}
.pm-bundle-saving {
  font-family: var(--athera-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--athera-blue-deep);
}

/* Substitutes */
.pm-subs { display: grid; gap: 12px; }
.pm-sub-row {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--athera-line-light);
}
.pm-sub-row:last-child { border-bottom: none; }
.pm-sub-emoji { font-size: 28px; line-height: 1; }
.pm-sub-name {
  font-family: var(--athera-display);
  font-weight: 400;
  font-size: 18px;
  color: var(--athera-charcoal);
}
.pm-sub-reason {
  font-family: var(--athera-sans);
  font-size: 13px;
  font-weight: 300;
  color: var(--athera-grey);
  line-height: 1.5;
}
.pm-sub-replaces {
  font-family: var(--athera-mono);
  font-size: 11px;
  color: var(--athera-grey-light);
}

/* --------------------------------------------------------------------------
   Brief layout
   -------------------------------------------------------------------------- */

.pm-brief {
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 4px;
  padding: 48px;
}
.pm-brief-block { padding: 24px 0; border-bottom: 1px solid var(--athera-line-light); }
.pm-brief-block:first-of-type { padding-top: 0; }
.pm-brief-block:last-of-type { border-bottom: none; }
.pm-brief-block .athera-label { display: block; margin-bottom: 10px; }
.pm-brief-text {
  font-family: var(--athera-sans);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.7;
  color: var(--athera-charcoal-light);
  max-width: 680px;
}
.pm-brief-warnings {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.pm-brief-warnings li {
  display: flex;
  gap: 12px;
  font-family: var(--athera-sans);
  font-size: 14px;
  color: var(--athera-charcoal-light);
}
.pm-brief-warnings li::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--athera-amber);
}
.pm-brief-disclaimer {
  margin-top: 32px;
  padding: 20px 24px;
  background: var(--athera-off-white);
  border-left: 1px solid var(--athera-line);
  font-family: var(--athera-sans);
  font-size: 13px;
  font-weight: 300;
  line-height: 1.6;
  color: var(--athera-grey);
}

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

.pm-feedback {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.pm-feedback-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--athera-line);
  border-radius: 2px;
  font-family: var(--athera-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--athera-grey);
  cursor: pointer;
  transition: all 0.2s ease;
}
.pm-feedback-btn:hover { border-color: var(--athera-grey-light); color: var(--athera-charcoal); }
.pm-feedback-btn.is-active {
  border-color: var(--athera-blue-deep);
  color: var(--athera-blue-deep);
  background: var(--athera-white);
}
.pm-feedback-btn:disabled { opacity: 0.55; cursor: default; }

/* --------------------------------------------------------------------------
   Badges — inventory status + confidence
   -------------------------------------------------------------------------- */

.pm-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 2px;
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pm-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Inventory status. Colour is a support cue — the text always carries meaning. */
.pm-badge--in-stock {
  color: var(--athera-blue-deep);
  border-color: var(--athera-blue-light);
  background: var(--athera-white);
}
.pm-badge--low-stock {
  color: var(--athera-amber);
  border-color: var(--athera-amber-light);
  background: var(--athera-white);
}
.pm-badge--out-of-stock {
  color: var(--athera-grey);
  border-color: var(--athera-line);
  background: var(--athera-off-white);
}

/* Confidence. Uses the same restraint — one blue, amber for medium, grey for low. */
.pm-badge--confidence-high {
  color: var(--athera-blue-deep);
  border-color: var(--athera-blue-light);
  background: var(--athera-white);
}
.pm-badge--confidence-medium {
  color: var(--athera-amber);
  border-color: var(--athera-amber-light);
  background: var(--athera-white);
}
.pm-badge--confidence-low {
  color: var(--athera-grey);
  border-color: var(--athera-line);
  background: var(--athera-off-white);
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.pm-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%) translateY(12px);
  z-index: 60;
  max-width: 480px;
  padding: 14px 22px;
  background: var(--athera-navy);
  color: #fff;
  border-radius: 3px;
  border: 1px solid var(--athera-line-dark);
  font-family: var(--athera-sans);
  font-size: 14px;
  font-weight: 300;
  line-height: 1.5;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.pm-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.pm-toast .pm-toast-mark { color: var(--athera-blue); margin-right: 8px; }

/* --------------------------------------------------------------------------
   Small utilities used by screens
   -------------------------------------------------------------------------- */

.pm-stack-8 { display: grid; gap: 8px; }
.pm-stack-16 { display: grid; gap: 16px; }
.pm-stack-24 { display: grid; gap: 24px; }
.pm-stack-48 { display: grid; gap: 48px; }
.pm-muted { color: var(--athera-grey); }
.pm-two-col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  align-items: start;
}

/* --------------------------------------------------------------------------
   Responsive — collapse to 24px padding and single columns on mobile
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .pm-container,
  .pm-nav-inner,
  .pm-footer-inner { padding-left: 24px; padding-right: 24px; }

  .pm-nav-inner { flex-wrap: wrap; gap: 16px; }
  .pm-steps { margin-left: 0; width: 100%; overflow-x: auto; }
  .pm-nav-product { padding-left: 0; border-left: none; }

  .pm-footer-inner { grid-template-columns: 1fr; }
  .pm-footer-emblem { justify-self: start; }

  .pm-field-grid { grid-template-columns: 1fr; }
  .pm-two-col { grid-template-columns: 1fr; }

  .pm-rec-card { grid-template-columns: 1fr; gap: 16px; }
  .pm-score { flex-direction: row; align-items: baseline; gap: 12px; text-align: left; }

  .pm-brief { padding: 28px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
