/* The cars admin page (Slice 3, S2-7). Loaded AFTER admin.css, which supplies the page shell, .details and the .actions
   buttons. No external files (the page's CSP allows only its own origin), no inline styles. Mobile first: one column,
   44px (2.75rem) targets. A state is always a word AS WELL AS a colour or an edge ("On the site", "Sold", "Removed",
   "Error:"), so colour is never the only cue. Contrast is computed in test/admin-cars-ui.test.ts. */

/* The status line below sticks to the top of the screen. Scrolling a focused control into view leaves room above it so the
   line cannot cover it. Measured at 375 px wide: 1.95rem for one line, 4.85rem for three, about 6.3rem for four; the longest
   message the page can show is three lines, so 6.5rem leaves room for one more. */
html { scroll-padding-top: 6.5rem; }

:focus-visible { outline: 3px solid #0b63ce; outline-offset: 2px; }

/* A class that sets display (.hint) would otherwise win over the hidden attribute and show text the page means to hide. */
[hidden] { display: none !important; }

.cars h2, .switch h2 { margin: 1.5rem 0 .5rem; font-size: 1.15rem; }
.cars h3 { margin: 1rem 0 .25rem; font-size: 1.05rem; }
.count-line { margin: 0 0 .5rem; font-size: 1.15rem; font-weight: 700; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 0; }

.hint { display: block; margin: 0 0 .25rem; font-size: .9rem; color: #4a4a46; }

/* The "cars are on or off the site" banner: a heading in words, a coloured edge as a second cue. */
.banner { margin: .5rem 0; padding: .5rem 1rem; border-radius: 6px; }
.banner h2 { margin: .25rem 0; }
.banner p { margin: .25rem 0 .5rem; }
.banner-on { color: #0f3d1c; background-color: #e3f2e7; border-left: 8px solid #1b6e2e; }
.banner-off { color: #4a2f00; background-color: #fff1cc; border-left: 8px solid #b26a00; }

.btn {
  font: inherit;
  min-height: 2.75rem;
  padding: .25rem 1rem;
  border: 2px solid #1a1a1a;
  border-radius: 6px;
  background-color: #ffffff;
  color: #1a1a1a;
  cursor: pointer;
}
.btn:disabled { cursor: progress; }
.btn-primary { background-color: #0b4fa8; color: #ffffff; }

.confirm { margin: .5rem 0; padding: .5rem 1rem; border: 2px solid #1a1a1a; border-radius: 6px; background-color: #ffffff; color: #1a1a1a; }
.confirm p { margin: .25rem 0; font-weight: 700; }
.confirm p.row { margin-top: .75rem; font-weight: 400; }

/* The export links (S2-15): each part is a plain link, as tall as a button. */
.export-parts { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .5rem; }
.export-parts a {
  display: inline-block;
  box-sizing: border-box;
  min-height: 2.75rem;
  padding: .6rem 1rem;
  border: 2px solid #1a1a1a;
  border-radius: 6px;
  background-color: #ffffff;
  color: #0b4fa8;
  font-weight: 700;
}

.tabs { display: flex; gap: .5rem; margin: 1rem 0 .5rem; }
.tabs button {
  flex: 1 1 0;
  font: inherit;
  min-height: 2.75rem;
  padding: .25rem .5rem;
  border: 2px solid #1a1a1a;
  border-radius: 6px;
  background-color: #ffffff;
  color: #1a1a1a;
  cursor: pointer;
}
.tabs button[aria-selected="true"] { background-color: #1a1a1a; color: #ffffff; font-weight: 700; }

/* A car card. On the site: green edge. Sold: grey edge. Removed: dashed outline and quieter colours (no opacity, which
   would lower the computed contrast). */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.car {
  background-color: #ffffff;
  color: #1a1a1a;
  border: 1px solid #c9c9c4;
  border-left: 8px solid #1b6e2e;
  border-radius: 6px;
  padding: .75rem 1rem;
  overflow-wrap: anywhere;
}
.car-sold { border-left: 8px solid #6b6b66; }
.car-removed { color: #4a4a46; background-color: #efefec; border: 2px dashed #6b6b66; }
.car-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .75rem; }
.car-title { margin: 0; font-size: 1.1rem; }
.car-state { padding: 0 .4rem; border: 2px solid currentColor; border-radius: 4px; font-size: .85rem; font-weight: 700; }
.car-days { margin: .25rem 0 0; font-weight: 700; }
.car-note { margin: .5rem 0 0; color: #8a0000; font-weight: 700; }
.photos-note { margin: .5rem 0 0; }
.photos-note summary { padding: .75rem 0; cursor: pointer; }

/* The form. Labels above fields; the hint, the counter and the error are read with the field (aria-describedby). */
.form { margin: .5rem 0 1rem; padding: .25rem 1rem 1rem; border: 2px solid #1a1a1a; border-radius: 6px; background-color: #ffffff; color: #1a1a1a; }
.field { margin: 1rem 0; }
.field label { display: block; font-weight: 700; }
input, textarea {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  margin: .25rem 0;
  padding: .4rem .6rem;
  font: inherit;
  color: #1a1a1a;
  background-color: #ffffff;
  border: 2px solid #5f5f5a;
  border-radius: 6px;
}
.counter { display: block; font-size: .9rem; color: #4a4a46; }
.counter.over { color: #8a0000; font-weight: 700; }
.field-error { display: block; color: #8a0000; font-weight: 700; }
.notice { margin: .5rem 0; padding: .25rem 1rem; border-left: 8px solid #b26a00; border-radius: 6px; color: #4a2f00; background-color: #fff1cc; }

/* The photo section, inside the edit form (S2-8). Each photo is a card: thumbnail, then its fields, then its buttons. A result is
   always a word as well as a colour ("Added", "Not added."), so colour is never the only cue. */
select {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  margin: .25rem 0;
  padding: .4rem .6rem;
  font: inherit;
  color: #1a1a1a;
  background-color: #ffffff;
  border: 2px solid #5f5f5a;
  border-radius: 6px;
}
input[type="file"] { padding: .4rem .5rem; }
.photos { margin: 1.5rem 0 0; padding-top: .25rem; border-top: 2px solid #c9c9c4; }
.photos h3, .photos h4 { margin: 1rem 0 .25rem; }
.photos h4 { font-size: 1rem; }
.photo-add { margin: 1rem 0; padding: .25rem 1rem .75rem; border: 1px solid #c9c9c4; border-radius: 6px; }
.uploads { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .5rem; }
.upload { padding: .4rem .75rem; border: 1px solid #c9c9c4; border-left: 8px solid #6b6b66; border-radius: 6px; overflow-wrap: anywhere; background-color: #ffffff; color: #1a1a1a; }
.upload-name { font-weight: 700; }
.upload-ok { color: #0f3d1c; background-color: #e3f2e7; border-left: 8px solid #1b6e2e; }
.upload-bad { color: #8a0000; background-color: #ffffff; border-left: 8px solid #8a0000; }
.photo-list { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .75rem; }
.photo { display: grid; gap: .5rem; padding: .75rem 1rem; background-color: #ffffff; color: #1a1a1a; border: 1px solid #c9c9c4; border-left: 8px solid #6b6b66; border-radius: 6px; overflow-wrap: anywhere; }
.photo-thumb { display: block; width: auto; max-width: 100%; height: auto; max-height: 14rem; border-radius: 4px; background-color: #efefec; }
.photo-pos { margin: 0; font-weight: 700; }
.photo-error { display: block; color: #8a0000; font-weight: 700; }
.photo .field { margin: .5rem 0; }
.photo .actions { margin-top: .25rem; }

/* The status line stays in view while the list scrolls, so a result ("Civic is marked sold") is not left off-screen on a phone. */
#message { position: sticky; top: 0; z-index: 1; padding: .25rem 0; background-color: #f4f4f2; }
