h1 { font-family: Arial, Helvetica, sans-serif; }

/* =========================================================
   ECRAN MOBILE BLOQUANT
   Wikot est uniquement disponible sur ordinateur (>= 1024px).
   En dessous : un overlay plein ecran qui masque TOUT le reste.
   ========================================================= */

/* Par defaut (desktop) : invisible */
#mobile-only-screen {
  display: none;
}

/* Mobile / tablette portrait (< 1024px) : visible et bloquant */
@media (max-width: 1023px) {
  #mobile-only-screen {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 2147483647;             /* z-index max possible -> recouvre tout */
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(160deg, #0A1628 0%, #142235 60%, #0A1628 100%);
    color: #fff;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    overflow-y: auto;
  }

  /* On verrouille le scroll du document derriere pour eviter tout glitch */
  body:has(#mobile-only-screen) {
    overflow: hidden;
  }

  .mobile-only-card {
    width: 100%;
    max-width: 420px;
    text-align: center;
    padding: 40px 28px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(201, 169, 97, 0.25);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .mobile-only-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    border-radius: 20px;
    background: #C9A961;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0A1628;
    font-size: 30px;
    box-shadow: 0 8px 24px rgba(201, 169, 97, 0.35);
  }

  .mobile-only-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 36px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: 0;
    color: #fff;
  }

  .mobile-only-divider {
    width: 48px;
    height: 2px;
    background: #C9A961;
    margin: 20px auto 24px;
    border-radius: 2px;
  }

  .mobile-only-message {
    font-size: 17px;
    font-weight: 500;
    line-height: 1.45;
    color: #fff;
    margin: 0 0 14px;
  }

  .mobile-only-submessage {
    font-size: 14px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.65);
    margin: 0;
  }
}


/* =========================================================
   APP SHELL — Layout principal (sidebar + main)
   ========================================================= */

/* ============== MOBILE FIRST (< 1024px) ==============
   Stratégie : pas de flex du tout en mobile. Le conteneur racine est
   un simple bloc pleine largeur. La sidebar est un overlay fixed pur.
   Le main occupe naturellement 100% du viewport.
   Aucun moteur flex à exploiter -> aucun moyen de pousser le contenu. */

.app-shell-row {
  display: block;                /* PAS de flex en mobile */
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow-x: hidden;            /* aucun debordement horizontal possible */
  overflow-y: hidden;
  position: relative;
}

.app-main {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  min-width: 0;
  min-height: 0;
}

/* Sidebar mobile = overlay fixe hors-écran par défaut */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  height: 100dvh;
  width: 288px;
  max-width: 85vw;               /* sur tres petit ecran (<340px) on plafonne */
  z-index: 40;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  will-change: transform;
  overflow-y: auto;
}

.app-sidebar.is-open {
  transform: translateX(0);
}

/* Overlay sombre sous la sidebar mobile */
.app-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.app-sidebar-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Neutralise le mx-auto + max-w-7xl en mobile :
   le conteneur de contenu doit etre colle a gauche, 100% de largeur. */
@media (max-width: 1023px) {
  .app-main > #main-content-container {
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }
}

/* ============== DESKTOP (≥ 1024px) ==============
   La : on REPASSE en flex horizontal classique. La sidebar reprend
   sa place dans le flux a 256px, le main prend tout le reste. */

@media (min-width: 1024px) {
  .app-shell-row {
    display: flex;
    flex-direction: row;
    width: 100%;
    overflow: hidden;
  }
  .app-sidebar {
    position: static;
    transform: none !important;
    width: 256px;
    max-width: 256px;
    height: 100%;
    flex-shrink: 0;
    z-index: auto;
    transition: none;
  }
  .app-main {
    flex: 1 1 0%;
    height: 100%;
  }
  .app-sidebar-overlay {
    display: none;
  }
}

/* =========================================================
   MOBILE — Compensation de la bottom navigation
   ========================================================= */

/* Hauteur de la bottom-nav mobile (constante CSS pour réutilisation) */
:root {
  --mobile-bottomnav-h: 64px;
}

/* Sous lg (mobile + tablette portrait) : on réserve l'espace pour le menu du bas
   sur le main scrollable + safe-area iOS pour les iPhones à encoche. */
@media (max-width: 1023px) {
  /* Le conteneur principal scrollable doit pouvoir afficher son dernier élément
     SANS être masqué par la bottom-nav fixe (h ~ 64px). */
  .mobile-content-padding {
    padding-bottom: calc(var(--mobile-bottomnav-h) + env(safe-area-inset-bottom, 0px) + 1rem) !important;
  }

  /* La bottom-nav elle-même respecte la safe-area iOS (notch / home indicator) */
  .mobile-bottomnav {
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(var(--mobile-bottomnav-h) + env(safe-area-inset-bottom, 0px));
  }

  /* Toute zone qui se calcule en 100vh doit retirer la hauteur du menu mobile.
     Les vues Wikot utilisent calc(100vh - 7rem) → on ajoute la nav en mobile. */
  .mobile-fullh {
    height: calc(100vh - 7rem - var(--mobile-bottomnav-h)) !important;
    max-height: calc(100vh - 7rem - var(--mobile-bottomnav-h)) !important;
  }
}

/* Sur desktop, la classe mobile-fullh garde le comportement d'origine */
@media (min-width: 1024px) {
  .mobile-fullh {
    height: calc(100vh - 7rem);
    max-height: calc(100vh - 7rem);
  }
}

/* =========================================================
   BACK WIKOT — Wrapper du chat (responsive)
   ========================================================= */

/* Mobile : chat compact en haut, laisse voir les 4 boutons en dessous */
@media (max-width: 1023px) {
  .back-wikot-chat-wrapper {
    height: 60vh;
    min-height: 360px;
    max-height: 520px;
  }
}

/* Desktop : sticky à droite, occupe quasi tout le viewport */
@media (min-width: 1024px) {
  .back-wikot-chat-wrapper {
    position: sticky;
    top: 1rem;
    height: calc(100vh - 2rem);
  }
}
