/* ==========================================================================
   Vendor — shared design system
   Plain CSS, no preprocessor, no build step (shared hosting constraint).
   Loaded once in layouts/app.blade.php; every page adds its own CSS on top.
   ========================================================================== */

:root {
  /* Color: a night-market palette — indigo dusk, marigold stall-light,
     leaf green for "available", coral for anything that needs attention.
     Not the cream+terracotta or near-black+neon defaults. */
  --ink: #1B1F3B;         /* deep indigo — header, nav, headings */
  --ink-soft: #363B63;    /* ink at rest, for secondary dark surfaces */
  --paper: #FBF7EF;       /* warm page background */
  --paper-raised: #FFFFFF;/* cards sit above the paper */
  --marigold: #F2A93B;    /* primary action, price tags */
  --marigold-deep: #D98F1F;
  --leaf: #2E9E5B;        /* available, confirmed, success */
  --coral: #E4572E;       /* dispute, error, destructive */
  --charcoal: #20222B;    /* body text */
  --charcoal-soft: #5B5E6B;/* secondary text */
  --line: #E7DFCB;        /* hairline borders on paper */
  --line-on-ink: rgba(255,255,255,0.16);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Menlo, monospace;

  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-tag: 8px;

  --shadow-card: 0 2px 10px rgba(27, 31, 59, 0.07);
  --shadow-raised: 0 8px 24px rgba(27, 31, 59, 0.14);

  /* Accessibility floor set by the product laws: large tap targets, high
     contrast, nothing smaller than 16px body text. */
  --tap-min: 56px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--charcoal);
  font-size: 16px;
  line-height: 1.5;
  padding-bottom: calc(var(--tap-min) + 24px); /* room for bottom nav */
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.15;
  margin: 0 0 8px;
}

h1 { font-size: 28px; font-weight: 600; }
h2 { font-size: 21px; font-weight: 600; }
h3 { font-size: 17px; font-weight: 600; }

p { margin: 0 0 12px; }

a { color: inherit; }

img { max-width: 100%; display: block; }

button, input, select, textarea { font-family: inherit; font-size: 16px; }

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
}

/* --- Top bar --- */
.topbar {
  background: var(--ink);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar__brand .dot { color: var(--marigold); }

.topbar__action {
  color: #fff;
  text-decoration: none;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* --- Bottom nav: mirrors the app's 5-tab bar, one primary action each --- */
.bottomnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--paper-raised);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 30;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottomnav a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: var(--charcoal-soft);
  font-size: 12px;
  font-weight: 600;
  padding: 10px 4px 8px;
  min-height: var(--tap-min);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.bottomnav a.is-active { color: var(--ink); }
.bottomnav a.is-active .bottomnav__icon { color: var(--marigold-deep); }
.bottomnav__icon { font-size: 20px; line-height: 1; }
.bottomnav__badge {
  position: absolute;
  transform: translate(10px, -10px);
  background: var(--coral);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap-min);
  padding: 14px 22px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 16px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  width: 100%;
}

.btn-primary { background: var(--marigold); color: var(--ink); }
.btn-primary:active { background: var(--marigold-deep); }
.btn-primary:disabled { background: #EFE3CB; color: #A79A78; cursor: not-allowed; }

.btn-dark { background: var(--ink); color: #fff; }
.btn-outline { background: transparent; color: var(--ink); border: 2px solid var(--ink); }
.btn-danger-outline { background: transparent; color: var(--coral); border: 2px solid var(--coral); }
.btn-small { min-height: 44px; padding: 10px 16px; font-size: 14px; width: auto; }

/* --- Cards --- */
.card {
  background: var(--paper-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card + .card { margin-top: 14px; }

/* --- Product card (feed) --- */
.product-card { position: relative; }

.product-card__photo {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--line);
}

.product-card__body { padding: 14px 16px 16px; }

.product-card__vendor {
  font-size: 13px;
  color: var(--charcoal-soft);
  font-weight: 600;
  margin-bottom: 4px;
}

.product-card__name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}

/* Signature element: the price tag — a small stall-sticker shape with a
   die-cut notch, set in mono to read like a hand-marked market price. */
.price-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  background: var(--ink);
  color: #fff;
  padding: 6px 12px 6px 10px;
  border-radius: var(--radius-tag);
  position: relative;
}

.price-tag::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--marigold);
}

.distance-pin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--charcoal-soft);
  font-weight: 600;
}

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.badge-open { background: #E1F3E8; color: var(--leaf); }
.badge-closed { background: #F3E1DC; color: var(--coral); }
.badge-waiting { background: #FDEFD9; color: var(--marigold-deep); }

/* --- Forms --- */
.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 6px;
}

.field input, .field select, .field textarea {
  width: 100%;
  min-height: var(--tap-min);
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper-raised);
  color: var(--charcoal);
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: 3px solid var(--marigold);
  outline-offset: 1px;
  border-color: var(--marigold-deep);
}

.field-hint { font-size: 13px; color: var(--charcoal-soft); margin-top: 6px; }
.field-error { font-size: 13px; color: var(--coral); margin-top: 6px; font-weight: 600; }

/* --- Wallet numbers --- */
.money-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line-on-ink);
}

.money-row:last-child { border-bottom: none; }

.money-row__label { font-size: 14px; color: rgba(255,255,255,0.72); font-weight: 600; }

.money-row__value { font-family: var(--font-mono); font-size: 22px; font-weight: 700; color: #fff; }

.wallet-panel {
  background: var(--ink);
  border-radius: var(--radius-lg);
  padding: 20px 20px 8px;
}

/* --- Toast --- */
#toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--tap-min) + 16px);
  background: var(--ink);
  color: #fff;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 15px;
  box-shadow: var(--shadow-raised);
  z-index: 50;
  transform: translateY(120%);
  transition: transform 0.25s ease;
}

#toast.is-visible { transform: translateY(0); }
#toast.is-error { background: var(--coral); }

/* --- Empty / loading states --- */
.state-block {
  text-align: center;
  padding: 48px 20px;
  color: var(--charcoal-soft);
}

.state-block h3 { color: var(--ink); margin-bottom: 6px; }

/* --- Utility --- */
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mt-24 { margin-top: 24px; }
.center { text-align: center; }
.hidden { display: none !important; }

@media (min-width: 640px) {
  .feed-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .feed-grid .card { margin-top: 0; }
}
