/* rddash AI Agent — shared design tokens & primitives.
   Audience: internal call-center technicians. Whirlpool-aligned light theme;
   neutral ladder + Universal Yellow accent reserved for insight/citation. */

:root {
  /* surfaces — Whirlpool brand neutral ladder */
  --wp-bg:           #ffffff;
  --wp-white:        #ffffff;
  --wp-surface-2:    #f5f6f7;          /* Extra Light Gray */
  --wp-border:       #dee0e3;          /* Light Gray */
  --wp-divider:      #dee0e3;

  /* text */
  --wp-text:         #484948;          /* brand Black */
  --wp-text-strong:  #484948;
  --wp-text-muted:   #767777;          /* Dark Gray */
  --wp-text-dim:     #9fa0a1;          /* Medium Gray */
  --wp-black:        #000000;          /* primary CTA only */

  /* brand accent — Universal Yellow, restricted to insight + citation */
  --wp-gold:         #EEB111;
  --wp-gold-accent:  #f3d04f;          /* hover */
  --wp-gold-tint:    #fdf7e4;          /* Light Accent Yellow */

  /* rddash semantic (NOT brand) — used sparingly */
  --rd-alert:        #c84141;

  /* layout */
  --wp-radius-card:  10px;
  --wp-radius-soft:  8px;
  --wp-radius-pill:  999px;
  --wp-radius-chip:  4px;
  --wp-pad:          24px;

  /* type stacks */
  --wp-font-display: 'Nunito Sans', system-ui, sans-serif;
  --wp-font-body:    'Open Sans', system-ui, sans-serif;
  --wp-font-mono:    'JetBrains Mono', ui-monospace, monospace;

  /* legacy aliases — kept ONLY so existing inline styles in agent.js
     continue to resolve to brand-aligned values during migration. Remove
     after agent.js renderers are fully rewritten. */
  --rd-bg:           var(--wp-bg);
  --rd-surface-1:    var(--wp-white);
  --rd-surface-2:    var(--wp-surface-2);
  --rd-surface-3:    var(--wp-surface-2);
  --rd-border:       var(--wp-border);
  --rd-border-soft:  var(--wp-border);
  --rd-divider:      var(--wp-divider);
  --rd-text:         var(--wp-text);
  --rd-text-strong:  var(--wp-text-strong);
  --rd-text-muted:   var(--wp-text-muted);
  --rd-text-dim:     var(--wp-text-dim);
  --rd-gold:         var(--wp-gold);
  --rd-gold-soft:    var(--wp-gold);
  --rd-gold-tint:    var(--wp-gold-tint);
  --rd-gold-ring:    rgba(238,177,17,0.45);
  --rd-amber:        var(--wp-gold);
  --rd-red:          var(--rd-alert);
  --rd-red-deep:     var(--rd-alert);
  --rd-green:        var(--wp-text-muted);
  --rd-blue:         var(--wp-text-muted);
  --rd-radius:       var(--wp-radius-card);
  --rd-radius-sm:    var(--wp-radius-soft);
  --rd-radius-xs:    var(--wp-radius-chip);
  --rd-pad:          var(--wp-pad);
  --rd-font:         var(--wp-font-display);
  --rd-mono:         var(--wp-font-mono);
}

/* ── reset (scoped to .rd-root so the canvas isn't polluted) ── */
.rd-root, .rd-root * { box-sizing: border-box; }
.rd-root {
  font-family: var(--wp-font-body);
  color: var(--wp-text);
  background: var(--wp-bg);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.rd-root h1, .rd-root h2, .rd-root h3, .rd-root h4, .rd-root p { margin: 0; }
.rd-root button {
  font-family: inherit; font-size: inherit; border: 0;
  background: transparent; color: inherit; cursor: pointer; padding: 0;
}
.rd-root code, .rd-root .rd-mono {
  font-family: var(--wp-font-mono);
  font-feature-settings: "tnum" 1;
}
.rd-root ::selection { background: var(--wp-gold-tint); color: var(--wp-text-strong); }

/* ── primitives ── */
.rd-card {
  background: var(--wp-white);
  border: 1px solid var(--wp-border);
  border-radius: var(--wp-radius-card);
}
.rd-card-pad { padding: var(--wp-pad); }
.rd-hr { border: 0; border-top: 1px solid var(--wp-divider); margin: 18px 0; }

/* eyebrow / kicker (Nunito Sans Bold ALL CAPS) — used for "Diagnosis Guidance"-style labels */
.rd-eyebrow {
  font-family: var(--wp-font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--wp-text-muted);
}

/* pill */
.rd-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.rd-pill--gold {
  background: var(--rd-gold);
  color: #1a1407;
}
.rd-pill--gold-ghost {
  background: var(--rd-gold-tint);
  color: var(--rd-gold-soft);
  box-shadow: inset 0 0 0 1px var(--rd-gold-ring);
}
.rd-pill--active {
  background: var(--wp-surface-2);
  color: var(--wp-text-strong);
  box-shadow: inset 0 0 0 1px var(--wp-border);
}
.rd-pill--active::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--wp-text-strong);
  animation: pulse-soft 1.6s ease-in-out infinite;
}
.rd-pill--muted {
  background: rgba(148,163,184,0.10);
  color: var(--rd-text-muted);
  box-shadow: inset 0 0 0 1px var(--rd-border);
}
.rd-pill--ok {
  background: var(--wp-surface-2);
  color: var(--wp-text-strong);
  box-shadow: inset 0 0 0 1px var(--wp-border);
}
.rd-pill--amber {
  background: var(--wp-surface-2);
  color: var(--wp-text-strong);
  box-shadow: inset 0 0 0 1px var(--wp-border);
}

/* buttons */
.rd-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 16px;
  border-radius: var(--rd-radius-sm);
  font-weight: 600; font-size: 13px;
  transition: background .14s, color .14s, transform .06s;
}
.rd-btn:active { transform: translateY(1px); }
.rd-btn--primary {
  background: var(--wp-black);
  color: var(--wp-white);
}
.rd-btn--primary:hover { background: var(--wp-text-strong); }
.rd-btn--primary:disabled {
  background: var(--wp-border); color: var(--wp-text-dim); cursor: not-allowed;
}
.rd-btn--ghost {
  background: transparent;
  color: var(--rd-text);
  box-shadow: inset 0 0 0 1px var(--rd-border);
}
.rd-btn--ghost:hover { background: var(--rd-surface-2); }
.rd-btn--danger {
  background: var(--wp-white);
  color: var(--rd-alert);
  box-shadow: inset 0 0 0 1.5px var(--rd-alert);
}
.rd-btn--sm { height: 28px; padding: 0 11px; font-size: 12px; }

/* page-ref / part-number styling — the trust signal.
   small, monospace, subtle gold underline-on-hover so it reads as referenceable. */
.rd-ref {
  font-family: var(--rd-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--rd-gold-soft);
  background: var(--rd-gold-tint);
  padding: 2px 6px;
  border-radius: 4px;
  border-bottom: 1px dashed transparent;
  letter-spacing: -0.01em;
  cursor: help;
  transition: border-color .14s;
}
.rd-ref:hover { border-bottom-color: var(--rd-gold-ring); }
.rd-ref-label {
  font-size: 11px;
  color: var(--rd-text-dim);
  margin-right: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* spinner — a thin ring + a moving arc, slate-tinted */
.rd-spin {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid rgba(72, 73, 72, 0.2);
  border-top-color: var(--wp-text-strong);
  animation: rd-rot .8s linear infinite;
  flex: 0 0 auto;
}
.rd-spin--lg { width: 22px; height: 22px; border-width: 2px; }

@keyframes rd-rot { to { transform: rotate(360deg); } }
@keyframes rd-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .35; transform: scale(.7); }
}
@keyframes rd-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
@keyframes rd-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.rd-fade { animation: rd-fade-in .26s ease-out both; }

/* shimmer placeholder line */
.rd-shimmer {
  background: linear-gradient(90deg,
    rgba(72, 73, 72, 0.04) 0%,
    rgba(72, 73, 72, 0.12) 50%,
    rgba(72, 73, 72, 0.04) 100%);
  background-size: 200% 100%;
  animation: rd-shimmer 1.6s ease-in-out infinite;
  border-radius: 4px;
}

/* numeric — data emphasis through weight, not color */
.rd-num {
  font-family: var(--rd-mono);
  font-weight: 600;
  font-feature-settings: "tnum" 1;
  color: var(--rd-text-strong);
}
.rd-unit {
  font-family: var(--rd-mono);
  font-weight: 400;
  color: var(--rd-text-muted);
  margin-left: 2px;
}

/* scrollbars inside dark cards stay subtle */
.rd-root *::-webkit-scrollbar { width: 8px; height: 8px; }
.rd-root *::-webkit-scrollbar-thumb {
  background: var(--rd-border); border-radius: 4px;
}
.rd-root *::-webkit-scrollbar-track { background: transparent; }

@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.ai-pane {
  background: var(--wp-surface-2);
  border-radius: 12px;
  margin-top: 18px;
  overflow: hidden;
}
.ai-pane-head {
  padding: 28px 32px 16px;
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 24px;
}
.ai-pane-kicker {
  font-family: var(--wp-font-display);
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--wp-text-muted);
  margin-bottom: 6px;
}
.ai-pane-title {
  font-family: var(--wp-font-display);
  font-size: 26px; font-weight: 300;
  color: var(--wp-text-strong);
  line-height: 1.25;
}
.ai-pane-foot {
  padding: 18px 32px 24px;
  border-top: 1px solid var(--wp-border);
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--wp-font-mono);
  font-size: 12px;
  color: var(--wp-text-muted);
}

/* gen-time status pill rendered into #aiPaneStatusSlot by agent.js */
.ai-gen-time {
  font-family: var(--wp-font-body);
  font-size: 13.5px; color: var(--wp-text-muted);
  display: inline-flex; align-items: center; gap: 10px;
}

/* shared pill button system */
.pill {
  height: 40px; padding: 0 20px;
  border-radius: 999px;
  background: var(--wp-black);
  color: var(--wp-white);
  border: 0;
  font-family: var(--wp-font-body);
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background .14s;
}
.pill:hover { background: var(--wp-text-strong); }
.pill--ghost {
  background: transparent;
  color: var(--wp-text-strong);
  border: 1.5px solid var(--wp-text-strong);
}
.pill--ghost:hover { background: var(--wp-text-strong); color: var(--wp-white); }
.pill--sm { height: 34px; padding: 0 16px; font-size: 12.5px; }
.pill:disabled { background: var(--wp-border); color: var(--wp-text-dim); cursor: not-allowed; }

/* Universal Yellow primary CTA — for "primary brand action" buttons like
   Start Listening, Send, Analyze. Matches the producthelp.whirlpool.com /
   owners.html "Appliance Help" pattern. */
.pill--gold {
  background: var(--wp-gold);
  color: var(--wp-text-strong);
}
.pill--gold:hover { background: var(--wp-gold-accent); }
.pill--gold:disabled { background: var(--wp-border); color: var(--wp-text-dim); cursor: not-allowed; }

/* Open Sans Semibold ALL CAPS — brand subhead */
.ai-subhead {
  font-family: var(--wp-font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--wp-text-strong);
  margin-bottom: 12px;
}

/* citation ref pill — one of the two yellow accents allowed on the page */
.ref-pill {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--wp-gold-tint);
  color: var(--wp-text-strong);
  border: 1px solid rgba(238, 177, 17, 0.5);
  font-family: var(--wp-font-mono);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

/* Subtle card lift — Whirlpool consumer surfaces use a faint shadow
   for depth without weight. Apply to cards on the page-bg level. */
.wp-card-lift {
  box-shadow: 0 1px 2px rgba(72, 73, 72, 0.05), 0 2px 8px rgba(72, 73, 72, 0.06);
}
.wp-card-lift:hover {
  box-shadow: 0 1px 2px rgba(72, 73, 72, 0.07), 0 4px 14px rgba(72, 73, 72, 0.08);
}

/* Ask-panel suggestion chip — neutral outline (not yellow) */
.ai-chip {
  height: 36px; padding: 0 16px;
  background: var(--wp-white);
  color: var(--wp-text-strong);
  border-radius: 999px;
  border: 1.5px solid var(--wp-border);
  font-family: var(--wp-font-display);
  font-size: 13.5px; font-weight: 600;
  display: inline-flex; align-items: center;
  cursor: pointer;
  transition: border-color .14s, background .14s;
}
.ai-chip:hover { border-color: var(--wp-text-strong); background: var(--wp-surface-2); }
