:root {
  --body-bg: var(--palette-paper);
  --msger-bg: var(--palette-paper);
  --left-msg-bg: var(--color-surface-subtle);
  --right-msg-bg: var(--color-info-surface);
  --accent: var(--color-action);
}

.chatbot-consent {
  width: min(100% - 32px, 680px);
  margin: clamp(24px, 7vh, 72px) auto;
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 12px 34px var(--color-scrim-16);
  text-align: left;
}

.chatbot-consent__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: var(--color-action);
  color: var(--color-on-action);
  font-weight: 700;
}

.chatbot-consent h1 {
  margin: 0 0 18px;
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.2;
}

.chatbot-consent p {
  margin: 12px 0;
  line-height: 1.55;
}

.chatbot-consent__blocked {
  padding: 14px 16px;
  border-left: 4px solid var(--color-danger);
  border-radius: 6px;
  background: var(--color-danger-surface);
}

.chatbot-consent__form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.chatbot-consent__personalization {
  display: flex;
  flex: 1 0 100%;
  gap: 10px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface-subtle);
  cursor: pointer;
}

.chatbot-consent__personalization input {
  margin-top: 3px;
}

.chatbot-consent__personalization span,
.chatbot-consent__personalization small {
  display: block;
}

.chatbot-consent__personalization small {
  margin-top: 4px;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.chatbot-personalization {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 650pt;
  margin: 0 auto 10px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface-subtle);
  color: var(--color-text);
}

.chatbot-personalization.is-active {
  border-color: var(--color-action);
}

.chatbot-personalization p {
  margin: 4px 0 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.chatbot-personalization button {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--color-action);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-action);
  cursor: pointer;
}

.chatbot-consent__form button {
  height: 44px;
  min-height: 0;
  padding: 6px 14px;
  border-radius: 7px;
  box-sizing: border-box;
  font: inherit;
  cursor: pointer;
}

.chatbot-consent__refuse {
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text);
}

@media screen and (max-width: 520px) {
  .chatbot-consent {
    width: calc(100% - 20px);
    margin-top: 16px;
    padding: 22px 18px;
  }

  .chatbot-consent__form button {
    width: 100%;
  }

  .chatbot-personalization {
    align-items: stretch;
    flex-direction: column;
    margin: 0 10px 10px;
    width: calc(100% - 20px);
  }

  .chatbot-personalization button {
    width: 100%;
  }
}

*,
*:before,
*:after {
  margin: 0;
  padding: 0;
  box-sizing: inherit;
}

.msger {
  display: flex;
  flex-flow: column wrap;
  justify-content: space-between;
  width: 100%;
  max-width: none;
  height: calc(100% - 50px);
  border: none;
  border-radius: 0;
  background: var(--msger-bg);
  box-shadow: none;
  font-family: sohne, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.chatbot-book-cover {
  display: block;
  width: auto;
  max-width: min(150px, 45vw);
  max-height: 220px;
  margin: 10px 0;
  border-radius: 7px;
  box-shadow: 0 5px 14px color-mix(in srgb, var(--color-text) 20%, transparent);
}

@media screen and (min-width: 769px) {
  .msger {
    max-width: 650pt;
  }
}

.msger-header {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  border-bottom: var(--border);
  background: var(--color-surface);
  color: var(--color-text);
}

.msger-chat {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0 64px 0;
}

.msger-chat::-webkit-scrollbar {
  width: 6px;
}

.msger-chat::-webkit-scrollbar-track {
  background: var(--color-surface-subtle);
}

.msger-chat::-webkit-scrollbar-thumb {
  background: var(--color-border);
}

.msg {
  display: flex;
  align-items: flex-end;
  margin-bottom: 10px;
}

.msg:last-of-type {
  margin: 0;
}

.msg-img {
  width: 50px;
  height: 50px;
  margin-right: 10px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  border-radius: 50%;
}

.msg-bubble {
  max-width: calc(min(100%, 600px) - 70px); 
  border-radius: 15px;
  background: var(--left-msg-bg);
  padding: 5px;
}

.msg-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.msg-info-name {
  margin-right: 10px;
  font-weight: bold;
}

.msg-info-time {
  font-size: 0.85em;
}

.left-msg .msg-bubble {
  border-bottom-left-radius: 0;
}

.right-msg {
  flex-direction: row-reverse;
}

.right-msg .msg-bubble {
  background: var(--right-msg-bg);
  color: var(--color-text);
  border-bottom-right-radius: 0;
}

.right-msg .msg-img {
  margin: 0 0 0 10px;
}

.msger-inputarea {
  display: flex;
  padding: 0 5px 5px;
  background: var(--color-surface);
  align-items: flex-end;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  position: sticky;
  left: 0;
  right: 0;
  bottom: 5px;
}

@media screen and (max-width: 768px) {
  .msger-inputarea {
    position: fixed;
    bottom: var(--bottom-nav-height, 80px);
  }

  .msger-chat {
    padding-bottom: calc(var(--bottom-nav-height, 80px) + 10px);
  }

  .chat-scroll-bottom {
    bottom: calc(var(--bottom-nav-height, 80px) + 45px);
  }
}

@media screen and (min-width: 1301px) {
  .msger-inputarea {
    left: 158pt;
    right: auto;
    width: calc(100% - 158pt);
    max-width: 900px;
  }
}

@media screen and (max-width: 1300px) {
  .msger-inputarea {
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
  }
}

.msger-inputarea * {
  border: none;
  border-radius: 3px;
  font-size: 1em;
}

.msger-input {
  flex: 1 1 0%;
  min-width: 0;
  width: auto;
  background: var(--color-surface-subtle);
  color: var(--color-text);
  height: 30px;
  padding: 0 10px 0 10px;
  box-sizing: border-box;
}

@media screen and (max-width: 768px) {
  .msger-input {
    font-size: 16px;
  }
}

.msger-send-btn {
  margin-left: 5px;
  background: var(--accent);
  color: var(--color-on-action);
  font-weight: bold;
  cursor: pointer;
  border: 1pt solid var(--accent);
  transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out;
  padding: 0 14px;
  height: 30px;
  width: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.msger-send-btn:hover {
  background: var(--color-surface);
  color: var(--accent);
}

.msg-text {
  margin: 0.3em 0 0.4em 0;
  line-height: 1.5em;
  font-size: 13pt;
}

.msg-text.is-thinking {
  min-height: 1.5em;
  color: var(--color-text-muted);
}

.chat-thinking {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-size: 0.9em;
}

.chat-thinking__symbol {
  color: var(--color-action);
  font-size: 1.15em;
  animation: chatbot-thinking-pulse 1.2s ease-in-out infinite;
}

.chat-thinking__dots {
  display: inline-flex;
  min-width: 1.1em;
}

.chat-thinking__dots span {
  animation: chatbot-thinking-dot 1.2s ease-in-out infinite;
  opacity: 0.25;
}

.chat-thinking__dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-thinking__dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes chatbot-thinking-pulse {
  0%, 100% {
    opacity: 0.45;
    transform: scale(0.85) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.1) rotate(18deg);
  }
}

@keyframes chatbot-thinking-dot {
  0%, 60%, 100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-0.12em);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-thinking__symbol,
  .chat-thinking__dots span {
    animation: none;
    opacity: 0.75;
    transform: none;
  }
}

#msg-welcome {
  text-align: left;
}

.msg-text ul,
.msg-text ol {
  margin: 0.4em 0;
  padding-left: 1.2em;
  white-space: normal;
}

.msg-text li {
  padding-left: 0;
  white-space: normal;
}

.tablink {
  display: block;
  color: var(--color-text);
  text-align: left;
  padding: 8px 16px;
  text-decoration: none;
  font-size: 16px;
  border: none;
  background-color: var(--color-surface);
  width: 100%;
  cursor: pointer;
  transition: 0.3s;
}

.tablink.active {
  background-color: var(--accent);
  color: var(--color-on-action);
}


.tabcontent {
  display: none;
  padding: 20px;
  height: 100%;
}

#tab1 {
  display: block;
}

/* .sidebar-header {
     font-weight: bold;
     text-align: center;
     margin-bottom: 26px;
     cursor: auto;
} */
.delete-button {
  background-color: var(--color-action);
  border: 1pt solid var(--color-action);
  padding: 4pt 8pt 2pt 8pt;
  margin-right: 5px;
  font-family: sohne, "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--color-on-action);
  text-decoration: none;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 3pt;
  transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.delete-button:hover {
    background-color: var(--color-surface);
    color: var(--color-action);
}

.delete-button:active {
    background-color: var(--color-action);
    color: var(--color-action);
}

.delete-button .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.delete-button .icon svg {
  display: block;
}

.msger-send-btn .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.msger-send-btn .icon svg {
  display: block;
}

.chat-scroll-bottom {
  position: fixed;
  left: 40%;
  bottom: calc(5px + 30px + 20px);
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-action-secondary);
  color: var(--color-on-action);
  border: 1pt solid var(--color-action-secondary);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 125;
  transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

@media screen and (min-width: 769px) {
  .parent#parcourir {
    padding-bottom: 60px;
  }
}

.chat-scroll-bottom.is-visible {
  display: inline-flex;
}

.chat-scroll-bottom:hover {
  background: var(--color-surface);
  color: var(--color-action-secondary);
}

@media screen and (max-width: 768px) {
  .chat-scroll-bottom {
    bottom: calc(var(--bottom-nav-height, 80px) + 45px);
    left: 50%;
  }
}

.chat-scroll-bottom:focus,
.chat-scroll-bottom:focus-visible {
  outline: none;
  box-shadow: none;
}

.chat-scroll-bottom::before,
.chat-scroll-bottom::after {
  content: none;
}

.id_session
{
  display: none;
}

.chat-scroll-bottom[aria-label]:hover::before,
.chat-scroll-bottom[aria-label]:focus::before,
.chat-scroll-bottom[aria-label]:hover::after,
.chat-scroll-bottom[aria-label]:focus::after {
  content: none !important;
}
.chatbot-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  width: min(650pt, 100%);
  margin-inline: auto;
  isolation: isolate;
  position: relative;
}

.chatbot-workspace--conversation-only {
  grid-template-columns: minmax(0, 1fr);
}

.chat-history-controls {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-start;
}

.chat-history-toggle {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .5rem .8rem;
  border: 1px solid var(--color-action-secondary);
  border-radius: 9px;
  background: var(--color-action-secondary);
  color: var(--color-on-action);
  cursor: pointer;
  font-weight: 600;
}

.chat-history-toggle__icon {
  flex: 0 0 auto;
}

.chat-history-toggle:hover,
.chat-history-toggle:focus-visible {
  background: var(--color-surface);
  color: var(--color-action-secondary);
}

.chatbot-workspace.is-history-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.chatbot-workspace.is-history-collapsed .chat-history {
  display: none;
}

.chat-history {
  position: relative;
  z-index: 0;
  align-self: start;
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  color: var(--color-text);
}

@media (min-width: 1301px) {
  .chat-history {
    position: absolute;
    top: calc(2.5rem + 1rem);
    right: calc(100% + 1rem);
    width: 280px;
    max-height: calc(100vh - 250px);
  }

  .chat-history__list {
    max-height: calc(100vh - 350px);
  }
}

@media (min-width: 1400px) {
  .chatbot-workspace {
    transform: translateX(-36px);
  }
}

.chatbot-workspace .msger {
  position: relative;
  z-index: 1;
  min-height: min(620px, calc(100vh - 250px));
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  box-shadow: 0 8px 24px var(--shadow-panel-soft-color);
}

.chatbot-workspace .msger-header {
  align-items: center;
  min-height: 48px;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-subtle);
}

.chatbot-workspace .msger-header-title {
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 700;
}

.chatbot-workspace .id_session {
  display: inline;
}

.chatbot-workspace .msger-chat {
  padding: 1rem 1rem 72px;
}

.chatbot-workspace .msger-inputarea {
  left: auto;
  right: auto;
  bottom: 0;
  width: 100%;
  max-width: none;
  padding: .65rem;
  border-top: 1px solid var(--color-border);
}

.chatbot-workspace .msger-input {
  height: 42px;
  border: 1px solid var(--color-border);
  border-radius: 9px;
}

.chatbot-workspace .delete-button,
.chatbot-workspace .msger-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 9px;
}

.chat-history__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .75rem;
}

.chat-history__header h2 {
  margin: 0;
  font-size: 1rem;
}

.chat-history__new,
.chat-history__item {
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}

.chat-history__new {
  padding: .45rem .7rem;
  background: var(--color-action);
  color: var(--color-on-action);
}

.chat-history__list {
  display: grid;
  gap: .4rem;
  max-height: 65vh;
  overflow-y: auto;
}

.chat-history__item {
  display: grid;
  gap: .2rem;
  border: 1px solid transparent;
  padding: .7rem;
  text-align: left;
  background: transparent;
  color: var(--color-text);
}

.chat-history__item-title {
  font-weight: 600;
}

.chat-history__item-date {
  color: var(--color-text-muted);
  font-size: .78rem;
}

.chat-history__item:hover,
.chat-history__item.is-current {
  background: var(--color-surface-subtle);
}

.chat-history__item.is-current {
  border-color: var(--color-action-selected);
}

.chat-readonly-notice {
  display: block;
  margin-bottom: 1rem;
  padding: .5rem .75rem;
  border-radius: 8px;
  text-align: center;
  font-size: .9rem;
  background: var(--color-surface-subtle);
  color: var(--color-text-muted);
}

.msger-inputarea[hidden] {
  display: none !important;
}

@media (max-width: 768px) {
  .chatbot-workspace {
    grid-template-columns: 1fr;
  }

  .chat-history__list {
    display: grid;
    max-height: 45vh;
    overflow-y: auto;
  }

  .chat-history__item {
    min-width: 0;
  }

  .chat-history:not(.is-open) {
    display: none;
  }

  .chatbot-workspace .msger {
    min-height: calc(100vh - 300px);
    border-radius: 12px;
    box-shadow: none;
  }

  .chatbot-workspace .msger-chat {
    padding: .75rem .5rem calc(var(--bottom-nav-height, 80px) + 18px);
  }

  .chatbot-workspace .msger-inputarea {
    bottom: var(--bottom-nav-height, 80px);
    padding: .5rem;
  }
}
