/* KI-Lern-Chat 2.0 – bewusst getrennt von den globalen KI-Komponenten. */
.learning-chat-page {
  overflow-x: hidden;
  background: #eef4fa;
}

.learning-chat-main {
  width: 100%;
  padding: 18px clamp(14px, 2vw, 28px) 36px;
}

.learning-chat-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  width: 100%;
  margin: 0 0 16px;
}

.learning-chat-intro__copy {
  min-width: 0;
  max-width: 920px;
}

.learning-chat-intro h1 {
  margin: 0;
  font-size: clamp(1.85rem, 3vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -.03em;
  color: #13243a;
}

.learning-chat-intro p:not(.section-eyebrow) {
  margin: 10px 0 0;
  color: #5c6b7a;
  font-size: clamp(1rem, 1.3vw, 1.1rem);
}

.learning-chat-simulation-note {
  flex: 0 0 auto;
  margin: 0 !important;
  padding: 10px 13px;
  border: 1px solid rgba(45,126,255,.24);
  background: rgba(255,255,255,.78);
  color: #31506d !important;
  font-size: .88rem !important;
  line-height: 1.35;
  box-shadow: 0 8px 22px rgba(31,58,85,.07);
}

.learning-chat-layout {
  display: grid;
  grid-template-columns: minmax(230px, 290px) minmax(0, 1fr);
  width: 100%;
  height: clamp(640px, calc(100vh - 210px), 900px);
  border: 1px solid rgba(15,23,42,.12);
  background: #fff;
  box-shadow: 0 18px 50px rgba(31,58,85,.10);
  overflow: hidden;
}

.learning-chat-sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(15,23,42,.10);
  background:
    linear-gradient(180deg, rgba(45,126,255,.055), transparent 150px),
    #f7f9fc;
  overflow-y: auto;
}

.learning-chat-sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(15,23,42,.08);
}

.learning-chat-sidebar__head > div {
  display: grid;
  gap: 2px;
}

.learning-chat-sidebar__eyebrow,
.learning-chat-panel__eyebrow {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .67rem;
  font-weight: 800;
  color: #7d8a98;
}

.learning-chat-sidebar__head strong {
  font-size: 1.08rem;
  color: #13243a;
}

.learning-chat-sidebar__close,
.learning-chat-sidebar-toggle {
  display: none;
}

#learning-chat-nav {
  display: grid;
  gap: 18px;
  padding: 16px 12px 20px;
}

.learning-chat-nav-group {
  display: grid;
  gap: 6px;
}

.learning-chat-nav-group__title {
  margin: 0;
  padding: 0 8px 3px;
  color: #7b8794;
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.learning-chat-nav-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 4px 10px;
  padding: 11px 12px;
  border: 1px solid transparent;
  background: transparent;
  color: #26394d;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.learning-chat-nav-item:hover {
  background: rgba(45,126,255,.07);
  border-color: rgba(45,126,255,.10);
}

.learning-chat-nav-item.is-active {
  background: #fff;
  border-color: rgba(45,126,255,.26);
  box-shadow: 0 8px 18px rgba(31,58,85,.08);
}

.learning-chat-nav-item.is-complete .learning-chat-nav-item__check {
  opacity: 1;
  transform: scale(1);
}

.learning-chat-nav-item__title {
  min-width: 0;
  font-size: .92rem;
  font-weight: 760;
  line-height: 1.25;
}

.learning-chat-nav-item__desc {
  grid-column: 1 / -1;
  min-width: 0;
  color: #758392;
  font-size: .76rem;
  line-height: 1.35;
}

.learning-chat-nav-item__check {
  align-self: start;
  color: #1d7f57;
  font-size: .9rem;
  font-weight: 900;
  opacity: .18;
  transform: scale(.85);
  transition: opacity .16s ease, transform .16s ease;
}

.learning-chat-sidebar__footer {
  margin-top: auto;
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(15,23,42,.08);
  color: #788695;
  font-size: .74rem;
  line-height: 1.45;
}

.learning-chat-sidebar__footer p {
  margin: 0;
}

.learning-chat-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto auto;
  overflow: hidden;
  background:
    radial-gradient(circle at 85% 5%, rgba(45,126,255,.055), transparent 280px),
    #fff;
}

.learning-chat-panel__head {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 15px clamp(18px, 2.3vw, 30px);
  border-bottom: 1px solid rgba(15,23,42,.08);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(8px);
}

.learning-chat-panel__title-wrap {
  min-width: 0;
}

.learning-chat-panel__head h2 {
  margin: 1px 0 0;
  color: #13243a;
  font-size: clamp(1.08rem, 1.5vw, 1.28rem);
  line-height: 1.2;
}

.learning-chat-panel__head p {
  margin: 4px 0 0;
  color: #748291;
  font-size: .82rem;
}

.learning-chat-status {
  justify-self: end;
  padding: 7px 10px;
  border: 1px solid rgba(29,127,87,.20);
  background: rgba(29,127,87,.07);
  color: #236348;
  font-size: .76rem;
  font-weight: 780;
  white-space: nowrap;
}

.learning-chat-stream {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(20px, 3vw, 42px) clamp(16px, 4vw, 58px);
  scroll-behavior: smooth;
}

.learning-chat-message,
.learning-chat-working,
.learning-chat-lesson,
.learning-chat-checkpoint,
.learning-chat-link-row {
  width: min(940px, 100%);
  margin-inline: auto;
}

.learning-chat-message + .learning-chat-message,
.learning-chat-message + .learning-chat-working,
.learning-chat-working + .learning-chat-message,
.learning-chat-message + .learning-chat-lesson,
.learning-chat-message + .learning-chat-link-row,
.learning-chat-checkpoint + .learning-chat-message,
.learning-chat-lesson + .learning-chat-link-row {
  margin-top: 18px;
}

.learning-chat-message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: learning-chat-rise .22s ease both;
}

.learning-chat-message--user {
  justify-content: flex-end;
}

.learning-chat-avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(45,126,255,.20);
  background: #f0f6ff;
  color: #245f99;
  font-size: .76rem;
  font-weight: 900;
}

.learning-chat-bubble {
  max-width: min(760px, 88%);
  padding: 12px 14px;
  border: 1px solid rgba(15,23,42,.10);
  color: #203246;
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 6px 18px rgba(31,58,85,.055);
}

.learning-chat-bubble--assistant {
  background: #fff;
}

.learning-chat-bubble--user {
  background: #edf5ff;
  border-color: rgba(45,126,255,.20);
}

.learning-chat-message__attachments {
  display: grid;
  gap: 8px;
  margin-bottom: 9px;
}

.learning-chat-attachment {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr);
  align-items: center;
  gap: 11px;
  width: min(360px, 100%);
  padding: 10px 12px;
  border: 1px solid rgba(15,23,42,.12);
  background: #fff;
  box-shadow: 0 5px 16px rgba(31,58,85,.06);
}

.learning-chat-attachment--pdf {
  border-left: 4px solid #d55252;
}

.learning-chat-attachment--image {
  border-left: 4px solid #2d7eff;
}

.learning-chat-attachment__icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f2f5f8;
  color: #4c6175;
  font-size: 1.1rem;
  font-weight: 900;
}

.learning-chat-attachment__copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.learning-chat-attachment__name {
  overflow: hidden;
  color: #23384d;
  font-size: .84rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.learning-chat-attachment__meta {
  color: #81909e;
  font-size: .72rem;
}

.learning-chat-working {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #6f7e8d;
  font-size: .82rem;
}

.learning-chat-working__dots {
  display: inline-flex;
  gap: 4px;
}

.learning-chat-working__dots span {
  width: 6px;
  height: 6px;
  background: #7396bb;
  border-radius: 50%;
  animation: learning-chat-dot 1s ease-in-out infinite;
}

.learning-chat-working__dots span:nth-child(2) { animation-delay: .12s; }
.learning-chat-working__dots span:nth-child(3) { animation-delay: .24s; }

.learning-chat-lesson {
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px solid rgba(29,127,87,.22);
  border-left: 4px solid #2a9067;
  background: rgba(29,127,87,.06);
  color: #28473a;
}

.learning-chat-lesson strong {
  display: block;
  margin-bottom: 4px;
  color: #1e6849;
}

.learning-chat-lesson p,
.learning-chat-checkpoint p {
  margin: 0;
}

.learning-chat-checkpoint {
  margin-top: 20px;
  padding: 13px 15px;
  border: 1px solid rgba(45,126,255,.24);
  background: #f1f6ff;
  color: #315b86;
  font-weight: 780;
}

.learning-chat-checkpoint--warning {
  border-color: rgba(190,76,55,.30);
  border-left: 4px solid #bd543f;
  background: #fff4f1;
  color: #8d3b2d;
}

.learning-chat-link-row {
  margin-top: 16px;
}

.learning-chat-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid rgba(45,126,255,.28);
  background: #fff;
  color: #1e5f9f;
  font-weight: 800;
  text-decoration: none;
}

.learning-chat-link::after {
  content: "→";
}

.learning-chat-link:hover {
  background: #f2f7ff;
}

.learning-chat-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid rgba(15,23,42,.08);
  background: #fafbfd;
}

.learning-chat-controls button,
.learning-chat-sidebar-toggle,
.learning-chat-sidebar__close {
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid rgba(15,23,42,.12);
  background: #fff;
  color: #33495f;
  font: inherit;
  font-size: .82rem;
  font-weight: 760;
  cursor: pointer;
}

.learning-chat-controls button:hover,
.learning-chat-sidebar-toggle:hover,
.learning-chat-sidebar__close:hover {
  border-color: rgba(45,126,255,.32);
  background: #f2f7ff;
}

.learning-chat-controls button[disabled] {
  opacity: .45;
  cursor: default;
}

.learning-chat-composer-wrap {
  padding: 11px clamp(14px, 3vw, 30px) 12px;
  border-top: 1px solid rgba(15,23,42,.08);
  background: #fff;
}

.learning-chat-attachment-slot {
  width: min(940px, 100%);
  margin: 0 auto 7px;
}

.learning-chat-attachment-slot:empty {
  display: none;
}

.learning-chat-composer-row {
  width: min(940px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: end;
  gap: 8px;
  min-height: 52px;
  padding: 7px 8px;
  border: 1px solid rgba(15,23,42,.14);
  background: #f8fafc;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

.learning-chat-plus,
.learning-chat-send {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(15,23,42,.10);
  background: #fff;
  color: #51667b;
  font-weight: 900;
}

.learning-chat-send {
  background: #2d7eff;
  color: #fff;
  border-color: #2d7eff;
}

#learning-chat-composer {
  width: 100%;
  min-height: 36px;
  max-height: 110px;
  resize: none;
  overflow-y: auto;
  padding: 7px 5px 5px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #24384c;
  font: inherit;
  line-height: 1.45;
}

#learning-chat-composer::placeholder {
  color: #9aa6b2;
}

.learning-chat-composer-note {
  width: min(940px, 100%);
  margin: 5px auto 0;
  color: #8a97a4;
  font-size: .7rem;
  text-align: center;
}

.learning-chat-nav-item:focus-visible,
.learning-chat-controls button:focus-visible,
.learning-chat-sidebar-toggle:focus-visible,
.learning-chat-sidebar__close:focus-visible,
.learning-chat-link:focus-visible {
  outline: 3px solid rgba(45,126,255,.24);
  outline-offset: 2px;
}

@keyframes learning-chat-rise {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes learning-chat-dot {
  0%, 60%, 100% { opacity: .35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

@media (max-width: 1100px) {
  .learning-chat-layout {
    grid-template-columns: minmax(215px, 250px) minmax(0, 1fr);
  }

  .learning-chat-intro {
    align-items: flex-start;
  }

  .learning-chat-simulation-note {
    max-width: 330px;
  }
}

@media (max-width: 860px) {
  .learning-chat-main {
    padding-inline: 10px;
  }

  .learning-chat-intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .learning-chat-simulation-note {
    max-width: none;
  }

  .learning-chat-layout {
    grid-template-columns: minmax(0, 1fr);
    position: relative;
    min-height: 660px;
  }

  .learning-chat-sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    width: min(330px, calc(100vw - 38px));
    z-index: 20;
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: 18px 0 40px rgba(15,23,42,.18);
  }

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

  #learning-chat-sidebar-toggle,
  #learning-chat-sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .learning-chat-panel__head {
    grid-template-columns: auto minmax(0,1fr) auto;
  }

  .learning-chat-sidebar-toggle {
    align-self: start;
    white-space: nowrap;
  }
}

@media (max-width: 620px) {
  .learning-chat-main {
    padding-inline: 6px;
  }

  .learning-chat-intro {
    padding-inline: 7px;
  }

  .learning-chat-layout {
    border-left: 0;
    border-right: 0;
    min-height: 690px;
  }

  .learning-chat-panel__head {
    grid-template-columns: auto minmax(0,1fr);
    gap: 10px;
    padding-inline: 12px;
  }

  .learning-chat-status {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .learning-chat-sidebar-toggle {
    width: 42px;
    overflow: hidden;
    white-space: nowrap;
    color: transparent;
    position: relative;
  }

  .learning-chat-sidebar-toggle::before {
    content: "☰";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #33495f;
    font-size: 1rem;
  }

  .learning-chat-stream {
    padding-inline: 12px;
  }

  .learning-chat-bubble {
    max-width: 92%;
  }

  .learning-chat-avatar {
    width: 30px;
    height: 30px;
  }

  .learning-chat-controls {
    justify-content: stretch;
    padding-inline: 8px;
  }

  .learning-chat-controls button {
    flex: 1 1 0;
    padding-inline: 6px;
    font-size: .76rem;
  }

  .learning-chat-composer-wrap {
    padding-inline: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .learning-chat-page *,
  .learning-chat-page *::before,
  .learning-chat-page *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
