/* Copyright © 2026 Nathan Barnard / BrickIQ LLC. All rights reserved. */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@600;700&family=Nunito:wght@400;500;600;700&display=swap');

/* =========================================================================
   BrickIQ — Global Styles
   Mobile-first, responsive. Staff use phones at the counter all day.
   ========================================================================= */

:root {
  /* LEGO-themed dark palette — black base, yellow primary */
  --bg-primary:    #0E0E0E;
  --bg-card:       #1A1A1A;
  --bg-input:      #242424;
  --border:        #303030;
  --border-focus:  #F5C400;
  --text-primary:  #F5F5F5;
  --text-secondary:#999999;
  --text-muted:    #555555;
  /* LEGO Yellow — primary accent */
  --accent:        #F5C400;
  --accent-hover:  #D4A900;
  --accent-light:  rgba(245, 196, 0, 0.15);
  --accent-text:   #000000;   /* text ON yellow */
  /* LEGO Green — success */
  --success:       #00A650;
  --success-light: rgba(0, 166, 80, 0.12);
  /* LEGO Orange — warning */
  --warning:       #FF6B00;
  --warning-light: rgba(255, 107, 0, 0.12);
  /* LEGO Red — danger */
  --danger:        #E3000B;
  --danger-light:  rgba(227, 0, 11, 0.12);
  /* LEGO Blue — info */
  --info:          #006CB7;
  --info-light:    rgba(0, 108, 183, 0.15);
  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     14px;
  --shadow:        0 1px 3px rgba(0,0,0,0.5);
  --shadow-lg:     0 4px 16px rgba(0,0,0,0.6);
  --font:          'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display:  'Fredoka', 'Nunito', sans-serif;
  --font-mono:     'SF Mono', 'Fira Code', 'Consolas', monospace;
  --transition:    160ms ease;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100dvh;
}
img { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button { font-family: inherit; cursor: pointer; border: none; }

/* ---------- Layout ---------- */
.page-wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 80px;
}
@media (min-width: 768px) {
  .page-wrap { max-width: 720px; padding: 0 24px 40px; }
}

/* ---------- Header / Nav ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 3px solid var(--accent);
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 100;
}
.topbar-logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text-primary);
}
.topbar-logo span { color: var(--accent); }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--bg-primary);
  z-index: 100;
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px 12px;
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: color var(--transition);
}
.bottom-nav a.active,
.bottom-nav a:hover { color: var(--accent); }
.bottom-nav .nav-icon { font-size: 1.2rem; line-height: 1; }
.desktop-nav {
  display: none;
}
@media (min-width: 768px) {
  .bottom-nav { display: none; }
  .desktop-nav {
    display: flex;
    gap: 4px;
  }
  .desktop-nav a {
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-muted);
    transition: color var(--transition), background var(--transition);
    text-decoration: none;
  }
  .desktop-nav a:hover { color: var(--text-primary); background: var(--bg-card); }
  .desktop-nav a.active { color: var(--accent); background: var(--bg-card); }
}

/* ---------- Page heading ---------- */
.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 24px 0 4px;
  letter-spacing: -0.02em;
}
.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
select,
textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  transition: border-color var(--transition);
  -webkit-appearance: none;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-light);
}
input::placeholder { color: var(--text-muted); }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b92b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  transition: background var(--transition), opacity var(--transition);
  min-height: 48px;  /* touch target */
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  width: 100%;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-sm { padding: 8px 14px; font-size: 0.8125rem; min-height: 36px; }

/* ---------- Badges / Pills ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-high    { background: var(--danger-light);  color: var(--danger); }
.badge-medium  { background: var(--warning-light); color: var(--warning); }
.badge-low     { background: var(--success-light); color: var(--success); }
.badge-info    { background: var(--accent-light);  color: var(--accent); }
.badge-retiring { background: var(--warning-light); color: var(--warning); }
.badge-collector { background: var(--accent-light); color: var(--accent); }

/* ---------- Offer display ---------- */
.offer-box {
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0;
}
.offer-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.offer-range {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}
.offer-sub {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ---------- Set result row ---------- */
.set-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 8px;
}
.set-row-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.set-number {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.set-name { font-weight: 600; margin-bottom: 2px; }
.price-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
  font-size: 0.8125rem;
}
.price-cell { text-align: center; }
.price-label { color: var(--text-muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; }
.price-value { font-weight: 700; font-size: 0.9375rem; margin-top: 2px; }
.price-value.consensus { color: var(--accent); }
.set-note { font-size: 0.8125rem; color: var(--text-secondary); font-style: italic; margin-top: 8px; }

/* ---------- Progress / Stepper ---------- */
.stepper {
  display: flex;
  align-items: center;
  margin: 20px 0 28px;
  gap: 0;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}
.step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 16px;
  left: 50%;
  right: -50%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.step.done:not(:last-child)::after { background: var(--accent); }
.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  z-index: 1;
  position: relative;
}
.step.active .step-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.step.done .step-dot   { background: var(--success); border-color: var(--success); color: #fff; }
.step-label { font-size: 0.6875rem; color: var(--text-muted); margin-top: 6px; text-align: center; }
.step.active .step-label { color: var(--text-secondary); }

/* ---------- Alert card ---------- */
.alert-card {
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid transparent;
}
.alert-card.high   { background: var(--danger-light);  border-color: var(--danger); }
.alert-card.medium { background: var(--warning-light); border-color: var(--warning); }
.alert-card.low    { background: var(--success-light); border-color: var(--success); }
.alert-card-title  { font-weight: 600; margin-bottom: 4px; }
.alert-card-body   { font-size: 0.875rem; color: var(--text-secondary); }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1rem; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 0.875rem; }

/* ---------- Loading ---------- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toast / Feedback ---------- */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-width: calc(100vw - 32px);
  text-align: center;
  animation: toast-in 0.2s ease, toast-out 0.2s ease 2.8s forwards;
}
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger);  color: var(--danger); }
@keyframes toast-in  { from { opacity: 0; transform: translateX(-50%) translateY(8px); } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(-50%) translateY(8px); } }

/* ---------- Divider ---------- */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ---------- Stat grid ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* ---------- Chat bubbles ---------- */
.chat-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0;
}
.bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  line-height: 1.55;
}
.bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-text);
  border-bottom-right-radius: 4px;
}
.bubble.assistant {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

/* ---------- Utility ---------- */
.text-muted    { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success  { color: var(--success); }
.text-warning  { color: var(--warning); }
.text-danger   { color: var(--danger); }
.text-accent   { color: var(--accent); }
.fw-bold       { font-weight: 700; }
.mt-4          { margin-top: 4px; }
.mt-8          { margin-top: 8px; }
.mt-16         { margin-top: 16px; }
.mb-4          { margin-bottom: 4px; }
.mb-8          { margin-bottom: 8px; }
.d-flex        { display: flex; }
.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8         { gap: 8px; }
.w-100         { width: 100%; }
.hidden        { display: none !important; }
