/* Secu Self-Check: guided capture, AI review, buyer transparency block. Uses the design tokens from app.css (light + dark). */

/* Camera-style capture card */
.aiscan-cam { display: grid; gap: 10px; }
.aiscan-frame { position: relative; aspect-ratio: 4 / 3; width: 100%; border-radius: var(--r); overflow: hidden;
  background: radial-gradient(120% 90% at 50% 40%, #24384a, #0b1620); color: rgba(255,255,255,.82); display: grid; place-items: center; }
.aiscan-frame.has { background: #0b1620; }
.aiscan-frame > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.aiscan-sil { width: 82%; height: auto; opacity: .9; filter: drop-shadow(0 0 6px rgba(47,179,147,.35)); }
.aiscan-sil g { stroke-dasharray: 10 7; }
.aiscan-top { position: absolute; left: 0; right: 0; top: 0; display: flex; gap: 8px; align-items: center; padding: 10px 12px;
  background: linear-gradient(rgba(0,0,0,.55), transparent); color: #fff; font-size: .95rem; }
.aiscan-step { background: rgba(255,255,255,.18); border-radius: 999px; padding: 2px 9px; font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.aiscan-qual { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; gap: 8px; align-items: flex-start; background: rgba(194,69,61,.92);
  color: #fff; border-radius: var(--r-sm); padding: 8px 10px; font-size: .85rem; line-height: 1.35; }
.aiscan-qual svg { width: 18px; height: 18px; flex: none; }
.aiscan-busy { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; background: rgba(0,0,0,.5); color: #fff; font-weight: 600; }
.aiscan-hint { margin: 0; }
.aiscan-actions { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.aiscan-actions > .btn:not(.aiscan-shoot) { width: 48px; height: 48px; padding: 0; font-size: 1.5rem; }
.aiscan-shoot { min-height: 52px; }
.aiscan-shoot svg { width: 22px; height: 22px; }
.aiscan-shoot.disabled { opacity: .55; pointer-events: none; }

/* Thumbnail strip: 16 angles */
.aiscan-strip { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.aiscan-thumb { position: relative; aspect-ratio: 4 / 3; border: 2px dashed var(--line); border-radius: 8px; background: var(--surface-2); padding: 0; overflow: hidden;
  cursor: pointer; color: var(--muted); font-size: .78rem; font-weight: 700; display: grid; place-items: center; min-width: 0; }
.aiscan-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.aiscan-thumb.done { border-style: solid; border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); }
.aiscan-thumb.cur { outline: 3px solid var(--brand); outline-offset: 1px; }
.aiscan-thumb.warn { border-color: var(--bad); }
.aiscan-thumb i { position: absolute; right: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--bad); color: #fff; font-style: normal; font-size: .7rem; display: grid; place-items: center; z-index: 1; }
@media (max-width: 560px) { .aiscan-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.aiscan-desktop { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (pointer: coarse) { .aiscan-desktop { display: none; } }

/* Progress */
.aiscan-running { display: grid; gap: 10px; padding: 14px; border-radius: var(--r-sm); background: var(--brand-soft); }
.aiscan-bar i { transition: width .6s ease; }
.aiscan-spin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; animation: aispin .8s linear infinite; display: inline-block; }
@keyframes aispin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .aiscan-spin { animation-duration: 2.4s; } .aiscan-bar i { transition: none; } }

/* Findings review */
.aiscan-findings { display: grid; gap: 12px; }
.aiscan-finding { display: grid; grid-template-columns: minmax(0, 220px) 1fr; gap: 12px; padding: 12px; box-shadow: none; border: 1px solid var(--line); }
.aiscan-finding.decided { opacity: .78; }
.aiscan-fbody { display: grid; gap: 6px; align-content: start; min-width: 0; }
.aiscan-fbtns { gap: 8px; }
.aiscan-figbtn { border: 0; padding: 0; background: none; cursor: zoom-in; display: block; width: 100%; }
@media (max-width: 560px) { .aiscan-finding { grid-template-columns: 1fr; } }
.aiscan-fig { position: relative; border-radius: var(--r-sm); overflow: hidden; background: #0b1620; line-height: 0; }
.aiscan-fig img { width: 100%; height: auto; display: block; }
.aiscan-box { position: absolute; border: 2px solid #ff4d3d; border-radius: 4px; box-shadow: 0 0 0 9999px rgba(0,0,0,.18), 0 0 0 1px rgba(255,255,255,.7) inset; pointer-events: none; }
.modal .aiscan-fig img { max-height: 75vh; width: auto; max-width: 100%; margin: 0 auto; }
.modal .aiscan-fig { display: flex; justify-content: center; background: transparent; }
.modal .aiscan-fig .aiscan-box { box-shadow: 0 0 0 1px rgba(255,255,255,.7) inset; }
.aiscan-retake { display: flex; gap: 10px; align-items: center; }
.aiscan-retake img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; flex: none; }
.aiscan-retake .grow { flex: 1; min-width: 0; }
.aiscan-retake .btn { flex: none; }
@media (max-width: 560px) {
  .aiscan-retake { display: grid; grid-template-columns: 64px 1fr; align-items: start; }
  .aiscan-retake > .btn { grid-column: 2; justify-self: start; }
}
.aiscan-prov { box-shadow: none; border: 1px solid var(--line); }

/* Crop thumbnails (report + buyer view) */
.aicrop { position: relative; overflow: hidden; flex: none; border: 1px solid var(--line); border-radius: 8px; padding: 0; background: var(--surface-2); cursor: zoom-in; }
.aicrop img { position: absolute; max-width: none; left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; }
.aicrop .aiscan-box { box-shadow: none; border-width: 2px; }

/* Buyer transparency block */
.aiblock { box-shadow: none; border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line)); background: color-mix(in srgb, var(--brand-soft) 45%, var(--surface)); margin-bottom: 12px; }
.aiblock > .row svg { width: 20px; height: 20px; color: var(--brand); }
.aiblock-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.aiblock-stats > div { background: var(--surface); border-radius: var(--r-sm); padding: 8px 10px; display: grid; gap: 2px; border: 1px solid var(--line); }
.aiblock-stats b { font-size: 1.35rem; line-height: 1.1; }
.aiblock-stats span { font-size: .78rem; color: var(--muted); }
.aiblock-stats .bad b { color: var(--bad); }
.aiblock-badges { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 6px; }
.aiblock-badges:empty { display: none; }
.aiblock-badges li { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; }
.aiblock-badges svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.aiblock-badges .ok svg { color: var(--good); }
.aiblock-badges .no svg { color: var(--warn); }
.aiblock-disputed { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.aiblock .damage { align-items: flex-start; }

/* Cold-start sound check (engine-sound.js) */
.snd-thumb { display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: #0b1220; cursor: zoom-in; }
.snd-thumb img, .snd-img { display: block; width: 100%; height: auto; aspect-ratio: 900 / 320; }
.snd-img { border-radius: var(--r-sm); }
.snd-rows { display: grid; gap: 0; }
.snd-row { display: grid; grid-template-columns: minmax(0, 11rem) auto minmax(0, 1fr); gap: 4px 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.snd-row:last-child { border-bottom: 0; }
.snd-row .snd-bad { color: var(--warn); }
.snd-rec .btn { justify-self: start; }
.snd-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--bad); animation: snddot 1s ease-in-out infinite; }
@keyframes snddot { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .snd-dot { animation: none; } }
@media (max-width: 520px) { .snd-row { grid-template-columns: minmax(0, 1fr) auto; } .snd-row > .small { grid-column: 1 / -1; } }
