/* Autobyte — components: topbar, search, results, browse, modals, forms */
/* ---- top bar ------------------------------------------------------------- */
.topbar {
  background: var(--header);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 24px;
  border-bottom: 3px solid var(--primary);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand__logo {
  width: 46px; height: 46px; object-fit: contain;
  border-radius: 8px; background: #0B1216;
  transition: transform .4s cubic-bezier(.2,.8,.2,1);
}
.brand:hover .brand__logo { transform: rotate(-6deg) scale(1.05); }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { color: #fff; font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.brand__sub { color: var(--primary); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .8px; }
.topbar__right { display: flex; align-items: center; gap: 14px; }
.topbar__meta { color: #8FA3A3; font-size: 12px; white-space: nowrap; }

.iconbtn {
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  color: #cfe0e0; display: grid; place-items: center; padding: 0;
  transition: background .2s, transform .2s;
}
.iconbtn:hover { background: rgba(255,255,255,.14); transform: translateY(-1px); }
.iconbtn svg { width: 19px; height: 19px; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }


/* ---- layout -------------------------------------------------------------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px 80px; }

/* ---- hero with animated waveform ---------------------------------------- */
.hero { position: relative; text-align: center; padding: 52px 0 30px; overflow: hidden; }
.hero__wave {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: .5; pointer-events: none;
}
.hero__inner { position: relative; z-index: 1; }
.hero__title {
  font-size: clamp(32px, 6vw, 48px); font-weight: 800;
  letter-spacing: -1.2px; margin: 0 0 10px;
  animation: rise .6s cubic-bezier(.2,.8,.2,1) both;
}
.hero__lead {
  color: var(--muted); max-width: 560px; margin: 0 auto 26px;
  font-size: 15px; animation: rise .6s .05s cubic-bezier(.2,.8,.2,1) both;
}

/* ---- search -------------------------------------------------------------- */
.search {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 8px 6px 16px;
  max-width: 620px; margin: 0 auto; box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s, transform .15s;
  animation: rise .6s .1s cubic-bezier(.2,.8,.2,1) both;
}
.search:focus-within { border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(14,124,123,.14); transform: translateY(-1px); }
.search__icon { width: 20px; height: 20px; color: var(--muted); flex: none; }
#searchInput {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-size: 16px; color: var(--slate); padding: 11px 0;
}
#searchInput::placeholder { color: var(--muted); }
.search__clear {
  border: 0; background: var(--border); color: var(--slate);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  font-size: 18px; line-height: 1; flex: none; transition: background .15s;
}
.search__clear:hover { background: var(--primary); color: #fff; }

/* ---- controls (make dropdown) ------------------------------------------- */
.controls { margin-top: 16px; display: flex; justify-content: center; gap: 10px;
  animation: rise .6s .15s cubic-bezier(.2,.8,.2,1) both; }
.select { display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 6px 4px 14px; box-shadow: var(--shadow);
  color-scheme: light dark; }
.select__label { font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px; }
#makeFilter {
  border: 0; outline: 0; background: var(--surface); color: var(--slate);
  font-size: 14px; font-weight: 600; padding: 7px 10px; border-radius: 999px;
  cursor: pointer; color-scheme: light dark;
}
#makeFilter option { background: var(--surface); color: var(--slate); }

/* ---- results / cards ----------------------------------------------------- */
.results { margin-top: 26px; display: grid; gap: 14px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); display: grid; gap: 10px;
  animation: rise .45s cubic-bezier(.2,.8,.2,1) both;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(22,35,43,.10), 0 16px 40px rgba(22,35,43,.12);
  border-color: var(--primary); }
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.card__id { font-size: 12px; font-weight: 700; color: var(--primary); letter-spacing: .5px; }
.card__title { font-size: 17px; font-weight: 700; margin: 2px 0 0; }
.card__vehicle { color: var(--muted); font-size: 13px; margin-top: 2px; }

.codes { display: flex; flex-wrap: wrap; gap: 6px; }
.code {
  font-family: "Consolas", "SF Mono", ui-monospace, monospace;
  font-size: 12px; font-weight: 700;
  background: rgba(224,138,30,.13); color: var(--accent);
  border: 1px solid rgba(224,138,30,.38);
  padding: 3px 8px; border-radius: 6px;
}
.card__symptom { color: var(--slate-soft); font-size: 14px; }
.card__solution {
  background: rgba(14,124,123,.07); border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0; padding: 10px 14px; font-size: 14px;
}
.card__solution b { color: var(--primary); }
.card__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 8px; padding: 10px 18px;
  font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--primary); color: #fff; transition: background .12s, transform .12s;
}
.btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; }

/* ---- browse tree --------------------------------------------------------- */
.browse { margin-top: 34px; }
.browse__head { display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border); }
.browse__title { font-size: 16px; font-weight: 700; margin: 0; }
.browse__hint { font-size: 13px; color: var(--muted); }

.tree { display: grid; gap: 8px; }
.group {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
  animation: rise .4s cubic-bezier(.2,.8,.2,1) both;
}
.group__head {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 13px 16px; cursor: pointer; border: 0; background: transparent;
  color: var(--slate); font-size: 15px; font-weight: 700; text-align: left;
  transition: background .15s;
}
.group__head:hover { background: var(--surface-2); }
.group__chev { width: 16px; height: 16px; color: var(--muted); flex: none;
  transition: transform .25s ease; }
.group.open .group__chev { transform: rotate(90deg); }
.group__count {
  margin-left: auto; font-size: 12px; font-weight: 700; color: var(--primary);
  background: rgba(14,124,123,.10); border-radius: 999px; padding: 2px 10px;
}
.group__body {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .28s ease;
}
.group.open .group__body { grid-template-rows: 1fr; }
.group__inner { overflow: hidden; }

.leaf {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px 11px 20px; border-top: 1px solid var(--border);
  cursor: pointer; transition: background .14s;
}
.leaf:hover { background: var(--surface-2); }
.leaf__id { font-family: ui-monospace, monospace; font-size: 12px; font-weight: 700;
  color: var(--primary); flex: none; width: 78px; }
.leaf__main { flex: 1; min-width: 0; }
.leaf__title { font-size: 14px; font-weight: 600; }
.leaf__codes { font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leaf__go { color: var(--muted); width: 16px; height: 16px; flex: none;
  transition: transform .15s, color .15s; }
.leaf:hover .leaf__go { color: var(--primary); transform: translateX(2px); }

/* ---- empty / not-found states ------------------------------------------- */
.state { text-align: center; padding: 46px 20px; color: var(--muted);
  animation: rise .4s cubic-bezier(.2,.8,.2,1) both; }
.state__icon { width: 54px; height: 54px; margin: 0 auto 16px; color: var(--primary); opacity: .85; }
.state__title { font-size: 18px; font-weight: 700; color: var(--slate); margin: 0 0 6px; }
.state__sub { font-size: 14px; max-width: 430px; margin: 0 auto; }
.count { color: var(--muted); font-size: 13px; margin-bottom: 2px; }

/* ---- footer -------------------------------------------------------------- */
.sitefoot {
  border-top: 1px solid var(--border); margin-top: 40px;
  padding: 22px 20px; text-align: center; color: var(--muted); font-size: 12.5px;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.sitefoot__links { display: flex; gap: 10px; align-items: center; }
.sitefoot__legal { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.sitefoot__dot { opacity: .5; }
.link {
  background: none; border: 0; cursor: pointer; padding: 4px 6px;
  color: var(--primary); font-size: 13px; font-weight: 600;
  font-family: inherit; border-radius: 6px; transition: background .15s;
}
.link:hover { background: rgba(14,124,123,.10); }

/* ---- modals + forms ------------------------------------------------------ */
.modal { position: fixed; inset: 0; z-index: 50; display: flex;
  align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal[hidden] { display: none; }
.modal__backdrop { position: fixed; inset: 0; background: rgba(8,14,18,.55);
  backdrop-filter: blur(2px); animation: fade .2s ease both; }
.modal__panel {
  position: relative; width: 100%; max-width: 780px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow); padding: 26px 30px 28px;
  animation: pop .26s cubic-bezier(.2,.8,.2,1) both;
}
.modal__head { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.modal__title { font-size: 20px; font-weight: 800; margin: 0; letter-spacing: -.3px; }
.modal__sub { color: var(--muted); font-size: 13.5px; margin: 4px 0 0; }
.modal__x { background: var(--surface-2); border: 0; width: 34px; height: 34px; flex: none;
  border-radius: 9px; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s; }
.modal__x:hover { background: var(--primary); color: #fff; }

.form { display: grid; gap: 16px; }
.form__row { display: grid; gap: 16px; }
.form__row--2 { grid-template-columns: 1fr 1fr; }
.field { display: grid; gap: 7px; }
.field > span { font-size: 13.5px; font-weight: 700; color: var(--slate-soft); }
.field > span em { color: var(--muted); font-weight: 500; font-style: normal; }
.field > span .req { color: #d1495b; font-weight: 700; font-style: normal; }
.field input, .field textarea {
  width: 100%; background: var(--bg); color: var(--slate);
  border: 1px solid var(--border); border-radius: 10px; padding: 13px 14px;
  font-size: 15px; font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus {
  outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,124,123,.14);
}
.field textarea { resize: vertical; min-height: 64px; line-height: 1.5; }

/* photo upload */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 22px 16px; text-align: center; cursor: pointer;
  background: var(--bg); border: 1.5px dashed var(--border); border-radius: 12px;
  color: var(--muted); transition: border-color .15s, background .15s, color .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); color: var(--primary);
  background: rgba(14,124,123,.05); }
.dropzone svg { width: 30px; height: 30px; }
.dropzone__text { font-size: 14px; font-weight: 600; }
.dropzone__hint { font-size: 12px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.thumb { position: relative; width: 84px; height: 84px; border-radius: 10px;
  overflow: hidden; border: 1px solid var(--border); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb__x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px;
  border: 0; border-radius: 50%; background: rgba(8,14,18,.7); color: #fff;
  font-size: 14px; line-height: 1; cursor: pointer; }
.thumb__x:hover { background: #d1495b; }

/* phone QR */
.phonebtn {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 4px;
  background: none; border: 0; cursor: pointer; padding: 8px 2px;
  color: var(--primary); font-size: 13.5px; font-weight: 600; font-family: inherit;
}
.phonebtn svg { width: 17px; height: 17px; }
.phonebtn:hover { text-decoration: underline; }
.qrpanel {
  display: flex; gap: 16px; align-items: center; margin-top: 10px;
  padding: 16px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg); animation: pop .2s ease both;
}
.qrpanel[hidden] { display: none; }
.qrpanel img { width: 132px; height: 132px; background: #fff; border-radius: 8px;
  padding: 6px; border: 1px solid var(--border); flex: none; }
.qrpanel__text strong { font-size: 14px; }
.qrpanel__text p { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.qrpanel__missing { color: var(--muted); font-size: 13px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form__foot { display: flex; align-items: center; justify-content: flex-end;
  gap: 14px; margin-top: 4px; }
.form__msg { font-size: 13px; margin-right: auto; }
.form__msg.ok { color: var(--ok); font-weight: 600; }
.form__msg.err { color: #d1495b; font-weight: 600; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---- motion -------------------------------------------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@media (max-width: 540px) {
  .topbar { padding: 12px 16px; }
  .brand__sub { display: none; }
  .card__head { flex-direction: column; }
  .leaf__id { width: 64px; }
  .form__row--2 { grid-template-columns: 1fr; }
  .modal { padding: 3vh 10px; }
  .modal__panel { padding: 18px 16px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .hero__wave { display: none; }
}
