/* MulkiyaParts — single-layout, mobile-first
   Design rules: no breakpoint branches, 480px card centered desktop,
                 full-width mobile, 16px+ inputs, 44px+ tap targets. */

:root {
  --ink: #0b1f2a;
  --ink-2: #1a3344;
  --muted: #5a6b75;
  --line: #d8dde2;
  --line-soft: #ebeff3;
  --bg: #f4f6f8;
  --card: #ffffff;
  --brand: #0b1f2a;
  --brand-accent: #29ddb9;
  --warn: #b08a00;
  --danger: #a02525;
  --danger-bg: #fdf3f3;
  --warn-bg: #fff8e6;
  --shadow: 0 6px 24px rgba(8, 31, 43, .08), 0 1px 2px rgba(8, 31, 43, .04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100vh; }

/* Page wrapper: card centered, full-width on mobile */
.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.card {
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 32px 28px 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Brand block (logo center on home) */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: inherit;
  gap: 6px;
  margin-top: 4px;
}

.brand-mark {
  width: 120px;
  height: 120px;
  display: block;
}

.brand-mark-sm {
  width: 56px;
  height: 56px;
  display: block;
}

.brand-name {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 6px;
}

.brand-name-sm {
  font-size: 1.05rem;
  font-weight: 700;
}

.brand-tag {
  color: var(--muted);
  font-size: 0.84rem;
  letter-spacing: 0.01em;
}

.brand:has(.brand-mark-sm) {
  flex-direction: row;
  justify-content: flex-start;
  gap: 12px;
  text-align: left;
}

/* Form */
.lookup {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.chassis-input {
  font-size: 16px; /* iOS zoom prevention */
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-family: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 48px;
}

.chassis-input::placeholder {
  color: #a8b1b8;
  font-family: ui-monospace, "SF Mono", monospace;
  letter-spacing: 0.04em;
  text-transform: none;
}

.chassis-input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(11, 31, 42, 0.08);
}

.field-hint {
  color: var(--muted);
  font-size: 0.78rem;
}

.go-btn {
  font-size: 1rem;
  font-weight: 700;
  padding: 14px 20px;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

.go-btn:hover { background: #1a3344; }
.go-btn:active { transform: scale(0.99); }
.go-btn:focus-visible {
  outline: 3px solid var(--brand-accent);
  outline-offset: 2px;
}

/* Flash messages */
.flashes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flash {
  font-size: 0.86rem;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid;
}

.flash-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #f5d4d4;
}

/* Demo examples */
.examples {
  background: #fafbfc;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.84rem;
}

.examples summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-2);
  list-style: none;
  user-select: none;
  padding: 4px 0;
}

.examples summary::-webkit-details-marker { display: none; }
.examples summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.15s;
}

.examples[open] summary::before { transform: rotate(90deg); }

.examples ul {
  margin: 10px 0 0;
  padding: 0 0 0 12px;
  list-style: disc;
  color: var(--muted);
  line-height: 1.6;
}

.examples code {
  font-size: 0.78rem;
  background: #fff;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--line-soft);
  font-family: ui-monospace, monospace;
}

/* Lookup page */
.vehicle-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mulkiya-pill {
  align-self: flex-start;
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border-radius: 99px;
  margin-bottom: 6px;
}

.mulkiya-valid { background: #e3f8ec; color: #186a3b; }
.mulkiya-expiring { background: var(--warn-bg); color: var(--warn); }
.mulkiya-expired { background: var(--danger-bg); color: var(--danger); }

.vehicle-head h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.vehicle-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.chassis-line {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.chassis-line code {
  background: #f0f3f5;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
  background: #fafbfc;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0;
}

.meta-grid > div { display: flex; flex-direction: column; gap: 2px; }
.meta-grid dt {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}
.meta-grid dd {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink);
  font-weight: 600;
}

.parts-title {
  margin: 6px 0 0;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 700;
}

.parts-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.part {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}

.part > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.part b { font-size: 0.92rem; font-weight: 600; }
.part small { color: var(--muted); font-size: 0.76rem; }
.part .oem { font-family: ui-monospace, monospace; }

.part-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-align: right;
  flex-shrink: 0;
}

.part-end .price {
  font-weight: 700;
  font-size: 0.96rem;
  color: var(--ink);
}

.part-end .stock {
  font-size: 0.72rem;
  color: var(--muted);
}

.part-end .stock-low {
  color: var(--warn);
  font-weight: 700;
}

.back-link {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  padding: 10px 0;
}

.back-link:hover { text-decoration: underline; }

/* Not found */
.not-found-title {
  margin: 8px 0 0;
  font-size: 1.3rem;
  font-weight: 700;
}

.not-found-body {
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.not-found-body code {
  font-family: ui-monospace, monospace;
  background: #f0f3f5;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}
