/* ============================================================================
   app-components.css — Mango Upcycle CLIENT app starter kit
   ----------------------------------------------------------------------------
   A small set of dashboard/app components in the mango-upcycle.com brand, for
   the parts the marketing stylesheet doesn't cover (tables, status chips, forms,
   panels, side nav). Load AFTER `mango-site.css` — this file reuses its brand
   tokens (--orange, --blue, --gray-*, --display/--body/--mono).

   This is a STARTER, not the final design — extend it freely, keep the brand
   (orange + navy, DM Serif Display headings, DM Sans body, JetBrains Mono for
   codes/labels). Each block has a usage example above it.
   ============================================================================ */

:root {
  /* app surfaces + radii + a status red, layered on the brand tokens */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --surface:        var(--white);
  --surface-2:      var(--gray-100);
  --border:         var(--gray-200);
  --border-strong:  var(--gray-400);
  --shadow-card:    0 1px 2px rgba(15,15,15,.04), 0 6px 20px rgba(20,48,99,.06);
  --red:            #C0392B;
  --red-tint:       #FBEAE8;
  --app-ink:        var(--blue);          /* navy for primary app text */
}

/* ----------------------------------------------------------------------------
   PANEL / CARD — the box most app content sits in
   <section class="panel">
     <header class="panel-head"><h3 class="panel-title">Pickups</h3></header>
     <div class="panel-body"> … </div>
   </section>
---------------------------------------------------------------------------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.panel-title {
  font-family: var(--display); font-weight: 400; font-size: 18px;
  color: var(--app-ink); margin: 0;
}
.panel-body { padding: 20px; }

/* ----------------------------------------------------------------------------
   DATA TABLE — lists of pickups / devices / invoices
   <table class="data-table">
     <thead><tr><th>Job</th><th>Location</th><th>Date</th><th>Status</th></tr></thead>
     <tbody>
       <tr data-id="…">
         <td class="cell-code" data-bind="pickup.short_name"></td>
         <td data-bind="pickup.office_name"></td>
         <td data-bind="pickup.dropoff_datetime"></td>
         <td><span class="chip chip-processing" data-bind="pickup.status"></span></td>
       </tr>
     </tbody>
   </table>
---------------------------------------------------------------------------- */
.data-table {
  width: 100%; border-collapse: collapse;
  font-family: var(--body); font-size: 14px; color: var(--gray-700);
}
.data-table thead th {
  text-align: left; padding: 11px 16px;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--gray-500);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .12s ease; }
.data-table tbody tr:hover { background: var(--orange-light); cursor: pointer; }
.data-table .cell-code {
  font-family: var(--mono); font-size: 13px; color: var(--app-ink); font-weight: 600;
}
.data-table .cell-num { text-align: right; font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------------------
   STATUS CHIP — a pill with a colored dot, for any status value
   <span class="chip chip-scheduled">Scheduled</span>
   Pick the variant that matches the state; the label can be data-bound.
---------------------------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px; border-radius: 999px;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.02em; line-height: 1;
  background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200);
}
.chip::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gray-400);
}
/* variants — tint background + dot color */
.chip-scheduled  { background: var(--blue-tint);   color: var(--blue);       border-color: #C9D4E8; }
.chip-scheduled::before  { background: var(--blue); }
.chip-processing { background: var(--orange-light); color: var(--orange-dark); border-color: #F6DEB0; }
.chip-processing::before { background: var(--orange); }
.chip-complete   { background: var(--green-tint);  color: var(--green-deep); border-color: #BFE0CB; }
.chip-complete::before   { background: var(--green); }
.chip-attention  { background: var(--red-tint);    color: var(--red);        border-color: #F2C9C4; }
.chip-attention::before  { background: var(--red); }
.chip-closed     { background: var(--gray-100);    color: var(--gray-500);   border-color: var(--gray-200); }
.chip-closed::before     { background: var(--gray-400); }

/* ----------------------------------------------------------------------------
   FORM FIELD — labeled input / select / textarea (onboarding + settings)
   <label class="field">
     <span class="field-label">Company name</span>
     <input class="field-input" type="text" placeholder="Acme Inc.">
     <span class="field-hint">As it should appear on certificates.</span>
   </label>
---------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--gray-500);
}
.field-input, .field-select, .field-textarea {
  width: 100%; box-sizing: border-box;
  font-family: var(--body); font-size: 14px; color: var(--app-ink);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); padding: 10px 13px;
  transition: border-color .15s ease, box-shadow .15s ease; outline: none;
}
.field-input::placeholder, .field-textarea::placeholder { color: var(--gray-400); }
.field-input:focus, .field-select:focus, .field-textarea:focus {
  border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-light);
}
.field-textarea { min-height: 96px; resize: vertical; }
.field-select { appearance: none; cursor: pointer; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B6B6B' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
.field-hint { font-family: var(--body); font-size: 12px; color: var(--gray-500); }

/* ----------------------------------------------------------------------------
   STAT TILE — a single headline number (dashboard "by the numbers")
   <div class="stat"><div class="stat-num" data-bind="impact.ewaste_diverted_lbs"></div>
     <div class="stat-label">Lbs diverted from landfill</div></div>
---------------------------------------------------------------------------- */
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 22px 24px;
}
.stat-num {
  font-family: var(--display); font-weight: 400; font-size: 38px;
  line-height: 1; color: var(--app-ink); letter-spacing: -0.02em;
}
.stat-label {
  margin-top: 10px; font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--gray-500);
}

/* ----------------------------------------------------------------------------
   SIDE NAV ITEM — left navigation in the portal shell
   <a class="nav-item is-active" data-action="view-pickups">
     <span class="nav-item-label">Pickups</span></a>
---------------------------------------------------------------------------- */
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--r-md);
  font-family: var(--body); font-size: 14px; font-weight: 500;
  color: var(--gray-700); text-decoration: none; cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.nav-item:hover { background: var(--gray-100); color: var(--app-ink); }
.nav-item.is-active { background: var(--blue); color: #fff; }

/* ----------------------------------------------------------------------------
   SMALL BUTTON — compact actions inside tables/panels (pairs with mango-site
   .btn / .btn-primary / .btn-secondary for the big CTAs)
   <button type="button" class="btn-sm btn-sm-primary" data-action="download-cert">
     Certificate</button>
---------------------------------------------------------------------------- */
.btn-sm {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-sm);
  font-family: var(--body); font-size: 13px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: all .15s ease;
}
.btn-sm-primary { background: var(--orange); color: var(--black); }
.btn-sm-primary:hover { background: var(--orange-dark); color: #fff; }
.btn-sm-ghost { background: transparent; color: var(--app-ink); border-color: var(--border-strong); }
.btn-sm-ghost:hover { background: var(--surface-2); }
