/* ====================================================================
   CAP SUR L'AFRIQUE — Système de design
   Palette panafricaine élégante, formes douces, mobile-first.
   ==================================================================== */

:root {
  --emeraude: #00875A;
  --emeraude-dark: #006e49;
  --emeraude-light: #e6f4ef;
  --ocre: #D4A24E;
  --ocre-dark: #b9883a;
  --bleu: #1A365D;
  --fond-clair: #FAFAF8;
  --texte: #1A202C;
  --texte-doux: #4A5568;
  --succes: #38A169;
  --erreur: #E53E3E;
  --attention: #DD6B20;
  --info: #3182CE;
  --rayon: 14px;
  --rayon-lg: 20px;
  --ombre-douce: 0 4px 20px rgba(26, 54, 93, 0.08);
  --ombre-hover: 0 14px 40px rgba(26, 54, 93, 0.16);
  --transition: 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

* { -webkit-tap-highlight-color: transparent; }
[x-cloak] { display: none !important; }

/* Empêcher le scroll horizontal sur mobile */
html, body { overflow-x: hidden; max-width: 100vw; }
.app-mobile .container-cap { padding-left: 16px; padding-right: 16px; }
.app-mobile .section { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.app-mobile .hero-bg { padding-left: 16px; padding-right: 16px; }
.app-mobile .titre-hero { font-size: 1.75rem; line-height: 1.2; }
.app-mobile .titre-section { font-size: 1.5rem; }

/* ═══ APP MOBILE — RENDU NATIF ═══════════════════════════════════ */

/* Boutons natifs : pas de débordement, taille tactile */
.app-mobile .btn {
  white-space: normal; word-break: break-word; text-align: center;
  font-size: .875rem; min-height: 46px; border-radius: 14px;
}
.app-mobile .btn-cta { font-size: .875rem; padding: .8rem 1.25rem; }
.app-mobile .btn-outline { border-width: 1.5px; }

/* Cards */
.app-mobile .card { max-width: 100%; border-radius: 16px; }
.app-mobile .card-pad { padding: 1rem; }

/* Formulaires : champs plus grands, plus tactiles */
.app-mobile .form-input, .app-mobile .form-select {
  font-size: 16px !important; /* empêche le zoom iOS */
  padding: .9rem 1rem .5rem !important;
  border-radius: 12px !important;
  min-height: 50px;
}
.app-mobile .field { margin-bottom: 1rem; }
.app-mobile .floating-label { font-size: .8rem; }

/* Blobs décoratifs : masqués sur mobile (économie de perf) */
.app-mobile .blob { display: none; }

/* Titres */
.app-mobile h1 { font-size: 1.4rem !important; line-height: 1.3; }
.app-mobile h2 { font-size: 1.15rem !important; }
.app-mobile h2.text-xs { font-size: 0.75rem !important; }

/* Badges */
.app-mobile .badge { font-size: .65rem; padding: .3rem .6rem; }

/* Avatars */
.app-mobile .avatar { border: 2px solid rgba(0,135,90,.15); }

/* Section spacing */
.app-mobile .section { padding-top: 1.25rem; padding-bottom: 1.25rem; }

/* Grid : forcer 1 colonne sur petit écran */
@media (max-width: 480px) {
  .app-mobile .sm\:grid-cols-2 { grid-template-columns: 1fr !important; }
  .app-mobile .grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .app-mobile .lg\:grid-cols-5 { grid-template-columns: repeat(2, 1fr) !important; }
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--fond-clair);
  color: var(--texte);
  overflow-x: hidden;
  min-height: 100vh;
}

h1, h2, h3, .font-display { font-family: 'Poppins', 'Inter', sans-serif; }
.font-serif-display { font-family: 'Playfair Display', serif; }

/* ── Conteneur responsive ─────────────────────────────────────────── */
.container-cap {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

.section { padding-block: clamp(3rem, 8vw, 6rem); }

/* Titres fluides qui ne débordent jamais */
.titre-hero { font-size: clamp(2rem, 6vw, 4rem); line-height: 1.05; letter-spacing: -0.02em; }
.titre-section { font-size: clamp(1.6rem, 4vw, 2.6rem); line-height: 1.15; }

/* Anti-débordement de texte */
.truncate-1, .truncate-2, .truncate-3 {
  display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.truncate-1 { -webkit-line-clamp: 1; }
.truncate-2 { -webkit-line-clamp: 2; }
.truncate-3 { -webkit-line-clamp: 3; }

/* ── Boutons ──────────────────────────────────────────────────────── */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.5rem; border-radius: var(--rayon);
  font-weight: 600; font-size: .95rem; cursor: pointer; border: none;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .65; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--emeraude); color: #fff; box-shadow: 0 6px 18px rgba(0,135,90,.28); }
.btn-primary:hover { background: var(--emeraude-dark); box-shadow: 0 10px 26px rgba(0,135,90,.36); }
.btn-secondary { background: var(--ocre); color: #fff; box-shadow: 0 6px 18px rgba(212,162,78,.28); }
.btn-secondary:hover { background: var(--ocre-dark); }
.btn-bleu { background: var(--bleu); color: #fff; }
.btn-outline { background: transparent; color: var(--emeraude); border: 1.5px solid var(--emeraude); }
.btn-outline:hover { background: var(--emeraude); color: #fff; }
.btn-ghost { background: transparent; color: var(--texte-doux); }
.btn-ghost:hover { background: rgba(0,0,0,.04); }

/* CTA avec dégradé animé subtil */
.btn-cta {
  background: linear-gradient(120deg, var(--emeraude), #00a06b, var(--ocre));
  background-size: 200% 200%; color: #fff;
  animation: gradientShift 6s ease infinite;
  box-shadow: 0 10px 30px rgba(0,135,90,.35);
}

/* Boutons natifs mobile (app Flutter) — les boutons pleine largeur
   grossissent automatiquement dans la WebView. */
.btn-native {
  width: 100%; padding: 1rem; border-radius: 14px; font-size: 1rem; font-weight: 600;
  min-height: 52px;
}
.btn-native:active { transform: scale(.96); }

/* En mode app mobile, TOUS les boutons full-width deviennent natifs. */
.app-mobile .btn.w-full {
  padding: 1rem; border-radius: 14px; font-size: 1rem; font-weight: 600;
  min-height: 52px;
}
.app-mobile .btn.w-full:active { transform: scale(.96); }

/* Remonter le contenu au-dessus de la bottom-nav */
.app-mobile main, .app-mobile .container-cap { padding-bottom: 80px; }

/* ── Cartes ───────────────────────────────────────────────────────── */
.card {
  background: #fff; border-radius: var(--rayon-lg);
  box-shadow: 0 2px 8px rgba(26,54,93,.06), 0 0 1px rgba(0,0,0,.05);
  border: 1px solid rgba(26,54,93,.06);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  overflow: hidden;
}
.card-hover:hover { transform: translateY(-5px); box-shadow: 0 16px 40px rgba(26,54,93,.10); border-color: rgba(0,135,90,.18); }
.card-pad { padding: clamp(1.25rem, 3vw, 1.75rem); }

/* Zoom photo expert au survol */
.media-zoom { overflow: hidden; }
.media-zoom img { transition: transform 600ms var(--transition); }
.media-zoom:hover img { transform: scale(1.08); }

/* ── Formulaires : floating labels ────────────────────────────────── */
.field { position: relative; margin-bottom: 1.35rem; }

.form-input, .form-select {
  width: 100%; padding: 1.05rem 2.6rem .55rem .95rem; font-size: 1rem;
  border: 1.5px solid #e2e8f0; border-radius: var(--rayon);
  background: #fff; color: var(--texte); transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
textarea.form-input { padding-top: 1.4rem; resize: vertical; }
.form-input:focus, .form-select:focus {
  border-color: var(--emeraude); box-shadow: 0 0 0 4px rgba(0,135,90,.12);
}
.form-select { padding: .9rem; }

.floating-label {
  position: absolute; left: 1rem; top: .95rem; color: #94a3b8;
  pointer-events: none; transition: all 180ms ease; font-size: 1rem; background: transparent;
}
.form-input:focus ~ .floating-label,
.form-input:not(:placeholder-shown) ~ .floating-label {
  top: .3rem; font-size: .72rem; color: var(--emeraude); font-weight: 600;
}

/* États de validation temps réel */
.field-valide .form-input { border-color: var(--succes); }
.field-invalide .form-input { border-color: var(--erreur); }
.field-icone { position: absolute; right: .9rem; top: 1rem; width: 20px; height: 20px; opacity: 0; transition: opacity var(--transition); }

/* Bouton afficher / masquer le mot de passe */
.pw-toggle { position: absolute; right: .55rem; top: .8rem; color: #94a3b8; background: none; border: none; cursor: pointer; padding: 5px; line-height: 0; z-index: 3; border-radius: 8px; }
.pw-toggle:hover { color: var(--emeraude); background: rgba(0,135,90,.08); }
.pw-toggle svg { width: 20px; height: 20px; }
.field-valide .field-icone.ok, .field-invalide .field-icone.ko { opacity: 1; }

.form-checkbox { width: 1.15rem; height: 1.15rem; accent-color: var(--emeraude); border-radius: 6px; }
.form-checkgroup { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: .5rem; }
.form-checkgroup label { display: flex; align-items: center; gap: .4rem; font-size: .9rem; }
.form-errors { color: var(--erreur); font-size: .82rem; margin-top: .3rem; }

/* ── Badges ───────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .7rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge-success { background: #def7ec; color: #03543f; }
.badge-warning { background: #fdf6b2; color: #723b13; }
.badge-error { background: #fde8e8; color: #9b1c1c; }
.badge-neutral { background: #edf2f7; color: #2d3748; }
.badge-cemac { background: var(--bleu); color: #fff; }

/* ── Avatars / étoiles ────────────────────────────────────────────── */
.avatar { border-radius: 50%; object-fit: cover; background: var(--emeraude-light); display: inline-flex; align-items: center; justify-content: center; color: var(--emeraude); font-weight: 700; }
.stars { display: inline-flex; gap: 2px; color: var(--ocre); }

/* ── Navigation web ───────────────────────────────────────────────── */
.web-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.85); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(26,54,93,.07); }
.nav-link { position: relative; color: var(--texte-doux); font-weight: 500; padding: .4rem 0; transition: color var(--transition); white-space: nowrap; }
.nav-link:hover { color: var(--emeraude); }
.nav-link::after { content: ''; position: absolute; left: 0; bottom: -2px; height: 2px; width: 0; background: var(--emeraude); transition: width var(--transition); }
.nav-link:hover::after { width: 100%; }

/* ── Bottom nav mobile (app Flutter) — premium ───────────────────── */
.mobile-bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  display: flex; justify-content: space-around; align-items: center;
  background: rgba(255,255,255,.97); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(26,54,93,.06);
  padding: .6rem .25rem calc(.6rem + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(0,0,0,.06);
}
.mobile-bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: .6rem; font-weight: 500; letter-spacing: .3px;
  color: #94a3b8; flex: 1; padding: .35rem 0;
  transition: color .2s, transform .15s;
}
.mobile-bottom-nav a.actif { color: var(--emeraude); font-weight: 700; }
.mobile-bottom-nav a.actif i { filter: drop-shadow(0 2px 4px rgba(0,135,90,.3)); }
.mobile-bottom-nav a:active { transform: scale(.88); }
.has-bottom-nav { padding-bottom: 5.5rem; }

/* ── Hero parallax ────────────────────────────────────────────────── */
.hero-bg { background:
  radial-gradient(circle at 15% 20%, rgba(0,135,90,.12), transparent 40%),
  radial-gradient(circle at 85% 30%, rgba(212,162,78,.14), transparent 45%),
  var(--fond-clair); }

/* Motif décoratif subtil (texture panafricaine) */
.motif-cap {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='46' height='46'%3E%3Ccircle cx='23' cy='23' r='1.6' fill='%2300875A' fill-opacity='0.10'/%3E%3Ccircle cx='0' cy='0' r='1.6' fill='%23D4A24E' fill-opacity='0.10'/%3E%3Ccircle cx='46' cy='46' r='1.6' fill='%23D4A24E' fill-opacity='0.10'/%3E%3C/svg%3E");
}

/* Taches de couleur floues (décor de fond) */
.blob { position: absolute; border-radius: 50%; filter: blur(64px); opacity: .45; pointer-events: none; z-index: 0; }
.blob-emeraude { background: rgba(0,135,90,.35); }
.blob-ocre { background: rgba(212,162,78,.35); }

/* Liens dans les messages de la messagerie */
.msg-body a { text-decoration: underline; font-weight: 600; word-break: break-all; }
.bg-emeraude .msg-body a { color: #fff; }
.msg-body a:hover { opacity: .8; }

/* Scrollbar discrète */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Mode sombre (optionnel) */
body.dark { --fond-clair: #0f1620; --texte: #e2e8f0; --texte-doux: #94a3b8; background: #0f1620; color: #e2e8f0; }
body.dark .card { background: #1a2230; border-color: rgba(255,255,255,.05); }
body.dark .web-header { background: rgba(15,22,32,.85); }
body.dark .form-input, body.dark .form-select { background: #1a2230; border-color: #2d3748; color: #e2e8f0; }
body.dark .mobile-bottom-nav { background: #1a2230; }
