/**
 * Ricerca veicolo — hero immagine veicolo
 */

.vf-hero-card {
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}

.vf-image-wrap {
  height: clamp(200px, 42vw, 300px);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #ffffff;
}

.dark .vf-image-wrap {
  background-color: #1f2937;
}

.vf-vehicle-img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center center;
}

/* Placeholder SVG: compatto al centro */
.vf-vehicle-img--placeholder {
  max-height: min(200px, 38vw);
  padding: 1.5rem 2rem;
  opacity: 0.85;
}

/* Foto generate: riempie il riquadro e taglia i margini grigi dello studio */
.vf-vehicle-img--photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  object-fit: cover;
  object-position: center center;
  transform: scale(1.06);
}

.dark .vf-vehicle-img--photo {
  transform: scale(1.04);
  filter: brightness(0.92);
}

.vf-size-option--suggested {
  border-color: #16a34a !important;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.35);
}

#vf-picker-title,
#vf-size-picker {
  scroll-margin-top: 5.5rem;
}

.vf-ocr-help .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.vf-ocr-mode-btn--active {
  border-color: #dc2626 !important;
  background-color: #fef2f2;
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.15);
}

.dark .vf-ocr-mode-btn--active {
  background-color: rgba(127, 29, 29, 0.35);
}

.vf-ocr-panel[hidden] {
  display: none !important;
}

.vf-ocr-example {
  margin: 0;
  text-align: center;
}

.vf-ocr-example__img {
  display: block;
  width: 100%;
  max-width: 22rem;
  margin: 0 auto;
  border-radius: 0.75rem;
  border: 2px solid rgba(220, 38, 38, 0.25);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  object-fit: cover;
}

.vf-ocr-example__caption {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  line-height: 1.35;
  color: #6b7280;
}

.dark .vf-ocr-example__caption {
  color: #9ca3af;
}

/* Modal OCR con animazione scanner */
body.vf-ocr-modal-open {
  overflow: hidden;
}

.vf-ocr-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.vf-ocr-modal.hidden {
  display: none !important;
}

.vf-ocr-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(4px);
}

.vf-ocr-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 22rem;
  background: #ffffff;
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
}

.dark .vf-ocr-modal__panel {
  background: #1f2937;
  border: 1px solid #374151;
}

.vf-ocr-modal__scan-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 0.75rem;
  background: #0f172a;
  aspect-ratio: 4 / 3;
}

.vf-ocr-modal__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.vf-ocr-modal__scanner {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(34, 197, 94, 0.2) 15%,
    #4ade80 50%,
    rgba(34, 197, 94, 0.2) 85%,
    transparent 100%
  );
  box-shadow:
    0 0 12px 2px rgba(74, 222, 128, 0.85),
    0 -8px 24px rgba(74, 222, 128, 0.25),
    0 8px 24px rgba(74, 222, 128, 0.25);
  animation: vf-ocr-scan-line 2.4s ease-in-out infinite;
}

.vf-ocr-modal__scanner::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -40px;
  height: 80px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(74, 222, 128, 0.12) 45%,
    rgba(74, 222, 128, 0.28) 50%,
    rgba(74, 222, 128, 0.12) 55%,
    transparent 100%
  );
  pointer-events: none;
}

.vf-ocr-modal--done .vf-ocr-modal__scanner {
  display: none;
}

@keyframes vf-ocr-scan-line {
  0% {
    top: 0;
    opacity: 0.35;
  }
  50% {
    top: calc(100% - 3px);
    opacity: 1;
  }
  100% {
    top: 0;
    opacity: 0.35;
  }
}

.vf-ocr-modal__status {
  margin-top: 1rem;
  font-size: 0.875rem;
  line-height: 1.4;
  text-align: center;
  color: #4b5563;
}

.dark .vf-ocr-modal__status {
  color: #d1d5db;
}

.vf-ocr-modal__result {
  margin-top: 1rem;
  text-align: center;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.dark .vf-ocr-modal__result {
  background: rgba(22, 101, 52, 0.2);
  border-color: #166534;
}

.vf-ocr-modal__result-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #15803d;
}

.dark .vf-ocr-modal__result-label {
  color: #86efac;
}

.vf-ocr-modal__size {
  margin-top: 0.35rem;
  font-size: 1.75rem;
  font-weight: 800;
  color: #dc2626;
  line-height: 1.2;
}

.vf-ocr-modal__detail {
  margin-top: 0.35rem;
  font-size: 0.8125rem;
  color: #4b5563;
}

.dark .vf-ocr-modal__detail {
  color: #9ca3af;
}

.vf-ocr-modal__result--error {
  background: #fef2f2;
  border-color: #fecaca;
}

.dark .vf-ocr-modal__result--error {
  background: rgba(127, 29, 29, 0.25);
  border-color: #991b1b;
}

.vf-ocr-modal__result--error .vf-ocr-modal__result-label {
  color: #b91c1c;
}

.dark .vf-ocr-modal__result--error .vf-ocr-modal__result-label {
  color: #fca5a5;
}

.vf-ocr-modal__result--error .vf-ocr-modal__size {
  font-size: 1rem;
  font-weight: 600;
  color: #991b1b;
}

.vf-ocr-modal__actions {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.625rem;
  margin-top: 1.25rem;
}

@media (min-width: 380px) {
  .vf-ocr-modal__actions {
    flex-direction: row;
    justify-content: stretch;
  }

  .vf-ocr-modal__actions .vf-ocr-modal__btn {
    flex: 1;
  }
}

.vf-ocr-modal__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.vf-ocr-modal__btn--secondary {
  background: #ffffff;
  color: #374151;
  border: 2px solid #d1d5db;
}

.vf-ocr-modal__btn--secondary:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.dark .vf-ocr-modal__btn--secondary {
  background: #374151;
  color: #f3f4f6;
  border-color: #4b5563;
}

.vf-ocr-modal__btn--primary {
  background: #dc2626;
  color: #ffffff;
  border: 2px solid #dc2626;
}

.vf-ocr-modal__btn--primary:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}
