:root {
  --primary: #1A2B4A;
  --primary-light: #2A4A7A;
  --primary-dark: #0F1A2E;
  --accent: #4A7FB5;
  --accent-light: #C8DCF0;
  --bg: #F4F8FC;
  --surface: #FFFFFF;
  --border: #D0DFF0;
  --text: #1A2B4A;
  --text-muted: #5A6A7A;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(26,43,74,0.08);
  --warning: #F59E0B;
  --warning-bg: #FFFBEB;
  --warning-border: #FDE68A;
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

h1, h2 {
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* ── Nav ── */
nav {
  background: #FFFFFF;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(26,43,74,0.08);
  border-bottom: 1px solid #D8E4EE;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo img {
  height: 42px;
  width: auto;
  border-radius: 6px;
}

.logo-text {
  font-size: 1.3rem;
  font-weight: 800;
  color: white;
  letter-spacing: -0.5px;
}

.logo-text span { color: var(--accent-light); }

.nav-links { display: flex; align-items: center; gap: 1rem; }
.nav-links a { color: #1A1A1A; text-decoration: none; font-size: 0.9rem; font-weight: 500; transition: all .2s; }
.nav-links a:hover, .nav-links a.active { color: #000000; background: #EEEEEE; border-radius: 4px; padding: 4px 10px; }

.lang-toggle {
  display: flex;
  gap: 4px;
  background: #EEF4FA;
  border-radius: 20px;
  padding: 3px;
}

.lang-toggle a {
  padding: 2px 10px;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #1A2B4A;
  text-decoration: none;
  transition: all .2s;
}

.lang-toggle a.active {
  background: #1A2B4A;
  color: white;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-light); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }

.btn-accent {
  background: var(--accent);
  color: white;
}
.btn-accent:hover { filter: brightness(0.9); }

.btn-ghost {
  background: white !important;
  color: #1A2B4A !important;
  border-color: white !important;
  font-weight: 600;
}
.btn-ghost:hover, .btn-ghost:focus, .btn-ghost:active {
  background: rgba(255,255,255,0.9) !important;
  border-color: rgba(255,255,255,0.9) !important;
  color: #1A2B4A !important;
  filter: none !important;
}

.btn-warning {
  background: var(--warning);
  color: white;
}
.btn-warning:hover { filter: brightness(0.9); }

.btn-ghost {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
}
.btn-ghost:hover { background: rgba(255,255,255,0.25); }

.btn-lg { padding: 14px 32px; font-size: 1rem; border-radius: 10px; }

/* ── Layout ── */
.container { max-width: 900px; margin: 0 auto; padding: 0 1.5rem; }
.page { padding: 2.5rem 0 4rem; }

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 5rem 1.5rem 4rem;
  background: linear-gradient(180deg, #FFFFFF 0%, #E8F0FA 60%, #D0E4F4 100%);
  color: #1A2B4A;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(to bottom right, transparent 49%, #F4F8FC 50%);
  pointer-events: none;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: #1A2B4A;
  position: relative;
}

.hero h1 span {
  color: #4A7FB5;
  -webkit-text-fill-color: #4A7FB5;
}

.hero p {
  font-size: 1.1rem;
  color: #3A5A7A;
  max-width: 520px;
  margin: 0 auto 2rem;
  position: relative;
}

.hero-badges {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.badge {
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(26,43,74,0.2);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.85rem;
  color: #1A2B4A;
  font-weight: 500;
}

.badge-link {
  text-decoration: none;
  cursor: pointer;
  transition: all .2s;
}
.badge-link:hover {
  background: rgba(255,255,255,0.95);
  border-color: #4A7FB5;
  color: #4A7FB5;
}

/* ── Features ── */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  padding: 3rem 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.feature-icon { font-size: 1.8rem; margin-bottom: 0.75rem; }

.feature-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--primary-dark);
}

.feature-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Auth forms ── */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 420px;
  margin: 3rem auto;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--primary-dark);
}

.auth-card p.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 4px; color: var(--primary); }

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--bg);
  transition: border-color .2s;
  outline: none;
  color: var(--text);
}

.form-group input:focus,
.form-group select:focus { border-color: var(--accent); }

.error-msg {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #DC2626;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.auth-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.auth-footer a { color: var(--primary-light); }

/* ── Credits badge ── */
.credits-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1A2B4A;
  color: #FFFFFF !important;
  border: 2px solid #1A2B4A;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .2s, transform .1s;
}
.credits-badge:hover {
  background: #4A7FB5;
  border-color: #4A7FB5;
  transform: scale(1.04);
  color: white;
}

/* ── Upload ── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--surface);
}

.upload-area:hover, .upload-area.dragover {
  border-color: var(--accent);
  background: #F5F5F5;
}

.upload-area .upload-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.upload-area h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; color: var(--primary); }
.upload-area p { color: var(--text-muted); font-size: 0.85rem; }

/* ── Warning box ── */
.warning-box {
  background: var(--warning-bg);
  border: 1.5px solid var(--warning-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.warning-box .warning-title {
  font-size: 1rem;
  font-weight: 700;
  color: #92400E;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.warning-box p {
  font-size: 0.875rem;
  color: #78350F;
  margin-bottom: 1rem;
}

.warning-box .warning-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ── Results ── */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

@media (max-width: 640px) {
  .results-grid { grid-template-columns: 1fr; }
}

.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.1);
}

.color-name { font-size: 0.85rem; font-weight: 500; flex: 1; color: var(--text); }
.color-pct {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: right;
}

.color-surface {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 500;
  min-width: 60px;
  text-align: right;
}

.palette-img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* ── Image preview ── */
.image-preview {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

/* ── Dimensions input ── */
.dimensions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* ── Pricing ── */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.pricing-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow);
}

.pricing-card.featured {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(27,42,74,0.08);
}

.pricing-card .price {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin: 0.75rem 0 0.25rem;
}

.pricing-card .price span { font-size: 1rem; font-weight: 400; color: var(--text-muted); }
.pricing-card p { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.5rem; }

.popular-tag {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: #2C7A4A;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 14px;
  border-radius: 12px;
  white-space: nowrap;
}

.attack-tag {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--warning);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 14px;
  border-radius: 12px;
  white-space: nowrap;
}

/* ── Loader ── */
.loader {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem;
  text-align: center;
}

.spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── History ── */
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.85rem;
  gap: 8px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 1rem;
}

.divider { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ── Success page ── */
.success-card {
  text-align: center;
  padding: 3rem 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 480px;
  margin: 3rem auto;
  box-shadow: var(--shadow);
}

.success-icon { font-size: 3rem; margin-bottom: 1rem; }

/* ── Back button ── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  transition: color .2s;
}
.back-btn:hover { color: var(--primary); }

/* cache v17 */
/* ═══════════════════════════════════════
   RESPONSIVE MOBILE (max 768px)
   ═══════════════════════════════════════ */

@media (max-width: 768px) {

  /* ── Nav ── */
  nav {
    padding: 0 1rem;
    height: auto;
    flex-wrap: wrap;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
    gap: 0.5rem;
  }
  .logo img { height: 32px; }
  .logo-text { font-size: 1rem; }
  .nav-links {
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
    justify-content: flex-start;
  }
  .nav-links a { font-size: 0.8rem; padding: 4px 8px; }
  .credits-badge { font-size: 0.8rem; padding: 4px 10px; }

  /* ── Container ── */
  .container { padding: 0 1rem; }
  .page { padding-top: 1.25rem; }

  /* ── Page d'accueil ── */
  .hero h1 { font-size: 1.6rem; }
  .hero p { font-size: 0.95rem; }
  .features { grid-template-columns: 1fr 1fr !important; gap: 0.75rem; }
  .feature-card { padding: 1rem; }

  /* ── Formulaire analyse ── */
  /* Dimensions sur une colonne */
  div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  /* Profils densité sur une colonne */
  div[style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* ── Résultats ── */
  /* Miniature + couleurs empilés */
  div[style*="grid-template-columns:140px 1fr"] {
    grid-template-columns: 1fr !important;
  }
  #image-preview {
    width: 100% !important;
    height: 160px !important;
  }
  /* Boutons résultats en colonne */
  div[style*="display:flex;gap:0.75rem;flex-wrap:wrap"] {
    flex-direction: column;
    width: 100%;
  }

  /* ── Color rows ── */
  .color-row { flex-wrap: wrap; gap: 4px; }
  .color-name { font-size: 0.8rem; }
  .color-surface { font-size: 0.78rem; }

  /* ── Historique ── */
  .history-item {
    flex-wrap: wrap;
    gap: 6px;
  }
  .history-item span:first-child {
    width: 100%;
  }

  /* ── Page tarifs ── */
  div[style*="grid-template-columns:1fr 1fr"][class*="pricing"],
  .pricing-card { padding: 1rem; }

  /* ── Page Mon compte ── */
  div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* ── Buttons ── */
  .btn-lg { padding: 12px 20px; font-size: 0.95rem; }

  /* ── Upload zone ── */
  .upload-area { padding: 1.5rem 1rem; }
  .upload-icon { font-size: 2rem; }

  /* ── Warning box ── */
  .warning-box { padding: 1rem; }
  .warning-actions { flex-direction: column; gap: 0.5rem; }
  .warning-actions .btn { width: 100%; justify-content: center; }

  /* ── Surface info ── */
  #surface-info { font-size: 0.8rem; line-height: 2; }

  /* ── Loader ── */
  .loader { padding: 2rem 1rem; }

  /* ── Pricing grid ── */
  .pricing-grid,
  div[style*="grid-template-columns:1fr 1fr"][style*="max-width:620px"] {
    grid-template-columns: 1fr !important;
  }

  /* ── Success page ── */
  .success-box { padding: 1.5rem 1rem; }

}

@media (max-width: 400px) {
  .features { grid-template-columns: 1fr !important; }
  .nav-links a { font-size: 0.75rem; }
  .logo-text { display: none; }
}
