/* FetanCart Mini App. Paper background, Ink text, Teal primary fills,
   Amber as fill only, never text. Dark mode: Ink background, Paper
   text, same Teal and Amber. Space Grotesk display, Inter body, Noto
   Sans Ethiopic for Amharic, all bundled as woff2, with system
   fallbacks that never break layout. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/Inter.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("assets/fonts/SpaceGrotesk.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Noto Sans Ethiopic";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/NotoSansEthiopic.woff2") format("woff2");
  unicode-range: U+1200-137C, U+1380-1399, U+2D80-2D96, U+2D97-2DAF, U+2DA0-2DFF, U+AB01-AB2F;
}

:root {
  --ink: #131022;
  --teal: #00b8a9;
  --teal-deep: #00796b;
  --teal-hover: #00a99a;
  --on-teal: #131022;
  --teal-text: #00796b;
  --amber: #ffb020;
  --amber-deep: #8a5a00;
  --paper: #f7f6f3;
  --muted: #595f6b;
  --danger: #c62f35;
  --success-text: #157347;
  --success-fill: #157347;
  --success-dot: #1f9d63;
  --success: #157347;
  --focus: #131022;
  --bg: var(--paper);
  --text: var(--ink);
  --card: #ffffff;
  --card-border: #e8e6e1;
  --chip: #efede8;
}

:root[data-theme="dark"] {
  --bg: var(--ink);
  --text: var(--paper);
  --card: #1d1a30;
  --card-border: #2e2a47;
  --chip: #262238;
  --muted: #9aa0b0;
  --teal-text: #00b8a9;
  --danger: #f87171;
  --success-text: #34d399;
  --focus: #f7f6f3;
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, "Noto Sans Ethiopic", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, .brand-name, .price, .tab {
  font-family: "Space Grotesk", "Inter", "Noto Sans Ethiopic", -apple-system, "Segoe UI", sans-serif;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

a { color: var(--teal-text); }

/* One centred 640px shell for header, tabs and view. */
.app-header,
.tabs,
.view {
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 8px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex: none;
}

.brand-name {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Tabs as one segmented control: joined segments, no gaps. */
.tabs {
  display: flex;
  gap: 0;
  padding: 8px 16px 12px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}

.tab {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  border-radius: 0;
  padding: 9px 6px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
  min-height: 44px;
  margin-left: -1px;
}

.tab:first-child { border-radius: 12px 0 0 12px; margin-left: 0; }
.tab:last-child { border-radius: 0 12px 12px 0; }

.tab span { font-size: 12px; font-weight: 500; color: var(--muted); }

.tab.active {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--on-teal);
}

.tab.active span { color: var(--on-teal); }

/* At 200% zoom (195px viewport) the three tabs must shrink below
   content width instead of clipping the Settings tab. */
@media (max-width: 360px) {
  .tabs { padding: 8px 8px 12px; }
  .tab { padding: 9px 2px; font-size: 13px; }
}

.view { padding: 4px 16px 96px; }

.view-head { margin: 8px 0 14px; }
.view-head h1 { font-size: 21px; margin: 0 0 2px; line-height: 1.25; }
.view-head p { margin: 0; color: var(--muted); font-size: 13px; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
}

.card h2 { font-size: 17px; margin: 0 0 4px; line-height: 1.3; }
.card h3 { font-size: 15px; margin: 0 0 4px; line-height: 1.4; }

/* Flat section: space and a divider, no border, no radius. */
.flat-section {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin-bottom: 24px;
}

.order-card { cursor: pointer; display: block; text-decoration: none; color: var(--text); }
.order-card:active { transform: scale(0.99); }

.photos { display: flex; gap: 8px; overflow-x: auto; margin: 8px 0; }
.photos img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 12px;
  flex: none;
  background: var(--chip);
}
.photo-placeholder {
  width: 96px;
  height: 96px;
  border-radius: 12px;
  flex: none;
  background: var(--chip);
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-placeholder img { width: 48px; height: 48px; object-fit: contain; opacity: 0.55; }

.meta { color: var(--muted); font-size: 13px; margin: 2px 0; }
.meta b { color: var(--text); font-weight: 600; }

/* Prices are Ink/Paper text, never Amber. */
.price { color: var(--text); font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }
.price-range { color: var(--text); font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-block;
  background: var(--amber);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 10px;
  margin: 2px 4px 2px 0;
}

.badge.teal { background: var(--teal); color: var(--on-teal); }
.badge.amber { background: var(--amber); color: var(--ink); }
.badge.teal-deep { background: var(--teal-deep); color: #ffffff; }
.badge.green, .badge.success { background: var(--success-fill); color: #ffffff; }
.badge.danger { background: var(--danger); color: #ffffff; }
.badge.grey { background: var(--chip); color: var(--muted); }

.stars { color: var(--text); letter-spacing: 1px; font-size: 15px; }
.stars .empty { color: var(--card-border); }

.btn {
  display: inline-block;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  font-family: "Inter", -apple-system, "Segoe UI", sans-serif;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  min-height: 48px;
}

.btn-primary { background: var(--teal); color: var(--on-teal); width: 100%; }
.btn-primary:active { background: var(--teal-deep); color: #ffffff; }
.btn-ghost {
  background: transparent;
  color: var(--teal-text);
  border: 1px solid var(--teal);
  width: 100%;
}
.btn-row { display: flex; gap: 8px; margin-top: 10px; }
.btn-row .btn { flex: 1; }

.bid-card { border: 1px solid var(--card-border); border-radius: 14px; padding: 12px; margin-bottom: 10px; background: var(--card); }
.bid-card.best { border-color: var(--amber); border-width: 2px; }
.bid-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.vendor-name { font-weight: 700; font-size: 15px; }
.vendor-line { color: var(--muted); font-size: 13px; margin: 2px 0; }

.timeline { list-style: none; margin: 8px 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 16px 30px;
  color: var(--muted);
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 20px;
  bottom: 0;
  width: 2px;
  background: var(--card-border);
}
.timeline li:last-child::before { display: none; }
.timeline .dot {
  position: absolute;
  left: 0;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--card-border);
  background: var(--bg);
}
.timeline li.done { color: var(--text); }
.timeline li.done .dot { background: var(--success-dot); border-color: var(--success-dot); }
.timeline li.current { color: var(--text); font-weight: 600; }
.timeline li.current .dot { background: var(--amber); border-color: var(--amber); }

.item-link {
  display: block;
  word-break: break-all;
  font-size: 13px;
  margin: 4px 0;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
}
.empty img { width: 72px; height: 72px; object-fit: contain; opacity: 0.5; margin-bottom: 12px; }

.loading { text-align: center; color: var(--muted); padding: 48px 16px; }

/* Static skeleton blocks in chip colour; no animation. */
.skeleton {
  background: var(--chip);
  border-radius: 12px;
}

.skeleton-list {
  display: grid;
  gap: 12px;
}

.skeleton-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.skeleton-photo {
  width: 72px;
  height: 72px;
  background: var(--chip);
  border-radius: 12px;
}

.skeleton-line {
  height: 14px;
  background: var(--chip);
  border-radius: 7px;
}

.skeleton-line-short {
  width: 55%;
}

/* Integration pass: classes absorbing inline styles from app.js. */
.stat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
}

.stat-divider {
  width: 1px;
  align-self: stretch;
  background: var(--card-border);
}

.section-title {
  font-size: 17px;
  margin: 0 0 8px;
}

.error { color: var(--danger); text-align: center; padding: 32px 16px; }

.review { border-top: 1px solid var(--card-border); padding-top: 10px; margin-top: 10px; }
.review:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.review p { margin: 4px 0 0; }

.stat-grid { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.stat {
  flex: 1;
  min-width: 80px;
  background: var(--chip);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.stat b { display: block; font-size: 17px; }
.stat span { font-size: 12px; color: var(--muted); line-height: 1.3; display: block; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 20;
  max-width: 90vw;
  text-align: center;
  transition: opacity 150ms ease-out;
}

.lang-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  border: 1px solid var(--card-border);
  background: var(--bg);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: "Inter", -apple-system, "Segoe UI", sans-serif;
  cursor: pointer;
  margin-bottom: 8px;
  min-height: 48px;
}

.lang-option.selected {
  border-color: var(--teal-text);
  border-width: 2px;
  padding: 11px 13px;
}

.lang-check { color: var(--teal-text); font-weight: 700; }

/* Hover states, pointer devices only. */
@media (hover: hover) {
  a:hover { text-decoration: underline; }
  .btn-primary:hover { background: var(--teal-hover); }
  .btn-ghost:hover { background: var(--chip); }
  .order-card:hover { border-color: var(--teal-deep); }
  .tab:hover { background: var(--chip); }
  .tab.active:hover { background: var(--teal-hover); }
  .lang-option:hover { background: var(--chip); }
}

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