/*
 * Minimal global tweaks layered on top of Django Unfold's compiled theme (unfold/css/styles.css),
 * which provides the palette + utility classes used across the templates.
 */
[x-cloak] { display: none !important; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0;
}

/* Unfold's purged build omits focus:ring utilities, so give inputs/buttons a visible focus state. */
input:focus,
button:focus-visible {
  outline: 2px solid var(--color-primary-600, #7c3aed);
  outline-offset: 1px;
}

/* Catalog (feature 012) — the responsive lot-card grid and filter inputs
 * use custom rules because Unfold's purged Tailwind build lacks the
 * grid-cols/form utilities. */
.dd-lot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
}
.dd-input,
.dd-select {
  width: 100%;
  padding: 0.375rem 0.5rem;
  font-size: 0.875rem;
  border: 1px solid var(--color-base-200, #e5e7eb);
  border-radius: 0.375rem;
  background: transparent;
  color: inherit;
}
/* Numbered pager (1 … 4 [5] 6 … 50). Same reason as the rules above: Unfold's
 * purged build lacks the utilities, so the button/current/gap states are
 * spelled out here. Fixed min-width so the row does not reflow as the digit
 * count changes between pages. */
.dd-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  padding: 0.5rem 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  border: 1px solid var(--color-base-200, #e5e7eb);
  border-radius: 0.375rem;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.dd-page-btn:hover {
  border-color: var(--color-primary-600, #7c3aed);
  color: var(--color-primary-600, #7c3aed);
}
.dd-page-current,
.dd-page-current:hover {
  background: var(--color-primary-600, #7c3aed);
  border-color: var(--color-primary-600, #7c3aed);
  color: #fff;
  cursor: default;
}
.dd-page-gap {
  display: inline-flex;
  align-items: flex-end;
  padding: 0 0.25rem;
  font-size: 0.875rem;
  color: var(--color-base-400, #9ca3af);
  user-select: none;
}
html.dark .dd-page-btn {
  border-color: var(--color-base-800, #1f2937);
}

/* Invalid filter input (e.g. an inverted From–To range) — red border plus a
 * red reason underneath. Not colour-only: the message carries the meaning. */
.dd-input-error,
.dd-input-error:focus {
  border-color: #dc2626;
  outline-color: #dc2626;
}
.dd-field-error {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  line-height: 1.3;
  color: #dc2626;
}
html.dark .dd-input-error,
html.dark .dd-input-error:focus {
  border-color: #f87171;
  outline-color: #f87171;
}
html.dark .dd-field-error {
  color: #f87171;
}

/* The card's media box is now an `aspect-[4/3]` container (see
   catalog/_lot_card.html), so the thumb fills its parent instead of carrying
   its own fixed height. The broken-image swap below still keys off these
   class names, so they are kept rather than replaced by utilities. */
.dd-lot-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--color-base-100, #f3f4f6);
}
.dd-lot-thumb-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Diagonal hatch: an empty tile should read as "deliberately empty",
     not as "failed to load". */
  background-image: repeating-linear-gradient(
    135deg,
    rgba(150, 143, 168, 0.10) 0 8px,
    transparent 8px 16px
  );
}
/* The same tile rendered behind a real photo, revealed only when that photo
   fails to load: broken_image.js adds .dd-img-broken to the dead <img>, and
   the card then shows a "no photo" placeholder instead of the browser's
   native broken-image glyph. Scoped to .dd-lot-thumb so the lot-detail
   gallery keeps its own .dd-img-broken treatment (ingestion/lot_card.css).
   This rule must follow .dd-lot-thumb-placeholder — equal specificity. */
.dd-lot-thumb-fallback {
  display: none;
}
.dd-lot-thumb.dd-img-broken {
  display: none;
}
.dd-lot-thumb.dd-img-broken + .dd-lot-thumb-fallback {
  display: flex;
}
.dd-color-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  /* mid-gray border keeps white visible on light bg and black on dark */
  border: 1px solid rgba(128, 128, 128, 0.5);
  flex: none;
}
.dd-color-dot--other {
  background: conic-gradient(
    #ef4444, #f59e0b, #22c55e, #3b82f6, #a855f7, #ef4444
  );
}
.dd-check-scroll {
  max-height: 11rem;
  overflow-y: auto;
  /* overflow-y makes this a clip box; leave room so the checkbox focus
     ring isn't cut off at the edges (negative margin keeps alignment). */
  padding: 3px;
  margin: -3px;
}

/* Site chrome (modern header + footer + prominent search).
 * Custom rules because Unfold's purged Tailwind build lacks many of the
 * utilities these need; colours read from the shared --color-* theme vars
 * so the public UI tracks the admin palette. */

/* --- Header: sticky purple gradient bar with a white favicon-style mark. --- */
.dd-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(
    90deg,
    var(--color-primary-700, #6d28d9),
    var(--color-primary-600, #7c3aed)
  );
  border-bottom: 1px solid var(--color-primary-800, #5b21b6);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.dd-header__inner {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  height: 4rem;
}
.dd-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: #fff;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}
/* White rounded tile with a purple "D" — mirrors the favicon inverted so it
   reads clearly on the purple header. */
.dd-brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: #fff;
  color: var(--color-primary-600, #7c3aed);
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1;
}
.dd-brand__name {
  font-size: 1.1rem;
  font-weight: 800;
}
/* A full-height hairline separates the section links from the wordmark, so
   "Catalog" no longer reads as part of the DealerDrive lockup. `align-self`
   stretches this flex child to the bar's 4rem so the rule spans it fully;
   the row gap supplies the air on the brand side, the padding on the
   links side. */
.dd-header__links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  align-self: stretch;
  padding-left: 1.75rem;
  border-left: 1px solid rgba(255, 255, 255, 0.28);
}
/* Underline-on-active nav (the layout the client picked from option 2). */
.dd-navlink {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.dd-navlink:hover {
  color: #fff;
}
.dd-navlink--active {
  color: #fff;
  border-bottom-color: #fff;
}

/* --- Profile menu (right corner of the header) -------------------------
   `margin-left:auto` pushes it to the far right of the flex bar. The
   wrapper stretches to the bar's full height (like .dd-header__links) so
   the dropdown can hang off `top:100%` — i.e. the bar's bottom edge —
   rather than off the button, which would need a magic offset and would
   drift if the button size ever changed. Alpine toggles `open`. */
.dd-profile {
  position: relative;
  display: flex;
  align-items: center;
  align-self: stretch;
  margin-left: auto;
}
/* Circular avatar-style button: translucent white on the purple bar. */
.dd-profile__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.dd-profile__btn:hover {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(255, 255, 255, 0.55);
}
.dd-profile__btn .material-symbols-outlined {
  font-size: 1.25rem;
}
.dd-profile__menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.375rem;
  z-index: 60;
  min-width: 12rem;
  padding-block: 0.25rem;
  border: 1px solid var(--color-base-200, #e5e7eb);
  border-radius: var(--default-border-radius, 0.375rem);
  background: #fff;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -4px rgba(0, 0, 0, 0.1);
}
.dark .dd-profile__menu {
  border-color: var(--color-base-700, #374151);
  background: var(--color-base-900, #111827);
}
/* Who am I — a non-interactive label, so the menu is self-explanatory
   when several accounts are used from one browser. */
.dd-profile__who {
  margin: 0;
  padding: 0.375rem 0.875rem 0.5rem;
  border-bottom: 1px solid var(--color-base-200, #e5e7eb);
  color: var(--color-base-500, #6b7280);
  font-size: 0.75rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dark .dd-profile__who {
  border-bottom-color: var(--color-base-700, #374151);
  color: var(--color-base-400, #9ca3af);
}
/* One rule for both the <a> and the logout <button> so they are visually
   identical despite the different elements. */
.dd-profile__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.875rem;
  border: 0;
  background: none;
  color: var(--color-base-700, #374151);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.dd-profile__item:hover {
  background: var(--color-base-100, #f3f4f6);
}
.dark .dd-profile__item {
  color: var(--color-base-200, #e5e7eb);
}
.dark .dd-profile__item:hover {
  background: var(--color-base-800, #1f2937);
}
.dd-profile__item .material-symbols-outlined {
  font-size: 1.125rem;
}
.dd-profile__item--danger {
  color: #b91c1c;
}
.dd-profile__item--danger:hover {
  background: #fef2f2;
}
.dark .dd-profile__item--danger {
  color: #f87171;
}
.dark .dd-profile__item--danger:hover {
  background: rgba(239, 68, 68, 0.12);
}

/* --- Prominent search: input with an attached purple "Search" button
   carrying the magnifier glyph (option 2 layout, purple tones). --- */
.dd-search {
  display: flex;
  width: 100%;
  max-width: 32rem;
  background: #fff;
  border: 1px solid var(--color-base-200, #e5e7eb);
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.dd-search:focus-within {
  border-color: var(--color-primary-500, #8b5cf6);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.16);
}
.dd-search__input {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0.95rem;
  font-size: 0.95rem;
  color: inherit;
  background: transparent;
  border: 0;
}
.dd-search__input:focus {
  outline: none;
}
.dd-search__input::placeholder {
  color: var(--color-base-400, #9ca3af);
}
.dd-search__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 1.15rem;
  border: 0;
  cursor: pointer;
  background: var(--color-primary-600, #7c3aed);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background-color 0.15s ease;
}
.dd-search__btn:hover {
  background: var(--color-primary-700, #6d28d9);
}
.dd-search__btn .material-symbols-outlined {
  font-size: 20px;
}
.dark .dd-search {
  background: var(--color-base-900, #111827);
  border-color: var(--color-base-700, #374151);
}

/* --- Footer: light, multi-column with purple accents (option 2 layout). --- */
.dd-footer {
  margin-top: 2.5rem;
  background: var(--color-base-50, #f8fafc);
  border-top: 1px solid var(--color-base-200, #e5e7eb);
  color: var(--color-base-500, #6b7280);
}
.dark .dd-footer {
  background: var(--color-base-900, #111827);
  border-top-color: var(--color-base-800, #1f2937);
}
.dd-footer__cols {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
}
.dd-footer__col--brand {
  min-width: 13rem;
  max-width: 18rem;
}
.dd-footer__col h4 {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-primary-600, #7c3aed);
}
.dark .dd-footer__col h4 {
  color: var(--color-primary-500, #8b5cf6);
}
.dd-footer__col a {
  display: block;
  padding: 0.22rem 0;
  color: var(--color-base-500, #6b7280);
  font-size: 0.875rem;
  text-decoration: none;
}
.dd-footer__col a:hover {
  color: var(--color-primary-600, #7c3aed);
}
.dd-footer__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  color: var(--color-primary-700, #6d28d9);
  font-weight: 800;
}
.dark .dd-footer__brand {
  color: #fff;
}
/* Purple tile on the light footer (matches the header mark, inverted again). */
.dd-footer__brand .dd-brand__mark {
  background: var(--color-primary-600, #7c3aed);
  color: #fff;
}
.dd-footer__tag {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-base-500, #6b7280);
}
.dd-footer__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--color-base-200, #e5e7eb);
  padding-block: 1rem;
  font-size: 0.8rem;
}
.dark .dd-footer__bar {
  border-top-color: var(--color-base-800, #1f2937);
}
