/* ========================================
   DESIGN SYSTEM — BOUNCE (cohérent avec index scanner)
   ======================================== */
:root {
  --bg:          #080808;
  --surface:     #0f0f0f;
  --surface2:    #141414;
  --border:      #1a1a1a;
  --accent:      #ff6b00;
  --accent-dim:  rgba(255, 107, 0, 0.12);
  --accent-glow: rgba(255, 107, 0, 0.25);
  --text:        #f0f0f0;
  --muted:       #505050;
  --muted2:      #787878;
  --success:     #27ae60;
  --error:       #e74c3c;
  --warning:     #f39c12;
}

/* ========================================
   RESET
   ======================================== */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Syne', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Grain subtil */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

/* ========================================
   LAYOUT
   ======================================== */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
}

/* ========================================
   LOGO
   ======================================== */
.logo-wrap {
  text-align: center;
  margin-bottom: 40px;
}

.logo-text {
  font-family: 'Syne', sans-serif;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--accent);
  text-transform: uppercase;
  display: block;
  margin-bottom: 8px;
}

.logo-sub {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.logo-sub i {
  color: var(--accent);
  font-size: 10px;
}

/* ========================================
   CARD
   ======================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px;
  animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ========================================
   SECTIONS / FORMULAIRES
   ======================================== */
.auth-section {
  display: none;
}
.auth-section.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: scale(1); }
}

/* ========================================
   TITRES
   ======================================== */
.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}

.card-sub {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--muted2);
  margin-bottom: 28px;
  letter-spacing: 0.03em;
}

/* ========================================
   CHAMPS
   ======================================== */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 7px;
}

.field .optional {
  color: var(--muted);
  font-size: 10px;
  text-transform: none;
  letter-spacing: 0;
}

.field input {
  width: 100%;
  padding: 13px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
.field input::placeholder { color: var(--muted); }
.field input:focus { border-color: var(--accent); }

/* Code vérification — grand et centré */
.code-input {
  font-size: 28px !important;
  letter-spacing: 12px;
  text-align: center;
  font-weight: 700;
  padding: 18px 12px !important;
  max-width: 260px;
  margin: 0 auto;
  display: block !important;
}

/* ========================================
   BOUTON PRINCIPAL
   ======================================== */
.btn-submit {
  width: 100%;
  padding: 15px;
  margin-top: 8px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 8px;
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-submit:hover:not(:disabled)  { background: #ff8533; }
.btn-submit:active:not(:disabled) { transform: scale(0.98); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========================================
   MESSAGES
   ======================================== */
.msg {
  display: none;
  padding: 11px 14px;
  border-radius: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  margin-bottom: 16px;
  line-height: 1.5;
  border-left: 3px solid;
}
.msg.error   { background: rgba(231,76,60,0.08);  color: var(--error);   border-color: var(--error); }
.msg.success { background: rgba(39,174,96,0.08);  color: var(--success); border-color: var(--success); }
.msg.warning { background: rgba(243,156,18,0.08); color: var(--warning); border-color: var(--warning); }
.msg.show    { display: block; }

/* ========================================
   SPINNER
   ======================================== */
.btn-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========================================
   RENVOYER CODE
   ======================================== */
.resend-wrap {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--muted2);
}

.btn-text-link {
  background: none;
  border: none;
  color: var(--accent);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.15s;
}
.btn-text-link:hover { opacity: 0.75; }
.btn-text-link:disabled { opacity: 0.4; cursor: not-allowed; }

/* ========================================
   TOGGLE LINK
   ======================================== */
.toggle-link {
  margin-top: 20px;
  text-align: center;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--muted2);
}
.toggle-link a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.15s;
}
.toggle-link a:hover { opacity: 0.75; }

/* ========================================
   RETOUR ACCUEIL
   ======================================== */
.back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: color 0.15s;
}
.back-link:hover { color: var(--muted2); }
.back-link i { font-size: 10px; }

/* ========================================
   UTILITAIRES
   ======================================== */
.hidden { display: none !important; }

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 480px) {
  body { padding: 16px; }

  .card { padding: 24px 20px; }

  .logo-text { font-size: 28px; }

  .code-input {
    font-size: 22px !important;
    letter-spacing: 8px;
  }
}

@media (max-width: 360px) {
  .card { padding: 20px 16px; }

  .code-input {
    font-size: 18px !important;
    letter-spacing: 6px;
  }
}
