/*
  ISWA - Feuille de style premium.
  Palette : cobalt profond, emeraude, safran, sable creme.
  Complements Tailwind (CDN) pour animations et micro-interactions
  qui ne sont pas nativement couvertes par les classes utilitaires.
*/

@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&display=swap");

:root {
  --iswa-cobalt: #0b2545;
  --iswa-cobalt-light: #163b6d;
  --iswa-emerald: #157a5b;
  --iswa-saffron: #c97b2e;
  --iswa-sand: #f4efe6;
  --iswa-sand-dark: #e9e0d1;
}

@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.32s;
  animation-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1);
}

::view-transition-old(root) {
  animation-name: iswa-vt-out;
}

::view-transition-new(root) {
  animation-name: iswa-vt-in;
}

@keyframes iswa-vt-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(-24px); }
}

@keyframes iswa-vt-in {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  background-color: var(--iswa-sand);
}

h1, h2, h3, .font-display {
  font-family: "Space Grotesk", "Inter", sans-serif;
  letter-spacing: -0.02em;
}

/* --- Ombres "physiques" a deux niveaux ------------------------------ */
.shadow-elevate {
  box-shadow:
    0 1px 2px rgba(11, 37, 69, 0.06),
    0 18px 40px -12px rgba(11, 37, 69, 0.18);
}

.shadow-elevate-lg {
  box-shadow:
    0 2px 4px rgba(11, 37, 69, 0.08),
    0 28px 60px -16px rgba(11, 37, 69, 0.24);
}

.dark-shadow-elevate {
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.3),
    0 18px 40px -12px rgba(0, 0, 0, 0.5);
}

/* --- Effet tiroir (sliding drawer) pour l'onboarding ----------------- */
.wizard-track {
  display: flex;
  width: 100%;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.wizard-step {
  flex: 0 0 100%;
  width: 100%;
}

/* --- Tremblement (shake) pour code OTP invalide ---------------------- */
@keyframes iswa-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

.animate-shake {
  animation: iswa-shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* --- Skeleton loader shimmer ------------------------------------------ */
@keyframes iswa-shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg, #e9e0d1 0%, #f6f1e8 50%, #e9e0d1 100%);
  background-size: 800px 100%;
  animation: iswa-shimmer 1.4s ease-in-out infinite;
}

/* --- Spinner personnalise --------------------------------------------- */
.iswa-spinner {
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  animation: iswa-spin 0.7s linear infinite;
}

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

/* --- Entree/soties en fondu pour les ecrans de transition ------------- */
@keyframes iswa-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: iswa-fade-in 0.45s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* --- Apparition en cascade des badges/boutons apres le typing ---------- */
.reveal-item {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Effet "liquide" au clic sur les cartes de destination ------------- */
.country-card {
  position: relative;
  overflow: hidden;
  background-color: #fff;
  background-image: linear-gradient(var(--iswa-emerald) 0 0);
  background-repeat: no-repeat;
  background-position: calc(200% - var(--p, 0%)) 100%;
  background-size: 200% var(--p, 0.2em);
  transition: color 0.05s var(--t, 0s),
    background-position 0.05s calc(0.05s - var(--t, 0s));
}

.country-card.is-selected {
  --p: 100%;
  --t: 0.05s;
  color: #fff;
}

/* --- Meme effet, en plus rapide, pour la liste de recherche du pays d'origine --- */
.origin-card {
  position: relative;
  overflow: hidden;
  background-color: #fff;
  background-image: linear-gradient(var(--iswa-emerald) 0 0);
  background-repeat: no-repeat;
  background-position: calc(200% - var(--p, 0%)) 100%;
  background-size: 200% var(--p, 0.2em);
  transition: color 0.05s var(--t, 0s),
    background-position 0.05s calc(0.05s - var(--t, 0s));
}

.origin-card.is-selected {
  --p: 100%;
  --t: 0.05s;
  color: #fff;
}

/* --- Meme effet pour le profil etudiant et le logement (etapes 3 et 4) --- */
.status-card,
.housing-card {
  position: relative;
  overflow: hidden;
  background-color: #fff;
  background-image: linear-gradient(var(--iswa-emerald) 0 0);
  background-repeat: no-repeat;
  background-position: calc(200% - var(--p, 0%)) 100%;
  background-size: 200% var(--p, 0.2em);
  transition: color 0.05s var(--t, 0s),
    background-position 0.05s calc(0.05s - var(--t, 0s));
}

.status-card.is-selected,
.housing-card.is-selected {
  --p: 100%;
  --t: 0.05s;
  color: #fff;
}

.origin-card.is-selected .fi {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
}

/* --- Ecran de generation "carte de route" : rideau + splash sur fond blanc --- */
#transitionView:not(.hidden) {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
}

.curtain-panel {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 50%;
  z-index: 51;
  background: linear-gradient(160deg, var(--iswa-cobalt) 0%, var(--iswa-cobalt-light) 100%);
}

.curtain-left {
  left: 0;
  transform-origin: left center;
  animation: iswa-curtain-open-left 0.7s cubic-bezier(0.65, 0, 0.35, 1) 0s forwards,
             iswa-curtain-close-left 0.6s cubic-bezier(0.65, 0, 0.35, 1) 4.4s forwards;
}

.curtain-right {
  right: 0;
  transform-origin: right center;
  animation: iswa-curtain-open-right 0.7s cubic-bezier(0.65, 0, 0.35, 1) 0s forwards,
             iswa-curtain-close-right 0.6s cubic-bezier(0.65, 0, 0.35, 1) 4.4s forwards;
}

@keyframes iswa-curtain-open-left {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

@keyframes iswa-curtain-open-right {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}

@keyframes iswa-curtain-close-left {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes iswa-curtain-close-right {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.transition-content {
  position: relative;
  z-index: 3;
  opacity: 0;
  animation: iswa-content-in 0.6s ease-out 0.5s forwards;
}

@keyframes iswa-content-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.splash-mark {
  animation: iswa-splash-pulse 1.6s ease-in-out infinite;
}

@keyframes iswa-splash-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.06); opacity: 0.85; }
}

.route-progress-fill {
  width: 0%;
  animation: iswa-route-progress 5s linear 0.5s forwards;
}

@keyframes iswa-route-progress {
  from { width: 0%; }
  to { width: 100%; }
}

/* --- Entree du demi-cercle de fond (coin inferieur droit, onboarding) --- */
@keyframes iswa-circle-intro {
  from { transform: translate3d(22%, 22%, 0) scale(0.85); }
  to { transform: translate3d(0, 0, 0) scale(1); }
}

.bg-circle-intro {
  animation: iswa-circle-intro 1.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* --- Effet machine a ecrire (multi-lignes) pour le hero ---------------- */
/* Le texte est revele caractere par caractere en JS (voir index.php) ;
   ceci ne gere que le curseur clignotant colle au dernier caractere affiche. */
@keyframes iswa-caret {
  50%, 100% { opacity: 0; }
}

/* --- Squelette de chargement (dashboard) : shimmer clair coherent avec la charte --- */
@keyframes iswa-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.iswa-shimmer {
  background-image: linear-gradient(100deg, rgba(11,37,69,0.06) 30%, rgba(11,37,69,0.14) 45%, rgba(11,37,69,0.06) 60%);
  background-size: 220% 100%;
  animation: iswa-shimmer 1.6s ease-in-out infinite;
}

@keyframes iswa-grow-progress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.animate-grow-progress {
  transform-origin: left;
  animation: iswa-grow-progress 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.iswa-progress-ring {
  transition: stroke-dashoffset 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Fondu + translation pour l'hydratation du contenu reel du dashboard --- */
@keyframes iswa-fade-in-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in-up {
  animation: iswa-fade-in-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.typing-caret::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: currentColor;
  animation: iswa-caret 0.8s step-end infinite;
}

/* --- Scroll interne sans barre visible (liste des pays d'origine, etc.) --- */
.no-scrollbar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* --- Fondu en bas de la liste des pays d'origine : evite la coupure nette --- */
#originList {
  mask-image: linear-gradient(to bottom, black 0%, black 85%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, black 85%, transparent 100%);
  padding-bottom: 1.5rem;
}

/* --- Champs OTP -------------------------------------------------------- */
.otp-box {
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.15s ease;
}

.otp-box:focus {
  transform: translateY(-2px);
}

/* --- Barre de progression douce ---------------------------------------- */
.progress-fill {
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Scrollbar discrete -------------------------------------------------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(11, 37, 69, 0.18);
  border-radius: 9999px;
}

::-webkit-scrollbar-track {
  background: transparent;
}
