}

/* =========================
   ARLinus - Clean UI (v999)
   Compatible avec:
   - chat_general.html
   - chat_primaire.html
   - chat_college_lycee.html
   - chat_universite.html
   - study.html
   ========================= */

/* ---- Variables ---- */
:root{
  --bg1:#eaf6ff;
  --bg2:#ffffff;
  --text:#0f172a;
  --muted:#64748b;

  --card: rgba(255,255,255,.75);
  --stroke: rgba(0,0,0,.08);

  --shadow: 0 18px 45px rgba(15,23,42,.10);
  --shadow2: 0 10px 22px rgba(15,23,42,.10);

  --blue:#3aa0ff;
  --blue2:#2f95ff;

  --radius: 22px;
}

/* ---- Reset / base ---- */
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
}
img{ max-width:100%; height:auto; display:block; }

.hidden{ display:none !important; }

/* ✅ IMPORTANT: on neutralise l'ancien layout si tu l'avais encore */
.input-bar,
.input-bar.ios,
.chat-box,
.chat-box.ios{
  /* si un ancien composant existe, il ne doit plus apparaître */
}

/* ---- Background ---- */
body.bg{
  background:
    radial-gradient(900px 450px at 50% 12%, rgba(58,160,255,.28), transparent 55%),
    radial-gradient(900px 500px at 20% 30%, rgba(99,198,173,.14), transparent 55%),
    linear-gradient(var(--bg1), var(--bg2));
  -webkit-font-smoothing: antialiased;
}




body{
  margin:0;
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

.hero{
  flex:1;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  text-align:center;
}

.home-btn{
  transition: all 0.2s ease;
}

.home-btn:active{
  transform: scale(0.97);
}

/* =========================
   Header iOS
   ========================= */
.app-header.ios{
  position: sticky;
  top: 10px;
  z-index: 50;

  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;

  margin: 10px 12px 0;
  padding: 12px 12px;

  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.back.ios{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.75);
  box-shadow: 0 6px 14px rgba(0,0,0,.08);
  font-size: 20px;
  cursor:pointer;
}
.back.ios:active{ transform: scale(.96); }

.header-center{
  display:flex;
  align-items:center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.header-logo{
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.header-title{
  font-weight: 800;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-pill{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.75);
  color: rgba(0,0,0,.55);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap: 6px;
}
.pill.soft{
  opacity:.85;
}

/* boutons header (☰ / 🔎) */
.icon{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.75);
  box-shadow: 0 6px 14px rgba(0,0,0,.08);
  cursor:pointer;
  font-size: 18px;
}
.icon:active{ transform: scale(.96); }

/* =========================
   Chat zone
   ========================= */

/* wrapper principal */
.chat-wrap{
  padding: 12px;
  padding-bottom: 92px; /* place pour l'inputbar fixe */
}

/* le chat scrollable */
#chat.chat{
  height: calc(100vh - 170px); /* header + input */
  overflow-y: auto;

  border-radius: var(--radius);
  background: rgba(255,255,255,.45);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);

  padding: 16px;
}

/* messages (tu utilises .msg-user / .msg-ai dans le JS) */
.msg-user{
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(58,160,255,.18);
  max-width: 82%;
  margin-left: auto;
  font-weight: 700;
}

.msg-ai{
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(0,0,0,.06);
  max-width: 86%;
  box-shadow: 0 8px 22px rgba(0,0,0,.06);
}

/* typing */
.typing{
  margin-top: 10px;
  opacity: .75;
  font-size: 13px;
  font-weight: 700;
  padding-left: 4px;
}

/* =========================
   Input bar (unique)
   ========================= */
.inputbar{
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 60;

  display:flex;
  align-items:center;
  gap: 10px;

  padding: 10px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.80);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* champ texte */
.inputbar input{
  flex: 1;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.90);
  padding: 14px 14px;
  border-radius: 18px;
  outline: none;
  font-size: 15px;
}

/* icones photo */
.iconbtn{
  width: 44px;
  height: 44px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.90);
  cursor:pointer;
  font-size: 18px;
}
.iconbtn:active{ transform: scale(.96); }

/* bouton send */
.send{
  width: 48px;
  height: 48px;
  border-radius: 18px;
  border: none;
  background: linear-gradient(180deg, rgba(58,160,255,.98), rgba(58,160,255,.86));
  color: white;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(58,160,255,.28);
}
.send:active{ transform: scale(.96); }
.send:disabled{ opacity:.55; }

/* =========================
   Drawer (Historique / Notes)
   -> ton HTML n’a pas de wrapper interne,
      donc on fait un vrai panneau latéral.
   ========================= */
.drawer{
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;

  width: min(92vw, 420px);
  height: 100vh;

  z-index: 9999;
  overflow: auto;

  padding: 14px;
  background: rgba(255,255,255,.92);
  border-left: 1px solid rgba(0,0,0,.08);
  box-shadow: -20px 0 60px rgba(0,0,0,.18);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.drawer.hidden{ display:none !important; }

.drawer-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 8px 4px 12px;
}

.drawer-head h3{
  margin:0;
  font-size: 18px;
  font-weight: 900;
}

.drawer-head button{
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.85);
  cursor:pointer;
}

.drawer-actions{
  display:flex;
  gap: 10px;
  margin-bottom: 12px;
}

.btn{
  flex:1;
  padding: 14px 12px;
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(58,160,255,.12);
  box-shadow: 0 10px 22px rgba(0,0,0,.06);
  cursor:pointer;
  font-weight: 900;
}
.btn:active{ transform: scale(.99); }

.drawer-toolbar{
  display:flex;
  gap: 10px;
  align-items:center;
  margin: 10px 0 12px;
}

.drawer-toolbar input{
  flex: 1;
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.92);
  outline:none;
}

.drawer-toolbar select{
  padding: 12px 10px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.92);
  outline:none;
}

/* Liste des conversations */
.conv-list{
  display:flex;
  flex-direction:column;
  gap: 10px;
}

/* item conversation */
.conv-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  transition: all .15s ease;

  padding:14px 16px;
  border-radius:20px;
  background:#fff;
  border:1px solid #e7edf5;
  box-shadow:0 4px 14px rgba(0,0,0,.05);
  cursor:pointer;
}
.conv-item:hover{
  background:#f5f9ff;
}
.conv-item.active{
  border:2px solid #b9d8ff;
  box-shadow:0 6px 18px rgba(47,128,237,.12);
}

.conv-left{ flex:1; min-width:0; }
.conv-title-text{
  font-weight:600;
  font-size:16px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;

  border:none;
  background:none;
  padding:0;
}

.conv-date{
  margin-top:4px;
  font-size:12px;
  color:#7a8a9a;
}
/* kebab + menu */
.conv-right{ position: relative; }
.kebab{
  width:42px;
  height:42px;
  border-radius:12px;
  border:1px solid #d7dee8;
  background:#fff;
  cursor:pointer;
  font-size:18px;
}
.conv-menu{
  position: absolute;
  right: 0;
  top: 44px;
  min-width: 180px;

  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 12px 30px rgba(0,0,0,.15);
  padding: 6px;

  display:flex;
  flex-direction:column;
  gap: 4px;
  z-index: 10000;
}
.conv-menu.hidden{ display:none !important; }
.home-btn{
  display:flex;
  justify-content:space-between;
  width:100%;
  padding:16px 16px;
  border-radius:20px;

  background:linear-gradient(135deg,#6ecbff,#4fa9ff);
  color:#fff;

  box-shadow:0 8px 20px rgba(79,169,255,.35);
}

.home-btn span,
.home-btn small{
  color:#fff !important;
}

.home-btn small{
  opacity:.92;
}

.conv-menu button{
  all: unset;
  padding: 12px 12px;
  border-radius: 10px;
  cursor:pointer;
  font-size: 15px;
  font-weight: 800;
}
.conv-menu button:hover{ background: rgba(0,0,0,.06); }
.conv-menu .danger{ color:#e53935; }

/* Notes */
.notes{
  width:100%;
  min-height: 55vh;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.92);
  outline:none;
  resize: vertical;
  font-size: 15px;
  margin-bottom: 12px;
}

/* =========================
   Modal Find
   ========================= */
.modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.28);
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 16px;
}
.modal.hidden{ display:none !important; }

.modal-card{
  width: min(520px, 96vw);
  background: rgba(255,255,255,.95);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}

.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.modal-head button{
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.90);
  cursor:pointer;
}

.modal-card input{
  width: 100%;
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.92);
  outline:none;
  margin-bottom: 10px;
}
.modal-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.modal-row button{
  width: 46px;
  height: 46px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.90);
  cursor:pointer;
  font-size: 18px;
}
#findCount{
  font-weight: 900;
  opacity:.75;
}

/* highlight find */
mark.hl{
  background: #ffe58f;
  padding: 0 2px;
  border-radius: 4px;
}

/* =========================
   Study.html
   ========================= */
.page{
  padding: 20px 16px 30px;
}
.page h2{
  margin: 14px 12px;
  font-size: 22px;
  font-weight: 900;
}
.grid{
  display:flex;
  flex-direction:column;
  gap: 12px;
  padding: 0 12px;
}
.btn.primary{
  background: rgba(58,160,255,.12);
}

/* Mobile */
@media (max-width: 520px){
  #chat.chat{ height: calc(100vh - 176px); }
  .drawer{ width: 100vw; }
}




/* ===== FIX ARLinus: inputbar (nouveau HTML) ===== */
.inputbar{
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 10000;
  display:flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px;
  border-radius: 22px;
  background: rgba(255,255,255,.85);
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 10px 26px rgba(0,0,0,.12);
}



.inputbar textarea{
  flex: 1;
  min-height: 40px;
  max-height: 120px;

  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.90);

  padding: 12px 12px;
  border-radius: 18px;

  outline: none;
  font-size: 15px;

  resize: none;
  overflow-y: auto;
  line-height: 20px;
}


.iconbtn{
  width: 46px;
  height: 46px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.95);
  cursor: pointer;
}

.send{
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 46px;
  border-radius: 16px;
  border: none;
  background: rgba(58,160,255,.95);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.send:disabled{ opacity: .6; }

/* évite que le chat soit caché par la barre du bas */
.chat-wrap{
  padding-bottom: 100px !important;
}





/* =========================
   HOME (index.html) only
   Active quand <body class="bg home">
   ========================= */
body.home{
  padding: 0;              /* évite le décalage */
}

body.home .center{
  min-height: 100vh;
  display: flex;
  align-items: center;      /* centre vertical */
  justify-content: center;  /* centre horizontal */
  padding: 24px 16px;
}

body.home .hero{
  width: min(520px, 92vw);
  text-align: center;
}

body.home .brand{
  display: flex;
  flex-direction: column;
  align-items: center;
}

body.home .logo-big{
  width: 120px;
  height: auto;
  margin: 0 auto 16px auto;
}

body.home h1{
  margin: 0;
  font-size: 44px;
  line-height: 1.05;
}

body.home .subtitle{
  margin: 10px 0 18px;
}

body.home .actions{
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;          /* mobile */
  margin-top: 10px;
}

body.home .actions .btn{
  width: 220px;             /* boutons alignés et centrés */
  max-width: 45vw;
}

@media (max-width: 420px){
  body.home .actions{
    flex-direction: column;
    align-items: stretch;
  }
  body.home .actions .btn{
    width: 100%;
    max-width: 100%;
  }
}




.coachbar{
  display:flex;
  gap:8px;
  padding:6px 0;
  align-items:center;
}
.coachbar .select{
  flex: 1 1 auto;
  padding:10px;
  border-radius:10px;
}
.coachbar .chapter{
  flex: 1.2 1 auto;
  padding:10px;
  border-radius:10px;
}






/* Le message doit occuper la largeur du téléphone */
.bubble {
  width: 100%;
  max-width: 100%;
}

/* Si ton chat a un conteneur interne centré avec une largeur fixe */



.chat-container,
.messages,
.bubble,
.ai-content {
  width: 100% !important;
  max-width: 100% !important;
}


/* FIX messages coupés - tous les chats */
.msg-ai,
.msg-user,
.message,
.bubble,
.ai-content {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
}

#chat.chat {
  overflow-y: auto !important;
  height: calc(100vh - 170px) !important;
  padding-bottom: 120px !important;
}


/* 🔥 FIX FINAL messages coupés */
.msg-ai,
.msg-user,
.bubble {
  display: block !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

/* contenu IA */
.ai-content {
  display: block !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

/* empêche coupure texte */
.msg-ai,
.ai-content {
  white-space: pre-wrap !important;
  word-break: break-word !important;
}

/* =========================
   ARLinus — Mode cours plein écran (SVG)
   Objectif: rendu large, lisible, comme un document
   ========================= */

/* 1) Le layout ne doit pas être "centré" avec une largeur fixe */
html, body {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* évite le scroll horizontal global */
}

/* 2) Tous les conteneurs principaux prennent 100% */
.chat-container,
.messages,
.message,
.bubble,
.ai-content {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}



/* uniquement pour mode cours */
body.mode-cours .bubble {
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* 4) Le contenu doit être un "viewport" scrollable si besoin */
.ai-content {
  padding: 0 !important;
  margin: 0 !important;
  overflow-x: auto;             /* si un SVG est vraiment trop large */
  -webkit-overflow-scrolling: touch;
}

/* 5) SVG: prend toute la largeur disponible */
.ai-content svg {
  display: block;
  width: 100% !important;       /* plein écran */
  max-width: 100% !important;
  height: auto !important;
}

/* 6) IMPORTANT: si ton SVG a une largeur fixe interne,
      cette règle aide sur certains navigateurs */
.ai-content svg:not([viewBox]) {
  width: 100% !important;
  height: auto !important;
}

/* 7) Si tu utilises <img src="...svg"> au lieu d’injecter le SVG */
.ai-content img {
  display: block;
  width: 100% !important;
  height: auto !important;
}

/* 8) Pour les longs textes: jamais coupés */
.bubble,
.ai-content {
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* 9) Mobile: supprime tout padding “global” qui réduit la page */
@media (max-width: 768px) {
  .chat-container,
  .messages {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}



.message, .bubble, .chat-message {
  white-space: pre-wrap !important;
  word-break: break-word;
  overflow: visible !important;
  max-height: none !important;
}

.exam-content {
  white-space: normal;
  line-height: 1.55;
  font-size: 17px;
  color: #111;
}

.exam-content h1,
.exam-content h2,
.exam-content h3 {
  margin: 16px 0 10px;
  line-height: 1.3;
}

.exam-content h1 { font-size: 28px; }
.exam-content h2 { font-size: 24px; }
.exam-content h3 { font-size: 20px; }

.exam-content p {
  margin: 8px 0;
}

.exam-content ul {
  margin: 8px 0 12px 20px;
  padding: 0;
}

.exam-content li {
  margin: 6px 0;
}

.exam-content hr {
  border: 0;
  border-top: 1px solid #ddd;
  margin: 16px 0;
}

.exam-content strong {
  font-weight: 700;
}

.exam-content svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 12px auto;
}

.exam-content .block {
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  padding: 14px;
  margin-top: 10px;
}




.block svg{
  max-width:100%;
  height:auto;
  margin:20px auto;
  display:block;
  border:1px solid #ddd;
  background:#fff;
}




/* bouton conversation (corrige le cadre gris) */
.conv-open{
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

/* titre conversation */
.conv-title{
  font-weight: 700;
  font-size: 16px;
  color: #111;
}

/* date conversation */
.conv-sub{
  font-size: 12px;
  color: #7a8a9a;
}


/* conversation épinglée */
.conv-item.pinned{
  border:2px solid #5bbcff;
  background:#f2f8ff;
}

/* icône épingle */
.conv-pin{
  font-size:14px;
  margin-right:6px;
}


.ai-content strong{
  font-weight:700;
}

.ai-content{
  line-height:1.5;
  word-break:break-word;
}

.ai-content br + br{
  display:block;
  content:"";
  margin-top:6px;
}






/* images*/


.msg-user img,
.msg-ai img{
max-width:220px;
max-height:260px;
border-radius:10px;
margin-top:6px;
display:block;
}




.chat-messages,
#messages,
.messages {
  padding-bottom: 140px !important;
}

.typing,
#typing {
  margin-bottom: 90px !important;
}


.coach-controls,
#coachControls,
.filters,
.select-bar {
  position: sticky;
  top: 70px;
  z-index: 50;
  background: #fff;
  padding: 8px 12px;
}




#imagePreviewBox {
  position: sticky;
  bottom: 95px;
  z-index: 80;
  background: #e3f2fd;
  border-radius: 18px;
  padding: 8px;
  max-height: 220px;
  overflow: auto;
}

#imagePreview {
  max-width: 180px;
  max-height: 180px;
  object-fit: contain;
}



.chat-input,
.input-bar,
#composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: env(safe-area-inset-bottom, 0px);
  z-index: 100;
  background: white;
}

#text {
  display: block !important;
  width: 100% !important;

  min-height: 42px !important;
  height: auto !important;
  max-height: 120px !important;

  resize: none !important;
  overflow-y: auto !important;
  white-space: pre-wrap !important;
  line-height: 22px !important;
  font: inherit !important;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  padding: 10px 12px !important;
}

.inputbar textarea {
  flex: 1 !important;
}


.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  margin: 0 4px;
}

.frac .top {
  border-bottom: 2px solid black;
  padding: 0 4px;
}

.frac .bottom {
  padding: 0 4px;
}

#chat.chat,
#chat.chat * {
  max-height: none !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
}

#chat.chat {
  overflow-y: auto !important;
}


.msg-ai,
.msg-user,
.ai-content {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  white-space: pre-wrap !important;
  line-height: 1.6 !important;
}


#chat .msg-ai,
#chat .msg-user,
#chat .bubble,
#chat .ai-content {
  display: block;
  height: auto;
  max-height: none;
  overflow: visible;
  white-space: pre-wrap;
  word-break: break-word;
}


button.login-btn {
  background-color: #4FC3F7; /* bleu ciel */
  color: white;
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-weight: bold;
}

button.login-btn:disabled {
  background-color: #ccc; /* gris quand désactivé */
}

/* ===== FIX INPUT CHAT ===== */

.inputbar{
  display:flex;
  align-items:flex-end;
  gap:10px;

  padding:10px 12px calc(10px + env(safe-area-inset-bottom));

  background:#fff;

  position:sticky;
  bottom:0;
  z-index:100;
}

.inputbar textarea{
  flex:1;
  min-width:0;

  min-height:44px !important;
  max-height:140px !important;
  height:auto !important;

  border:none;
  outline:none;

  resize:none;
  overflow-y:auto;

  font-size:16px;
  line-height:22px;

  padding:11px 14px !important;

  border-radius:18px;

  background:#f3f7fb !important;
}

.iconbtn,
.send{
  flex-shrink:0;
}


/* ===== MOBILE INPUT FIX ===== */




#text{
  flex:1 !important;
  min-width:0 !important;
}

.iconbtn{
  width:44px !important;
  height:44px !important;

  min-width:44px !important;
  padding:0 !important;

  flex-shrink:0 !important;
}

.send{
  width:52px !important;
  height:52px !important;

  min-width:52px !important;

  flex-shrink:0 !important;
}


/* ===== FIX HAUTEUR CHAMP SAISIE ===== */

.inputbar{
  align-items:flex-end !important;
  min-height:70px !important;
  height:auto !important;
  padding-top:10px !important;
  padding-bottom:10px !important;
}

#text{
  height:auto !important;
  min-height:48px !important;
  max-height:130px !important;
  overflow-y:auto !important;
}

.inputbar:has(#text:focus){
  height:auto !important;
}


#plusBtn{
  width:44px;
  height:44px;
  border:none;
  border-radius:50%;
  background:#f1f5f9;
  font-size:28px;
}

#uploadMenu{
  position:absolute;
  bottom:70px;
  left:10px;
  background:white;
  border-radius:16px;
  padding:10px;
  box-shadow:0 10px 25px rgba(0,0,0,.12);
}



/* ===== FINAL INPUTBAR FIX ===== */

.inputbar{
  height:auto !important;
  min-height:72px !important;
  max-height:none !important;
  overflow:visible !important;
  align-items:flex-end !important;
}

#text{
  height:auto !important;
  min-height:48px !important;
  max-height:140px !important;
  overflow-y:auto !important;
}

.chat-wrap{
  padding-bottom:120px !important;
}


/* ===== OVERRIDE FINAL COMPOSER ===== */
.inputbar{
  display:grid !important;
  grid-template-columns:52px 1fr 64px !important;
  align-items:end !important;
  gap:10px !important;

  height:auto !important;
  min-height:76px !important;
  overflow:visible !important;
}

#text{
  width:100% !important;
  min-width:0 !important;
  height:auto !important;
  min-height:48px !important;
  max-height:150px !important;
  overflow-y:auto !important;
  resize:none !important;
}


.inputbar{
  position:fixed !important;
  left:0 !important;
  right:0 !important;
  bottom:0 !important;
  display:flex !important;
  align-items:flex-end !important;
  gap:10px !important;
  padding:10px 12px calc(10px + env(safe-area-inset-bottom)) !important;
  background:transparent !important;
  z-index:1000 !important;
}

#plusBtn{
  width:54px !important;
  height:54px !important;
  border-radius:50% !important;
  border:none !important;
  background:#fff !important;
  font-size:34px !important;
  flex:0 0 54px !important;
  box-shadow:0 8px 24px rgba(0,0,0,.12) !important;
}

.composerBox{
  flex:1 !important;
  min-width:0 !important;
  display:flex !important;
  align-items:flex-end !important;
  gap:8px !important;
  background:#fff !important;
  border-radius:28px !important;
  padding:8px 8px 8px 16px !important;
  box-shadow:0 8px 24px rgba(0,0,0,.12) !important;
}

#text{
  flex:1 !important;
  min-width:0 !important;
  height:auto !important;
  min-height:40px !important;
  max-height:150px !important;
  border:none !important;
  outline:none !important;
  resize:none !important;
  overflow-y:auto !important;
  background:transparent !important;
  font-size:17px !important;
  line-height:22px !important;
  padding:9px 0 !important;
}

.send{
  width:54px !important;
  height:54px !important;
  border-radius:18px !important;
  flex:0 0 54px !important;
}

#uploadMenu{
  position:absolute !important;
  left:16px !important;
  bottom:78px !important;
  background:#fff !important;
  border-radius:18px !important;
  padding:10px !important;
  box-shadow:0 8px 24px rgba(0,0,0,.15) !important;
}


#expandBtn{
  width:44px;
  height:44px;
  border:none;
  border-radius:14px;
  background:#f3f4f6;
  font-size:22px;
}

#fullscreenInput{
  position:fixed;
  inset:0;
  background:#fff;
  z-index:99999;
  display:flex;
  flex-direction:column;
}

.fullscreenBox{
  flex:1;
  display:flex;
  flex-direction:column;
  padding:20px;
}

#fullscreenText{
  flex:1;
  width:100%;
  border:none;
  outline:none;
  resize:none;
  font-size:20px;
  line-height:1.6;
  background:transparent;
}

#closeFullscreen{
  align-self:flex-end;
  width:46px;
  height:46px;
  border:none;
  border-radius:50%;
  font-size:24px;
  margin-bottom:10px;
}

#fullscreenSend{
  height:56px;
  border:none;
  border-radius:18px;
  background:#3b82f6;
  color:white;
  font-size:18px;
  margin-top:12px;
}



#fullscreenInput{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);

  display: flex;
  align-items: center;
  justify-content: center;

  z-index: 99999;
}

#fullscreenInput.hidden{
  display: none !important;
}

.fullscreenBox{
  width: 92%;
  height: 85vh;

  background: white;
  border-radius: 24px;

  padding: 18px;

  display: flex;
  flex-direction: column;
  gap: 14px;
}

#fullscreenText{
  flex: 1;
  width: 100%;

  border: none;
  outline: none;
  resize: none;

  font-size: 18px;
  line-height: 1.6;

  background: transparent;
}

#closeFullscreen{
  align-self: flex-end;
}

#fullscreenSend{
  height: 54px;
  border: none;
  border-radius: 16px;
}
