 
.chat-container {
  width: 100%;
  max-width: 800px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 40px 12px 12px;
  box-sizing: border-box;
  position: relative;

  background: #fff;
  scrollbar-width: none;       
  -ms-overflow-style: none;    
}


.chat-container::-webkit-scrollbar {
  display: none;
}


 
  .chat-messages {
  width: 100%;
  padding-top: 50px;
  padding-bottom: 260px; 
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-left: 0;
  padding-right: 0;
  scroll-behavior: auto;

  scrollbar-width: none;      
  -ms-overflow-style: none; 
  
  position: relative; 
  z-index: 2; 
}



 .chat-container {
  overflow-x: hidden;
}
.chat-messages {
  overflow-x: hidden;
}


 
.chat-messages::-webkit-scrollbar {
  display: none;
}
  .message {
    display: flex;
    flex-direction: column;
    max-width: 100%;
  }

 
.message.user .message-text {
  position: relative; 
  margin-top: 16px;
  align-self: flex-end;
  background-color: #f4f4f4;
  color: #111;
  border-radius: 14px 0 14px 14px;
  font-family: 'Goo1-Regular', Arial, sans-serif;
  padding-right: 32px; 
  transition: all 0.3s ease;
}


.message-text.text-folded {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}


.msg-toggle-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.7); 
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  transition: background 0.2s;
  z-index: 10;
}

.msg-toggle-btn:hover {
  background: white;
  color: #000;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
  

.chat-image:hover {
  opacity: 0.85;
}


  
 #imagePreviewContainer {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  margin-bottom: 8px;
}

.image-preview {
  position: relative;
  width: 140px;
  height: 140px;
  border: 1px solid #ddd;
  border-radius: 14px;
  overflow: visible; 
  background-color: white;
}

.image-inner {
  width: 100%;
  height: 100%;
  overflow: hidden; 
  border-radius: 14px;
}

.image-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}


.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  margin-top: -26px; 
}

.image-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 6px;
  z-index: 2;
}

.image-actions .icon-btn {
  background-color: black;
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}



.download-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg); /* Nou vire l pou l kòmanse anwo (12h) */
  width: 36px; 
  height: 36px;
  pointer-events: none;
  opacity: 0; /* Kache l lè pa gen download */
  transition: opacity 0.3s ease;
}

.download-spinner circle {
  fill: #fafafa;
  stroke: #333; /* Mwen mete l vèt pou siksè, ou ka mete l nwa #333 */
  stroke-width: 3;
  stroke-linecap: round; /* Bò liy lan ap won, pi bèl */
  
  /* MATH: 2 * PI * R (16) ≈ 100. Sa se longè total liy lan. */
  stroke-dasharray: 100; 
  stroke-dashoffset: 100; /* 100 vle di liy lan kache nèt (pouse deyò) */
}

/* --- ANIMASYON AN --- */

/* Lè klas 'is-downloading' la la */
.is-downloading .download-spinner {
  opacity: 1; /* Montre SVG a */
}

.is-downloading .download-spinner circle {
  /* Animation: non, dire, vitès, forwards (pou l ret plen nan fen an) */
  animation: fill-circle 2s ease-out forwards;
}

@keyframes fill-circle {
  from {
    stroke-dashoffset: 100; /* Vide */
  }
  to {
    stroke-dashoffset: 0;   /* Plen */
  }
}





.image-uploading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 14px;
}

.upload-spinner {
  border: 4px solid #f3f3f3;
  border-top: 3px solid #000; /* Koulè nwa ou renmen an */
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
  margin-bottom: 5px;
}

.upload-percentage {
  font-size: 12px;
  font-weight: bold;
  color: #333;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}





  .message.bot .message-text {
    margin-top: 16px;
    padding: 0;
    align-self: flex-start;
    background-color: #fff;
    color: #111;
    font-family: 'Goo1-Regular', Arial, sans-serif;
    border-radius: 14px;
    margin-bottom: 8px;
  }

  .message-text {
    padding: 14px 18px;
    font-size: 17px;
    line-height: 1.6;
    max-width: 75%;
    background-color: #fff;
    
    
    width: fit-content;
    
    word-wrap: break-word;
  overflow-wrap: break-word;
  min-width: 20px;
  }

 .chat-input {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px;
    background-color: transparent;
    border-radius: 25px;
    border: 1px solid #ccc;
    box-shadow: 0 4px 12px rgba(0,0,0,0.07);
    margin-top: 12px;
    flex-wrap: nowrap;
  }


.chat-input textarea {
  resize: none;
  overflow-y: hidden; 
  padding: 3px;                  
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  border: 0px solid #ccc;
  min-height: 70px;
  max-height: 150px;
  height: auto; 
  line-height: 1.5;
  outline: none;
  font-family: 'Goo1-Regular', Arial, sans-serif;
  padding-left: 10px;
  background: transparent;
  
  scrollbar-gutter: stable;
}

.chat-input textarea::-webkit-scrollbar {
  width: 8px;
}


.chat-input textarea::-webkit-scrollbar-track {
  background: transparent;
  margin: 10px 0;
}


.chat-input textarea::-webkit-scrollbar-thumb {
  background-color: #dde3ea; 
  border-radius: 10px;    
  cursor: pointer;
}


.chat-input textarea::-webkit-scrollbar-thumb:hover {
  background-color: #dde3ea;
}




.chat-input button {
  width: 41px;
  height: 41px;
  border: none;
  border-radius: 50%;
  background-color: #ececec; 
  color: #545454;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 0;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease; 
}



.modal-chat-input.compact {
  flex-direction: row !important; /* Fòse liy orizontal */
  align-items: center !important;
  padding: 8px 12px !important;
  gap: 10px !important;
}


.modal-chat-input.compact .bottom-row {
  display: contents !important; 
}

.modal-chat-input.compact .left-icons {
  transform: translateX(-10px);
}



.modal-chat-input.compact textarea {
  order: 2;
  flex-grow: 1; /* Li pran tout espas ki rete a */
  min-height: 40px !important; /* Wotè nòmal yon liy */
  height: 40px !important;
  padding: 10px 0 !important; /* Santre text la vètikalman */
  margin: 0 !important;
  border-radius: 0;
}

/* 3. Icons Dwat yo ale dèyè nèt */
.modal-chat-input.compact .right-icons {
  order: 3;
  width: auto !important;
}

/* Ajisteman pou placeholder la parèt byen nan mitan */
.modal-chat-input.compact textarea::placeholder {
  line-height: normal;
}




#sendIconWrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease, transform 0.2s ease; 
  opacity: 1;
  transform: scale(1);
}

#sendIconWrapper.switching {
  opacity: 0;
  transform: scale(0.5); /* Li vin tou piti */
}

.chat-input button {
    padding: 0 !important;
}


.chat-input button i,
.chat-input button svg {
    display: block;
}


.chat-input button.enabled {
  background-color: #ececec; 
  color: #000; 
  cursor: pointer;
  border: none;
}


.chat-input button.loading {
  background-color: #ececec; 
  color: #000; 
  cursor: default; 
  border: none;
}
 
  
 
  .icon-btn {
    cursor: pointer;
    color: #555;
    flex-shrink: 0;
  }

  .center-placeholder {
  position: absolute;
  text-align: center;
  color: #000;
  font-size: 35px;
  margin-top: 200px;
  font-family: 'GT-Walsheim-Regular-Trial-BF651b7fc71a47d', Arial, sans-serif;
  z-index: 1;

  left: 0;
  right: 0;
}



     @media (max-width: 600px) {
    .chat-container {
      padding-top: 0px;
      padding-bottom: 100px;
    }

    .chat-input {
      position: sticky;
      bottom: 0;
      background-color: #fff;
      z-index: 10;
      flex-wrap: nowrap;
      padding: 10px;
    }

    .chat-input textarea {
      font-size: 16px;
    }

    .message-text {
      font-size: 17px;
      padding: 12px 14px;
    }

    .material-symbols-outlined {
      font-size: 20px;
    }

    html, body {
      height: 100%;
      overflow: hidden;
    }

    .chat-messages {
      overflow-y: auto;
    }
  }
  
  
  
  .spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: #fff;
}


  .popup {
      position: absolute;
      top: -40px;
      left: 50%;
      transform: translateX(-50%);
      background-color: #333;
      color: #fff;
      padding: 8px 12px;
      border-radius: 6px;
      font-size: 14px;
      opacity: 0;
      pointer-events: none;
      transition: all 0.3s ease;
      white-space: nowrap;
    }

    .popup.show {
      opacity: 1;
      pointer-events: auto;
      transform: translateX(-50%) translateY(-10px);
    }

    .popup::after {
      content: '';
      position: absolute;
      bottom: -6px;
      left: 50%;
      transform: translateX(-50%);
      border-width: 6px;
      border-style: solid;
      border-color: #333 transparent transparent transparent;
    }

    .icon-wrapper {
      position: relative;
      display: inline-block;
    } 
    
    .popup.adjust-left {
  transform: translateX(0%) translateY(-10px);
  left: 10;
}

.popup.adjust-right {
  transform: translateX(-100%) translateY(-10px);
  left: 100%;
}

.image-actions .icon-btn.remove {
  background: #484848;
  border: none;
  color: #fff;
  font-size: 16px;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.image-actions .icon-btn.remove:hover {
  background: rgba(255, 80, 80, 0.9);
  transform: scale(1.1);
}


.close-btn:hover {
  color: #ff4d4d;
  transform: scale(1.2);
}



.info-text {
  position: fixed;       
  bottom: 10px;          
  left: 50%;             
  transform: translateX(-50%); 
  padding: 18px 16px;
  border-radius: 12px;
  font-size: 13px;
  color: #888;
  text-align: center;
  z-index: 99999;        
  max-width: 90vw;       
  pointer-events: none;  
  
 
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

    
    .scroll-down-btn {
  position: absolute;
  bottom: 200px; 
  left: 45%;
  z-index: 9999;
  width: 42px;
  height: 42px;
  background-color: white;
  border: 1px solid #ccc; 
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.scroll-down-btn span {
  font-size: 24px;
  color: #555;
}

.scroll-down-btn.show {
  display: flex;
}


.chat-image {
  max-width: 200px;
  max-height: 200px;
  border-radius: 12px;
  margin-top: 8px;
  cursor: pointer;
  transition: 0.2s;
  
  align-self: flex-end; /* Pouse l a dwat */
  margin-bottom: 4px;   /* Ti espas ant imaj ak tèks */
}


.message.bot .chat-image {
  align-self: flex-start;
  margin-bottom: 4px;
}

.system-message {
  background-color: #fffbe6;
  border-left: 4px solid #f7c948;
  padding: 12px 16px;
  margin: 12px 0;
  border-radius: 6px;
  font-size: 15px;
  color: #333;
}

.modal-chat-input {
  position: fixed;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  max-width: 95vw;
  background-color: white;
  border-radius: 30px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 12px;
 justify-content: center;
  
  display: flex;
  flex-direction: column;   
  align-items: stretch;     
  gap: 10px;
  
  z-index: 9999;
  margin-top: 0 !important;
}



.modal-chat-input textarea {
  min-height: 35px;
  max-height: 150px;     
}


.modal-chat-input {
  transition: all 0.3s ease-in-out;
}


@media (max-width: 600px) {
  .chat-messages {
    padding-top: 100px; 
    padding-bottom: 210px;
  }
}

code {
  background-color: #f9f9f9;
  font-family: monospace;
  padding: 2px 5px;
  border-radius: 16px;
  font-size: 90%;
  color: #333;
}


.code-block {
  background-color: #f8f8f8;
  border: 1px solid #ddd;
  border-radius: 16px;
  padding: 12px;
  margin: 10px 0;
  overflow-x: auto;
  font-size: 16px;
  font-family: monospace;
}

pre.code-block {
  background: #f9f9f9;
  color: #f8f8f2;
  padding: 0.8em;
  border-radius: 20px;
  overflow-x: auto;
}

mark {
  background: #ffeb3b;
  padding: 0 3px;
}


table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 15px;
}

table thead {
  background-color: #f9f9f9;
}

th, td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
}


.block-title {
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 4px solid #2b7bff;
  padding-left: 12px;
  margin: 20px 0 10px;
  font-size: 16px;
  font-weight: bold;
}

.block-number {
  background: #2b7bff;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 14px;
}


.chat-response li {
  margin-bottom: 4px;
}


h1, h2, h3, h4, h5, h6 {
  font-family: system-ui, sans-serif;
  margin: 0.5em 0;
  font-weight: 600;
}

blockquote {
  border-left: 4px solid #ccc;
  padding-left: 0.8em;
  color: #555;
  margin: 0.5em 0;
  font-style: italic;
}

hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 1em 0;
}

u {
  text-decoration: underline;
}

del {
  color: #a00;
}


.list-numbered {
  margin-left: 1.2em;
}

li.task {
  list-style: none;
  margin-left: 1em;
}
li.task.done {
  color: green;
}


a {
  color: #0078d7;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}


.mention {
  background: #e0f0ff;
  color: #0366d6;
  padding: 2px 4px;
  border-radius: 4px;
  font-weight: 500;
}

.hashtag {
  background: #f0f0f0;
  color: #555;
  padding: 2px 4px;
  border-radius: 4px;
}

.admonition {
  border-left: 4px solid;
  padding: 0.6em 1em;
  margin: 0.8em 0;
  border-radius: 4px;
}
.admonition.info {
  border-color: #2196f3;
  background: #e3f2fd;
  color: #0d47a1;
}
.admonition.warn {
  border-color: #ff9800;
  background: #fff3e0;
  color: #e65100;
}
.admonition.success {
  border-color: #4caf50;
  background: #e8f5e9;
  color: #1b5e20;
}


.footnote {
  font-size: 0.85em;
  color: #666;
  margin-top: 0.5em;
}


.math-inline {
  font-family: "Times New Roman", serif;
  background: #f9f9f9;
  padding: 2px 4px;
  border-radius: 3px;
}
.math-block {
  font-family: "Times New Roman", serif;
  background: #f9f9f9;
  padding: 0.6em;
  border-radius: 4px;
  margin: 0.6em 0;
  display: block;
}


.action-btn {
  background: #fff;
  color: #5d5d5d;
  border-radius: 4px;
  padding: 5px 5px;
  cursor: pointer;
  font-size: 18px;
}
.action-btn:hover {
  background: transparent;
}

.actions {
    display: flex;
    gap: 10px;
    font-size: 14px;
    margin-top: 6px;
    padding-left: 0;
  }

  .action-btn {
    cursor: pointer;
    transition: color 0.3s;
  }

  .action-btn:hover {
    background: #e8e8e8;
  }
  
sub { font-size: 0.8em; vertical-align: sub; }
sup { font-size: 0.8em; vertical-align: super; }

.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8em;
  background: #eee;
  color: #333;
  margin: 0 2px;
}
.badge.red { background: #f44336; color: white; }
.badge.green { background: #4caf50; color: white; }

.progress {
  background: #f0f0f0;
  border-radius: 6px;
  overflow: hidden;
  height: 12px;
  width: 100px;
  display: inline-block;
  margin: 0 4px;
}
.progress-bar {
  background: #0078d7;
  height: 100%;
}

dl { margin: 0.5em 0; }
dt { font-weight: bold; }
dd { margin: 0 0 0.5em 1em; }


.selected-option-tag {
  
  align-items: center; 
  gap: 8px;
  padding: 5px 8px; 
  font-size: 14px;
  font-weight: 500;
  background-color: #f5f9ff;
  color: #0285ff;

  border-radius: 30px; 
  border: 1px solid #cce6ff;
}

.option-tag-icon svg {
  width: 18px;
  height: 18px;
  display: block; 
}


.option-tag-text {
  white-space: nowrap;
}


.option-tag-close {
  background-color: #cce6ff;
  border-radius: 100%; 
  color: #0285ff;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  
  cursor: pointer;
  
  font-size: 18px;
  font-weight: bold;
  line-height: 1; 
  
  transition: background-color 0.2s ease;
}


.option-tag-close:hover {
  background-color: #b3d7ff; 
}