/* ============================================
   QR FREE — Design System & Styles v1.0
   HELLCAT TECH
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* ---- TOKENS ---- */
:root {
  --bg-primary:       #06060f;
  --bg-secondary:     #0d0d1e;
  --glass-bg:         rgba(255, 255, 255, 0.04);
  --glass-bg-hover:   rgba(255, 255, 255, 0.07);
  --glass-border:     rgba(255, 255, 255, 0.08);
  --glass-border-hov: rgba(255, 255, 255, 0.18);
  --text-primary:     #f0f0f8;
  --text-secondary:   #9090a8;
  --text-muted:       #505060;
  --accent-1:         #667eea;
  --accent-2:         #764ba2;
  --accent-gradient:  linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --silver-from:      #b0b0c8;
  --silver-to:        #ffffff;
  --silver-gradient:  linear-gradient(135deg, #a0a0c0, #ffffff, #8888b0);
  --glow-accent:      rgba(102, 126, 234, 0.35);
  --glow-silver:      rgba(200, 200, 255, 0.12);
  --success:          #10b981;
  --error:            #ef4444;
  --radius-sm:        8px;
  --radius-md:        14px;
  --radius-lg:        20px;
  --radius-xl:        28px;
  --shadow-card:      0 8px 32px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.2);
  --shadow-glow:      0 0 40px rgba(102,126,234,0.2);
  --header-bg:        rgba(6, 6, 15, 0.8);
  --transition:       0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

:root.light-mode {
  --bg-primary:       #f8f9fa;
  --bg-secondary:     #ffffff;
  --glass-bg:         rgba(0, 0, 0, 0.04);
  --glass-bg-hover:   rgba(0, 0, 0, 0.07);
  --glass-border:     rgba(0, 0, 0, 0.08);
  --glass-border-hov: rgba(0, 0, 0, 0.18);
  --text-primary:     #111827;
  --text-secondary:   #4b5563;
  --text-muted:       #9ca3af;
  --silver-from:      #4a4a5a;
  --silver-to:        #111827;
  --silver-gradient:  linear-gradient(135deg, #6b7280, #111827, #4b5563);
  --shadow-card:      0 8px 32px rgba(0,0,0,0.1), 0 2px 8px rgba(0,0,0,0.05);
  --shadow-glow:      0 0 40px rgba(102,126,234,0.1);
  --header-bg:        rgba(248, 249, 250, 0.9);
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Outfit', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ================================================
   PRELOADER
   ================================================ */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(ellipse at center, var(--bg-secondary) 0%, var(--bg-primary) 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#preloader.fade-out {
  opacity: 0;
  visibility: hidden;
}

.preloader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  animation: preloaderEntrance 0.5s ease both;
}

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

.preloader-logo-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--glass-border),
              0 0 40px rgba(102,126,234,0.3),
              0 0 80px rgba(118,75,162,0.2);
  animation: logoGlow 2s ease-in-out infinite alternate;
}

@keyframes logoGlow {
  from { box-shadow: 0 0 0 1px var(--glass-border), 0 0 40px rgba(102,126,234,0.3), 0 0 80px rgba(118,75,162,0.2); }
  to   { box-shadow: 0 0 0 1px var(--glass-border-hov), 0 0 60px rgba(102,126,234,0.5), 0 0 120px rgba(118,75,162,0.4); }
}

.preloader-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Scan line animation */
.scan-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(102,126,234,0.6) 20%,
    rgba(200,220,255,1) 50%,
    rgba(118,75,162,0.6) 80%,
    transparent 100%
  );
  box-shadow: 0 0 12px rgba(180,200,255,0.8), 0 0 24px rgba(102,126,234,0.6);
  animation: scanMove 1.8s ease-in-out infinite;
  top: 0;
}

@keyframes scanMove {
  0%   { top: 0%;   opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* Scan corner decorations */
.preloader-logo-wrap::before,
.preloader-logo-wrap::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  z-index: 2;
}
.preloader-logo-wrap::before {
  top: 6px; left: 6px;
  border-top: 2px solid #667eea;
  border-left: 2px solid #667eea;
  border-radius: 3px 0 0 0;
}
.preloader-logo-wrap::after {
  bottom: 6px; right: 6px;
  border-bottom: 2px solid #764ba2;
  border-right: 2px solid #764ba2;
  border-radius: 0 0 3px 0;
}

.preloader-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.preloader-brand {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  background: var(--silver-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 2s ease-in-out infinite;
  background-size: 200% auto;
}

@keyframes shimmer {
  0%   { background-position: 0% center; }
  50%  { background-position: 100% center; }
  100% { background-position: 0% center; }
}

.preloader-sub {
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.25em;
  color: var(--text-secondary);
  text-transform: uppercase;
  opacity: 0;
  animation: fadeInUp 0.5s ease 0.4s forwards;
}

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

.preloader-bar {
  width: 180px;
  height: 3px;
  background: var(--glass-border);
  border-radius: 100px;
  overflow: hidden;
}

.preloader-progress {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  border-radius: 100px;
  box-shadow: 0 0 10px rgba(102,126,234,0.8);
  animation: barFill 2.2s cubic-bezier(0.4,0,0.2,1) forwards;
}

@keyframes barFill {
  0%   { width: 0%; }
  30%  { width: 40%; }
  60%  { width: 70%; }
  85%  { width: 88%; }
  100% { width: 100%; }
}

/* ================================================
   APP LAYOUT
   ================================================ */
#app {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#app.hidden { display: none; }

/* Background canvas */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

/* ================================================
   HEADER
   ================================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  padding: 0 24px;
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  cursor: pointer;
}

.header-logo-img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 0 16px rgba(102,126,234,0.25);
}

.header-title-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: var(--silver-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-subtitle {
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-top: 3px;
}

.install-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.install-btn:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hov);
  box-shadow: var(--shadow-glow);
}

/* ================================================
   MAIN
   ================================================ */
.main {
  flex: 1;
  position: relative;
  z-index: 1;
  padding: 48px 24px 80px;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

/* ================================================
   HERO
   ================================================ */
.hero {
  text-align: center;
  max-width: 660px;
  margin: 0 auto;
}

.hero-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ================================================
   TYPE SELECTOR
   ================================================ */
.type-section {}

.type-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 12px;
}

.type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  font-family: 'Outfit', sans-serif;
  position: relative;
  overflow: hidden;
}

.type-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition);
}

.type-card:hover {
  border-color: var(--glass-border-hov);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.type-card:hover::before { opacity: 0.08; }

.type-card.active {
  border-color: var(--accent-1);
  color: var(--text-primary);
  background: rgba(102, 126, 234, 0.1);
  box-shadow: 0 0 0 1px rgba(102,126,234,0.3), var(--shadow-glow);
}

.type-card.active::before { opacity: 0.12; }

.type-icon {
  font-size: 1.8rem;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 2px 8px rgba(102,126,234,0.4));
  transition: transform var(--transition);
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
  padding: 10px 12px;
  background: rgba(102,126,234,0.06);
  border-radius: var(--radius-sm);
  border-left: 2px solid rgba(102,126,234,0.4);
}

.type-card:hover .type-icon,
.type-card.active .type-icon {
  transform: scale(1.12);
}

.type-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  position: relative;
  z-index: 1;
}

/* ================================================
   GENERATOR SECTION
   ================================================ */
.generator-section {}

.generator-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}

.form-panel {
  position: relative;
  z-index: 10;
  overflow: visible !important;
}

.preview-panel {
  position: relative;
  z-index: 5;
}

/* ================================================
   GLASS CARD
   ================================================ */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 32px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--glass-border);
}

.panel-icon {
  font-size: 1.4rem;
  filter: drop-shadow(0 2px 6px rgba(102,126,234,0.5));
  transition: var(--transition);
}

.panel-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ================================================
   FORMS
   ================================================ */
.qr-form { display: none; flex-direction: column; gap: 18px; }
.qr-form.active {
  display: flex;
  position: relative;
  z-index: 20; /* Assure que les dropdowns du formulaire s'affichent par-dessus le reste */
  animation: formSlideIn 0.3s ease both;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 400;
  outline: none;
  transition: var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.form-input::placeholder { color: var(--text-muted); }

/* ---- Phone field with dial code ---- */
.phone-field {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

/* ---- Custom Dial Picker ---- */
.dial-picker {
  position: relative;
  flex: 0 0 auto;
  z-index: 30;
}

.dial-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.dial-trigger:hover,
.dial-trigger:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-1);
}

.dial-flag {
  font-size: 1.15rem;
}

.dial-code {
  font-family: 'Courier New', monospace;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.dial-chevron {
  color: var(--text-muted);
  opacity: 0.7;
  transition: transform var(--transition);
}

.dial-trigger[aria-expanded="true"] .dial-chevron {
  transform: rotate(180deg);
}

/* Dropdown Container */
.dial-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 100;
  width: 280px;
  background: rgba(10, 10, 22, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 
              0 0 0 1px rgba(102, 126, 234, 0.15);
  animation: dialFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

@keyframes dialFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Search Field */
.dial-search-wrap {
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dial-search {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
  transition: var(--transition);
}

.dial-search:focus {
  border-color: rgba(102, 126, 234, 0.6);
  background: rgba(255, 255, 255, 0.05);
}

/* Countries List */
.dial-list {
  max-height: 220px;
  overflow-y: auto;
  list-style: none;
  padding: 6px 0;
  margin: 0;
}

/* Custom Scrollbar for list */
.dial-list::-webkit-scrollbar {
  width: 6px;
}
.dial-list::-webkit-scrollbar-track {
  background: transparent;
}
.dial-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
.dial-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.dial-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition), color var(--transition);
}

.dial-item:hover {
  background: rgba(102, 126, 234, 0.12);
  color: var(--text-primary);
}

.dial-item.selected {
  background: rgba(102, 126, 234, 0.25);
  color: var(--text-primary);
  font-weight: 600;
}

.dial-item-flag {
  font-size: 1.1rem;
}

.dial-item-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dial-item-code {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  color: var(--accent-1);
}

.dial-no-results {
  padding: 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

.phone-number {
  flex: 1;
}

@media (max-width: 600px) {
  .dial-trigger {
    padding: 12px 10px;
    gap: 4px;
    font-size: 0.82rem;
  }
  .dial-code {
    font-size: 0.78rem;
  }
  .dial-dropdown {
    width: 250px;
    position: fixed;
    top: auto;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.9);
    animation: dialMobileSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
  
  @keyframes dialMobileSlideUp {
    from { opacity: 0; transform: translate(-50%, 40px); }
    to { opacity: 1; transform: translate(-50%, 0); }
  }
}

/* ---- GPS Button ---- */
.gps-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: rgba(102, 126, 234, 0.08);
  border: 1px dashed rgba(102, 126, 234, 0.45);
  border-radius: var(--radius-md);
  color: #a5b4fc;
  font-family: 'Outfit', sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.02em;
}

.gps-btn:hover:not(:disabled) {
  background: rgba(102, 126, 234, 0.15);
  border-color: rgba(102, 126, 234, 0.7);
  color: #c7d2fe;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.25);
}

.gps-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.gps-btn.loading {
  border-style: solid;
  animation: gpsPulse 1.2s ease-in-out infinite;
}

.gps-btn.success {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.45);
  border-style: solid;
  color: #4ade80;
}

@keyframes gpsPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(102,126,234,0.3); }
  50%       { box-shadow: 0 0 0 6px rgba(102,126,234,0); }
}

.gps-btn-icon {
  font-size: 1.1rem;
}

.gps-status {
  font-size: 0.8rem;
  font-weight: 500;
  min-height: 1.2em;
  text-align: center;
  transition: var(--transition);
}

/* ---- Form Divider ---- */
.form-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 4px 0;
}

.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}


.form-input:focus {
  border-color: var(--accent-1);
  background: rgba(102,126,234,0.06);
  box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

.form-input:hover:not(:focus) {
  border-color: rgba(255,255,255,0.14);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.form-select option {
  background: #1a1a2e;
  color: var(--text-primary);
}

/* Date input */
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

/* Password toggle */
.input-with-toggle {
  position: relative;
}

.input-with-toggle .form-input {
  padding-right: 46px;
}

.toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.5;
  transition: opacity var(--transition);
  padding: 4px;
  line-height: 1;
}

.toggle-pw:hover { opacity: 1; }

/* Checkbox */
.form-check { flex-direction: row; align-items: center; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-secondary);
  user-select: none;
}

.checkbox-label input[type="checkbox"] { display: none; }

.checkmark {
  width: 18px;
  height: 18px;
  border: 1px solid var(--glass-border);
  border-radius: 5px;
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
  background: var(--accent-gradient);
  border-color: var(--accent-1);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
  content: '✓';
  font-size: 0.65rem;
  color: white;
  font-weight: 700;
}

/* ================================================
   COLOR OPTIONS
   ================================================ */
.color-options {
  display: flex;
  gap: 20px;
  padding: 20px;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  margin-top: 8px;
}

.color-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.color-pick-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-picker {
  width: 38px;
  height: 38px;
  border: 2px solid var(--glass-border);
  border-radius: 8px;
  padding: 2px;
  cursor: pointer;
  background: none;
  transition: var(--transition);
}

.color-picker::-webkit-color-swatch-wrapper { padding: 0; border-radius: 5px; }
.color-picker::-webkit-color-swatch { border: none; border-radius: 5px; }
.color-picker:hover { border-color: var(--glass-border-hov); }

.color-hex {
  font-size: 0.78rem;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

.margin-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  transition: background 0.3s;
}

.margin-slider:hover {
  background: rgba(255, 255, 255, 0.15);
}

.margin-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-gradient);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
  transition: transform 0.1s;
}

.margin-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.margin-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: var(--accent-gradient);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
  transition: transform 0.1s;
}

.margin-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
}

.margin-val {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 15px;
  text-align: center;
}

/* ================================================
   GENERATE BUTTON
   ================================================ */
.generate-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px 24px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 12px;
  position: relative;
  z-index: 5; /* Stacking context inférieur au formulaire */
  overflow: hidden;
}

.generate-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.generate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(102,126,234,0.45), 0 2px 8px rgba(0,0,0,0.3);
}

.generate-btn:hover::before { opacity: 1; }
.generate-btn:active { transform: translateY(0); }

.btn-icon {
  font-size: 1.1rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.2); }
}

/* ================================================
   PREVIEW PANEL
   ================================================ */
.preview-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.qr-preview-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  background: rgba(0,0,0,0.3);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--glass-border);
  overflow: hidden;
  transition: var(--transition);
}

.qr-preview-wrap.has-qr {
  background: transparent;
  border-style: solid;
  border-color: rgba(102,126,234,0.2);
}

#qrcode {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  gap: 12px;
}

#qrcode canvas {
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  animation: qrReveal 0.5s cubic-bezier(0.4,0,0.2,1) both;
  max-width: 100%;
}

.qr-info-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-family: monospace;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  word-break: break-all;
  max-width: 260px;
  text-align: center;
}

@keyframes qrReveal {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

/* Placeholder */
.qr-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--text-muted);
  padding: 40px 20px;
  text-align: center;
}

.placeholder-icon {
  font-size: 3.5rem;
  opacity: 0.25;
  animation: floatPlaceholder 3s ease-in-out infinite;
}

@keyframes floatPlaceholder {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.qr-placeholder p {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ================================================
   PREVIEW ACTIONS
   ================================================ */
.preview-actions {
  display: flex;
  gap: 10px;
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.action-btn svg { flex-shrink: 0; }

.action-btn.primary {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
}

.action-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102,126,234,0.4);
}

.action-btn.secondary {
  background: var(--glass-bg);
  color: var(--text-primary);
  border-color: var(--glass-border);
}

.action-btn.secondary:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hov);
  transform: translateY(-1px);
}

.action-btn.tertiary {
  background: rgba(16,185,129,0.1);
  color: var(--success);
  border-color: rgba(16,185,129,0.2);
}

.action-btn.tertiary:hover {
  background: rgba(16,185,129,0.18);
  border-color: rgba(16,185,129,0.4);
  transform: translateY(-1px);
}

/* ================================================
   TOAST NOTIFICATION
   ================================================ */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1000;
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1), opacity 0.4s ease;
  opacity: 0;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success {
  background: rgba(16,185,129,0.15);
  border: 1px solid rgba(16,185,129,0.35);
  color: #4ade80;
  backdrop-filter: blur(12px);
}

.toast.error {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.35);
  color: #f87171;
  backdrop-filter: blur(12px);
}

.toast.info {
  background: rgba(102,126,234,0.15);
  border: 1px solid rgba(102,126,234,0.35);
  color: #a5b4fc;
  backdrop-filter: blur(12px);
}

/* ================================================
   FOOTER
   ================================================ */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px;
  border-top: 1px solid var(--glass-border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer strong { color: var(--text-secondary); }

/* ================================================
   BACKGROUND — Animated dots/grid
   ================================================ */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,0.04) 1px, transparent 0);
  background-size: 40px 40px;
  pointer-events: none;
}

/* ================================================
   SCROLL HINT (mobile only)
   ================================================ */
.scroll-hint {
  display: none;
}

@media (max-width: 900px) {
  .scroll-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 1;
    transition: opacity 0.5s ease;
    pointer-events: none;
    user-select: none;
  }

  .scroll-hint.hidden {
    opacity: 0;
  }

  .scroll-hint-arrow {
    opacity: 0.6;
    animation: arrowPulse 1.4s ease-in-out infinite;
    flex-shrink: 0;
  }

  .scroll-hint-arrow:last-child {
    animation-delay: 0.2s;
  }

  .scroll-hint-text {
    opacity: 0.7;
  }
}

@keyframes arrowPulse {
  0%, 100% { transform: translateX(0);   opacity: 0.4; }
  50%       { transform: translateX(4px); opacity: 1;   }
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 900px) {
  .generator-grid {
    grid-template-columns: 1fr;
  }

  /* Ligne horizontale défilante */
  .type-section {
    overflow: hidden;
  }

  .type-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 6px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;          /* Firefox */
  }

  .type-grid::-webkit-scrollbar { display: none; } /* Chrome/Safari */

  .type-card {
    flex: 0 0 auto;
    width: 90px;
    scroll-snap-align: start;
  }
}

@media (max-width: 600px) {
  .main { padding: 32px 16px 60px; }
  .glass-card { padding: 22px 18px; }

  .type-card {
    padding: 14px 10px;
    gap: 6px;
    width: 80px;
  }

  .type-icon { font-size: 1.4rem; }
  .type-label { font-size: 0.65rem; }

  .form-row { grid-template-columns: 1fr; }

  .form-input,
  .dial-search {
    font-size: 16px; /* Empêche le zoom automatique sur iOS lors de la saisie */
  }

  .color-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
  }

  .color-options .color-group:last-child {
    grid-column: span 2;
  }

  .preview-actions { flex-wrap: wrap; }

  .header-subtitle {
    display: block;
    font-size: 0.58rem;
  }

  .preloader-sub {
    font-size: 0.58rem;
    letter-spacing: 0.12em;
    text-align: center;
    padding: 0 16px;
    line-height: 1.4;
  }
}

/* ================================================
   SCROLLBAR
   ================================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb {
  background: rgba(102,126,234,0.3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(102,126,234,0.5); }

/* ================================================
   SELECTION
   ================================================ */
::selection {
  background: rgba(102,126,234,0.35);
  color: var(--text-primary);
}
