/* ============================================================
   am-mr-scan.css — « Scanner mon etiquette »
   Modale scopee .am-scan* — charte A&M monochrome anthracite (#1a1a1a) + blanc.
   Reprend les rayons / ombres / typo du finder (.am-mr).
   ============================================================ */
.am-scan-lock { overflow: hidden; }

.am-scan-ov {
  position: fixed; inset: 0; z-index: 100000;
  background: rgba(16, 17, 19, .62);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  animation: am-scan-fade .18s ease;
}
@keyframes am-scan-fade { from { opacity: 0; } to { opacity: 1; } }

.am-scan {
  position: relative; width: 100%; max-width: 460px;
  background: #fff; border-radius: 20px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .55);
  overflow: hidden;
  animation: am-scan-pop .2s cubic-bezier(.2, .8, .3, 1);
}
@keyframes am-scan-pop { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

.am-scan__close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid #ececec; background: #fff; color: #5f646b;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .15s, color .15s;
}
.am-scan__close:hover { background: #f6f6f7; color: #1a1a1a; }
.am-scan__close svg { width: 18px; height: 18px; }

.am-scan__head {
  display: flex; gap: 14px; align-items: center;
  padding: 22px 22px 16px; border-bottom: 1px solid #ececec;
}
.am-scan__ic {
  width: 46px; height: 46px; flex: 0 0 auto; border-radius: 13px;
  background: #1a1a1a; color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.am-scan__ic svg { width: 24px; height: 24px; }
.am-scan__head h3 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.3px; color: #16181c; }
.am-scan__head p { margin: 3px 0 0; font-size: 12.8px; color: #5f646b; line-height: 1.4; }

.am-scan__body { padding: 20px 22px; }
.am-scan__foot {
  padding: 13px 22px; border-top: 1px solid #ececec; background: #f6f6f7;
  font-size: 11.6px; color: #5f646b; line-height: 1.45;
}

/* --- Etape choix --- */
.am-scan-choose { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.am-scan-mode {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 20px 12px; border: 1.5px solid #ececec; border-radius: 15px;
  background: #fff; cursor: pointer; font-family: inherit; text-align: center;
  transition: border-color .18s, box-shadow .18s, transform .1s;
}
.am-scan-mode:hover { border-color: #1a1a1a; box-shadow: 0 8px 22px -14px rgba(0, 0, 0, .3); }
.am-scan-mode:active { transform: translateY(1px); }
.am-scan-mode__ic {
  width: 44px; height: 44px; border-radius: 12px; background: #f6f6f7; color: #1a1a1a;
  display: flex; align-items: center; justify-content: center;
}
.am-scan-mode__ic svg { width: 23px; height: 23px; }
.am-scan-mode__t { font-size: 14px; font-weight: 700; color: #16181c; }
.am-scan-mode__s { font-size: 11.5px; color: #5f646b; }
.am-scan-tip { margin: 16px 0 0; font-size: 12px; color: #5f646b; line-height: 1.5; }

/* --- Etape lecture --- */
.am-scan-reading { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 6px 0; }
.am-scan-thumb {
  width: 100%; max-width: 300px; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden;
  background: #f6f6f7; border: 1px solid #ececec;
}
.am-scan-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.am-scan-status { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: #16181c; font-weight: 500; }
.am-scan-spin {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid #d9dbe0; border-top-color: #1a1a1a;
  animation: am-scan-spin .7s linear infinite; flex: 0 0 auto;
}
@keyframes am-scan-spin { to { transform: rotate(360deg); } }

/* --- Etape resultat --- */
.am-scan-ok { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: #1a1a1a; font-weight: 600; margin-bottom: 14px; }
.am-scan-ok svg { width: 20px; height: 20px; color: #1a1a1a; flex: 0 0 auto; }
.am-scan-lbl { display: block; font-size: 12.5px; color: #5f646b; margin-bottom: 7px; }
.am-scan-ref {
  width: 100%; box-sizing: border-box; padding: 13px 15px;
  border: 1.5px solid #1a1a1a; border-radius: 12px;
  font-size: 17px; font-weight: 700; letter-spacing: .3px; color: #16181c;
  font-family: inherit; text-transform: uppercase;
}
.am-scan-ref:focus { outline: none; box-shadow: 0 0 0 3px rgba(26, 26, 26, .12); }
.am-scan-rule { margin-top: 7px; font-size: 11.5px; color: #8a8f96; }

.am-scan-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.am-scan-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 18px; border-radius: 999px; font-size: 14px; font-weight: 700;
  font-family: inherit; cursor: pointer; text-decoration: none; border: 1.5px solid #1a1a1a;
  transition: background .15s, color .15s, transform .1s; line-height: 1;
}
.am-scan-btn:active { transform: translateY(1px); }
.am-scan-btn--primary { background: #1a1a1a; color: #fff; }
.am-scan-btn--primary:hover { background: #000; }
.am-scan-btn--primary span { transition: transform .15s; }
.am-scan-btn--primary:hover span { transform: translateX(3px); }
.am-scan-btn--ghost { background: #fff; color: #1a1a1a; }
.am-scan-btn--ghost:hover { background: #f6f6f7; }
.am-scan-note { margin: 13px 0 0; font-size: 11.6px; color: #8a8f96; line-height: 1.5; }

/* --- Etape erreur --- */
.am-scan-err { text-align: center; padding: 6px 0; }
.am-scan-err__ic {
  width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 14px;
  background: #fbf3e6; color: #b7791f; display: flex; align-items: center; justify-content: center;
}
.am-scan-err__ic svg { width: 26px; height: 26px; }
.am-scan-err p { margin: 0 0 4px; font-size: 13.5px; color: #16181c; line-height: 1.55; }
.am-scan-err .am-scan-actions { margin-top: 18px; }

/* --- Mise en evidence du champ finder pre-rempli --- */
#am-mr-ref.am-scan-filled {
  animation: am-scan-glow 2.2s ease;
  border-color: #1a1a1a !important;
}
@keyframes am-scan-glow {
  0% { box-shadow: 0 0 0 0 rgba(26, 26, 26, .35); }
  30% { box-shadow: 0 0 0 4px rgba(26, 26, 26, .16); }
  100% { box-shadow: 0 0 0 0 rgba(26, 26, 26, 0); }
}

@media (max-width: 420px) {
  .am-scan-choose { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .am-scan-ov, .am-scan, .am-scan-spin, #am-mr-ref.am-scan-filled { animation: none !important; }
}
