/* osc-input.css — Bonafied OCR affordances + verification modal.
 * Shared across landing page, result page reset card, and compare page header.
 *
 * Per-location styling for the affordance BUTTONS is owned by the location's
 * own CSS (gives each page room to size/space appropriately). This file
 * provides shared base classes and the singleton verification modal.
 *
 * Colour vars expected (already defined site-wide):
 *   --gold, --gold-light, --cream, --cream-dim, --ink, --rule
 */

/* ---------- Affordance container — base layout only ---------- */

.bf-osc-affordances {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.bf-osc-affordances[hidden] { display: none; }

/* Base button — sensible defaults the per-location CSS can override */
.bf-osc-btn {
  appearance: none;
  background: rgba(244, 239, 228, 0.06);
  color: var(--cream, #F4EFE4);
  border: 1px solid rgba(244, 239, 228, 0.20);
  border-radius: 4px;
  padding: 0.7rem 1rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  min-height: 44px;
  line-height: 1;
}
.bf-osc-btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}
.bf-osc-btn:hover,
.bf-osc-btn:focus-visible {
  border-color: var(--gold, #B8963E);
  color: var(--gold, #B8963E);
  background: rgba(244, 239, 228, 0.10);
}
.bf-osc-btn:focus-visible {
  outline: 2px solid var(--gold, #B8963E);
  outline-offset: 2px;
}
.bf-osc-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Compact variant — for sidebar reset card + compare header */
.bf-osc-btn--compact {
  padding: 0.5rem 0.7rem;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  gap: 0.35rem;
}
.bf-osc-btn--compact svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

/* Icon-only variant (compare page if header gets too tight on narrow widths) */
.bf-osc-btn--icon-only {
  padding: 0.5rem;
  min-width: 36px;
}
.bf-osc-btn--icon-only .bf-osc-btn__label {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Dropzone (desktop only) ---------- */

.bf-osc-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.4rem 1rem;
  border: 1.5px dashed rgba(244, 239, 228, 0.20);
  border-radius: 6px;
  background: rgba(244, 239, 228, 0.025);
  color: var(--cream-dim, rgba(244, 239, 228, 0.7));
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.bf-osc-dropzone[hidden] { display: none; }
@media (hover: none) {
  /* Touch-primary devices: dropzone is meaningless; rely on the upload button. */
  .bf-osc-dropzone { display: none; }
}
.bf-osc-dropzone:hover,
.bf-osc-dropzone:focus-visible {
  border-color: var(--gold, #B8963E);
  color: var(--gold, #B8963E);
}
.bf-osc-dropzone.is-active {
  border-color: var(--gold, #B8963E);
  border-style: solid;
  background: rgba(184, 150, 62, 0.08);
  color: var(--cream, #F4EFE4);
}
.bf-osc-dropzone svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  stroke: currentColor;
}

/* ---------- Verification modal (singleton) ---------- */

.bf-osc-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.bf-osc-modal[hidden] { display: none; }

.bf-osc-modal__scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(2px);
  cursor: pointer;
}

.bf-osc-modal__dialog {
  position: relative;
  background: #1C1C1A;
  color: var(--cream, #F4EFE4);
  border: 1px solid rgba(244, 239, 228, 0.18);
  border-radius: 10px;
  padding: 1.5rem 1.4rem 1.25rem;
  max-width: 480px;
  width: 100%;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  animation: bf-osc-fade-in 0.18s ease-out;
}
@keyframes bf-osc-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bf-osc-modal__close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 0;
  color: var(--cream-dim, rgba(244, 239, 228, 0.7));
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.bf-osc-modal__close:hover,
.bf-osc-modal__close:focus-visible {
  color: var(--cream, #F4EFE4);
  background: rgba(244, 239, 228, 0.08);
}
.bf-osc-modal__close svg {
  width: 18px;
  height: 18px;
}

.bf-osc-modal__title {
  font-family: Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  padding-right: 2rem;
  color: var(--cream, #F4EFE4);
  line-height: 1.25;
}

.bf-osc-modal__image-wrap {
  background: rgba(244, 239, 228, 0.04);
  border: 1px solid rgba(244, 239, 228, 0.10);
  border-radius: 6px;
  padding: 0.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 140px;
}
.bf-osc-modal__image {
  max-width: 100%;
  max-height: 240px;
  height: auto;
  border-radius: 4px;
  display: block;
}

.bf-osc-modal__plate {
  /* Now an <input>, styled to keep the prominent "plate panel" look */
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  box-sizing: border-box;
  display: block;
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(1.6rem, 6vw, 2.1rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  background: #F4EFE4;
  color: #1C1C1A;
  padding: 0.6rem 1.1rem;
  border: 2px solid transparent;
  border-radius: 6px;
  text-align: center;
  margin: 0;
  min-height: 1.4em;
  text-transform: uppercase;
  caret-color: var(--gold, #B8963E);
  cursor: text;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.bf-osc-modal__plate:focus {
  outline: none;
  border-color: var(--gold, #B8963E);
  box-shadow: 0 0 0 3px rgba(184, 150, 62, 0.25);
}
.bf-osc-modal__plate::selection {
  background: rgba(184, 150, 62, 0.35);
}

/* visually-hidden utility for the modal's screen-reader label (self-contained
   so the module doesn't depend on any host page defining this class). */
.bf-osc-modal .visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.bf-osc-modal__hint {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--cream-dim, rgba(244, 239, 228, 0.7));
  margin: 0;
  line-height: 1.5;
  text-align: center;
}

.bf-osc-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.25rem;
}

.bf-osc-modal__btn {
  appearance: none;
  border: 1px solid;
  border-radius: 4px;
  padding: 0.85rem 1rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.bf-osc-modal__btn:focus-visible {
  outline: 2px solid var(--gold, #B8963E);
  outline-offset: 2px;
}
.bf-osc-modal__btn--primary {
  background: var(--gold, #B8963E);
  color: #1C1C1A;
  border-color: var(--gold, #B8963E);
}
.bf-osc-modal__btn--primary:hover {
  background: var(--gold-light, #D4AF6A);
  border-color: var(--gold-light, #D4AF6A);
}
.bf-osc-modal__btn--secondary {
  background: transparent;
  color: var(--cream, #F4EFE4);
  border-color: rgba(244, 239, 228, 0.25);
}
.bf-osc-modal__btn--secondary:hover {
  color: var(--gold, #B8963E);
  border-color: var(--gold, #B8963E);
}

.bf-osc-modal__status {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--cream-dim, rgba(244, 239, 228, 0.7));
  margin: 0;
  min-height: 1em;
  text-align: center;
}
.bf-osc-modal__status--error {
  color: #C4571F;
}

/* ---------- Narrow-viewport tightening ---------- */
@media (max-width: 480px) {
  .bf-osc-modal__dialog {
    padding: 1.25rem 1.1rem 1rem;
    border-radius: 8px;
  }
  .bf-osc-modal__title {
    font-size: 1.1rem;
  }
  .bf-osc-modal__image {
    max-height: 180px;
  }
}
