/* ============================================================
   Euro Shed Parts — UI polish pass
   Loaded AFTER styles.css. Component overrides + new components
   for the bottom tab bar, header settings link, brand/category
   chip rails, stock filter, active-filter summary, empty states,
   day-focused dashboard, and 44px tap targets.
   ============================================================ */

/* ============ Bottom tab bar ============ */
.tab-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  display: flex;
  align-items: stretch;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 -1px 12px rgba(0, 0, 0, 0.06);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab-item {
  position: relative;
  flex: 1 1 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  min-height: 56px;
  padding: 6px 4px 5px;
  color: var(--muted);
  font-size: 11.5px; font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease;
}
.tab-item .tab-icon {
  width: 24px; height: 24px;
  color: var(--muted);
  transition: color 0.15s ease;
}
.tab-item:hover { color: var(--ink); }
.tab-item:hover .tab-icon { color: var(--ink); }
.tab-item.active { color: var(--gold-dark); }
.tab-item.active .tab-icon { color: var(--gold); }
.tab-item.active::after {
  content: "";
  position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  width: 26px; height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--gold);
}

/* Header settings link (replaces the old horizontal nav strip) */
.header-settings {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: 10px;
  color: #cfcfd2; font-size: 20px; line-height: 1;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease, background 0.15s ease;
}
.header-settings:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.header-settings.active { color: var(--gold); background: rgba(212, 168, 67, 0.13); }

/* Keep content clear of the fixed tab bar */
.app-main { padding-bottom: 96px; }
.auth-page .app-main { padding-bottom: 48px; }

/* Hide chrome on print + login */
@media print {
  .tab-bar, .app-header, .toast { display: none !important; }
}
.auth-page .tab-bar { display: none; }

/* ============ Brand / category chip rails ============ */
.chip-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 6px;
  scrollbar-width: none;
}
.chip-rail::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font-size: 13px; font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}
.chip:hover { background: #f0f0f2; }
.chip:active { transform: scale(0.98); }
.chip.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #1a1a1a;
}

/* Search box with a custom clear (✕) button */
.search-wrap { position: relative; }
.search-input { padding-right: 52px; }
.search-clear {
  position: absolute; right: 2px; top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  border: none; background: transparent; color: var(--muted);
  font-size: 15px; line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}
.search-clear:hover { background: #f0f0f2; color: var(--ink); }

/* ============ Stock filter (segmented) ============ */
.stock-filter {
  margin-top: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.stock-filter::-webkit-scrollbar { display: none; }
.stock-filter .seg-btn {
  min-height: 44px;
  padding: 10px 8px;
  font-size: 12px;
}
.stock-filter .seg-btn.active {
  background: var(--gold);
  color: #1a1a1a;
}

/* ============ Active-filter summary ============ */
.filter-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 2px;
}
.filter-summary .summary-label {
  font-size: 13px; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.clear-filters {
  border: none; background: transparent;
  display: inline-flex; align-items: center;
  min-height: 44px;
  padding: 0 6px;
  font-size: 13px; font-weight: 700;
  color: var(--gold-dark);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.clear-filters:hover { text-decoration: underline; }

/* ============ Empty states ============ */
.empty-state {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 24px;
  text-align: center;
}
.empty-state .es-icon {
  width: 52px; height: 52px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #f0f0f2;
  color: var(--muted);
  display: grid; place-items: center;
  font-size: 24px;
}
.empty-state h3 { font-size: 17px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.empty-state p { font-size: 13.5px; color: var(--muted); margin-bottom: 18px; }
.empty-state .btn { min-height: 44px; }

/* ============ Parts & Prices rows (design spec 4) ============ */
.parts-scroll .drow { min-height: 56px; }
.parts-scroll .p-name { font-size: 16px; font-weight: 600; }
.parts-scroll .p-meta { font-size: 12px; }
.pl-row { min-height: 56px; }
.pl-name { font-size: 16px; font-weight: 600; }

/* ============ Dashboard: day stats + recent list ============ */
.stat-card {
  min-height: 96px;
  display: flex; flex-direction: column; justify-content: center;
}
.recent-list { display: flex; flex-direction: column; gap: 8px; }
.recent-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 16px;
  min-height: 56px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.recent-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 10px 26px rgba(0, 0, 0, 0.07);
}
.recent-main { flex: 1 1 auto; min-width: 0; }
.recent-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-price { flex: 0 0 auto; text-align: right; font-size: 14.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.recent-price .recent-gbp { display: block; font-size: 11px; font-weight: 500; color: var(--faint); }

/* ============ Tap targets (≥44px) ============ */
.btn { min-height: 44px; }
.btn-sm { min-height: 44px; padding: 10px 14px; }
.btn-lg { min-height: 48px; }
.seg-btn { min-height: 44px; }
.input, .select, .textarea { min-height: 48px; }
.item-remove { width: 44px; height: 44px; }
.item-row { grid-template-columns: 1fr 64px 118px 44px; }
.ta-item { padding: 12px 14px; }
.hint-btn {
  display: inline;
  padding: 12px 4px;
  margin: -12px -4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ============ Focus visible (a11y) ============ */
.chip:focus-visible, .btn:focus-visible, .tab-item:focus-visible,
.seg-btn:focus-visible, .clear-filters:focus-visible, .search-clear:focus-visible,
.header-settings:focus-visible, .item-remove:focus-visible, .ta-item:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ============ Responsive ============ */
@media (max-width: 640px) {
  .item-row { grid-template-columns: 1fr 58px 100px 44px; }
}
@media (max-width: 380px) {
  .item-row { grid-template-columns: 1fr 54px 90px 44px; }
}
