/* scan/scan.css — UI minimaliste, face comme scène principale */

:root {
  --accent:   #f2d440;
  --bg:       #04050a;
  --bg2:      #090b12;
  --fg:       #e8e8e0;
  --fg-dim:   rgba(232,232,224,0.45);
  --fg-muted: rgba(232,232,224,0.22);
  --font:     'Courier New', Courier, monospace;
  --radius:   2px;
  --border:   rgba(255,255,255,0.07);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ─── Vidéo hors-écran (flux actif, invisible) ────────────────────────────── */

#scan-video {
  position: fixed;
  left: -9999px;
  top:  -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ─── Shell ───────────────────────────────────────────────────────────────── */

.scan-shell {
  height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 20px 20px;
  overflow: hidden;
}

/* ─── Header ──────────────────────────────────────────────────────────────── */

.scan-header {
  flex-shrink: 0;
  width: 100%;
  max-width: 520px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

#logo-zone {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.client-logo {
  max-height: 28px;
  max-width: 110px;
  filter: brightness(0) invert(1);
  display: block;
}

.swansong-sub {
  font-size: 8px;
  color: var(--fg-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.site-name {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--accent);
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  gap: 6px;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 7px;
  font-family: var(--font);
  transition: color 0.2s;
}
.btn-icon:hover { color: var(--fg-dim); }

/* ─── Stage : le canvas EST l'interface ───────────────────────────────────── */

.stage {
  position: relative;
  flex: 1;
  min-height: 0;        /* critique : empêche le débordement flex */
  width: 100%;
  max-width: 520px;
  background: var(--bg);
}

#scan-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Glitch discret sur le stage */
@keyframes glitch-flash {
  0%,100% { filter: none; }
  25%     { filter: hue-rotate(80deg) contrast(1.3); }
  60%     { filter: hue-rotate(-60deg) brightness(1.2); }
}
.glitch-flash { animation: glitch-flash 0.14s linear; }

/* ─── Overlays sur le stage ───────────────────────────────────────────────── */

.stage-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  text-align: center;
  pointer-events: none; /* laisser passer les clics sauf si contenu actif */
}
.stage-overlay[hidden] { display: none; }

/* Boot */
.boot-inner {
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 100%;
  max-width: 200px;
  pointer-events: none;
}

.boot-label {
  font-size: 9px;
  color: var(--fg-muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.boot-bar-track {
  width: 100%;
  height: 1px;
  background: var(--border);
  overflow: hidden;
}

.boot-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  opacity: 0.5;
  transition: width 0.35s ease;
}

/* Intro */
.intro-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.intro-title {
  font-size: clamp(14px, 3.5vw, 20px);
  letter-spacing: 0.2em;
  color: var(--accent);
  text-transform: uppercase;
  min-height: 1.4em;
}

.subject-counter {
  font-size: 9px;
  color: var(--fg-muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.subject-counter span { color: var(--fg-dim); }

/* Analyzing */
.analyzing-ring {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1.4s linear infinite;
  opacity: 0.6;
}
.analyzing-status {
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--fg-muted);
  text-transform: uppercase;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Zone sous le stage : statut + boutons ───────────────────────────────── */

.scan-sub {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  width: 100%;
  max-width: 520px;
  flex-shrink: 0;
}

.scan-status {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--fg-muted);
  text-transform: uppercase;
  text-align: center;
  min-height: 14px;
}

/* ─── Boutons ─────────────────────────────────────────────────────────────── */

.btn {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 0.2em;
  padding: 11px 22px;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s;
  width: 100%;
  max-width: 280px;
}
.btn:hover, .btn:focus { background: var(--accent); color: var(--bg); outline: none; }

.btn-secondary { border-color: var(--border); color: var(--fg-dim); }
.btn-secondary:hover, .btn-secondary:focus { background: var(--border); color: var(--fg); }

.btn-sm { padding: 8px 16px; font-size: 10px; }

/* ─── Footer ──────────────────────────────────────────────────────────────── */

.scan-footer {
  flex-shrink: 0;
  padding-top: 12px;
  display: flex;
  gap: 18px;
  font-size: 9px;
  color: var(--fg-muted);
  letter-spacing: 0.1em;
}

.scan-footer a,
.scan-footer .footer-btn {
  color: var(--fg-muted);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
  letter-spacing: inherit;
  transition: color 0.2s;
  padding: 0;
}
.scan-footer a:hover, .scan-footer .footer-btn:hover { color: var(--fg-dim); }

/* ─── Drawer résultats (slide from bottom) ────────────────────────────────── */

.results-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 80vh;
  background: rgba(4, 5, 10, 0.97);
  border-top: 1px solid var(--border);
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* backdrop-filter: blur(8px); */ /* activer si souhaité */
}

.results-drawer.is-open {
  transform: translateY(0);
}

.drawer-handle-bar {
  width: 32px;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  margin: 11px auto 0;
  flex-shrink: 0;
}

.drawer-inner {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 580px;
  width: 100%;
  margin: 0 auto;
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.results-title {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--accent);
  text-transform: uppercase;
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (min-width: 480px) {
  .results-grid { grid-template-columns: repeat(3, 1fr); }
}

.result-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s;
  outline: none;
}
.result-card:hover, .result-card:focus { border-color: var(--accent); }

.card-img-wrap {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: #000;
}
.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}
.result-card:hover .card-img { transform: scale(1.03); }

.card-body {
  padding: 8px 9px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.card-img-link { display: block; }

.card-img-wrap[data-id] {
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-img-wrap[data-id]::after {
  content: attr(data-id);
  color: var(--fg-muted);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-align: center;
  padding: 4px;
  word-break: break-all;
}

.card-id    { font-size: 9px;  color: var(--accent); letter-spacing: 0.08em; }
.card-event { font-size: 8px;  color: var(--fg-dim); }
.card-date  { font-size: 8px;  color: var(--fg-muted); }

.card-link {
  display: block;
  margin-top: 8px;
  padding: 6px 0;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--accent);
  text-decoration: none;
  text-transform: uppercase;
  border-top: 1px solid var(--border);
  transition: opacity 0.2s;
}
.card-link:hover { opacity: 0.7; }

.card-confidence { margin-top: 5px; }
.conf-bar-track {
  height: 1px;
  background: var(--border);
  overflow: hidden;
  margin-bottom: 3px;
}
.conf-bar-fill { height: 100%; background: var(--accent); transition: width 0.6s ease; }
.conf-label { font-size: 8px; color: var(--fg-muted); letter-spacing: 0.08em; }

/* ─── Modales fullscreen (CGU, About, No-match, Error) ────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 10, 0.96);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay[hidden] { display: none; }

.modal-box {
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border);
  background: var(--bg2);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-title {
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--accent);
  text-transform: uppercase;
}

.modal-body {
  font-size: 11px;
  color: var(--fg-dim);
  line-height: 1.8;
}
.modal-body a { color: var(--accent); text-underline-offset: 3px; }

.modal-close {
  align-self: flex-end;
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 15px;
  cursor: pointer;
  padding: 0;
  font-family: var(--font);
}

.or-sep {
  font-size: 9px;
  color: var(--fg-muted);
  letter-spacing: 0.2em;
  text-align: center;
}

.manual-form {
  display: flex;
  gap: 8px;
  width: 100%;
}

.manual-input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  font-family: var(--font);
  font-size: 12px;
  padding: 6px 2px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  outline: none;
  transition: border-color 0.2s;
}
.manual-input:focus       { border-bottom-color: var(--accent); }
.manual-input.input-error { border-bottom-color: #ff4444; animation: shake 0.3s ease; }
.manual-input::placeholder { color: var(--fg-muted); }

.error-msg {
  font-size: 11px;
  color: #ff6b6b;
  letter-spacing: 0.08em;
  line-height: 1.6;
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%     { transform: translateX(-4px); }
  75%     { transform: translateX(4px); }
}
