/* ExtruBot-specific chat layout loaded after base stylesheet to avoid cache/stale order issues. */
.extrubot-page {
  background: linear-gradient(180deg, #f7faff 0%, #eef4ff 58%, #e7f0ff 100%);
}

.extrubot-page__title,
.extrubot-page__subtitle,
.extrubot-page__history-label {
  color: #0f2d56;
}

.extrubot-page__history-select {
  background: #ffffff;
  color: #183b6b;
  border-color: rgba(86, 127, 200, 0.38);
}

.extrubot-page__header {
  max-width: none;
  width: 100%;
}

.extrubot-page__actions {
  display: grid;
  gap: 1rem;
  margin-top: 1.15rem;
}

.extrubot-page__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 0.85rem 1rem;
}

.extrubot-page__history-group {
  display: grid;
  gap: 0.38rem;
  min-width: min(100%, 320px);
  flex: 1 1 320px;
}

.extrubot-page__action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
}

.extrubot-page__examples-panel {
  display: grid;
  gap: 0.7rem;
  padding: 1.15rem 1.2rem 1.25rem;
  border: 1px solid rgba(100, 147, 219, 0.22);
  border-radius: 1.15rem;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.96), rgba(244, 249, 255, 0.94) 52%, rgba(236, 244, 255, 0.92) 100%);
  box-shadow: 0 16px 32px rgba(24, 55, 104, 0.08);
}

.extrubot-page__examples-kicker {
  margin: 0;
  color: #4a6f9e;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.extrubot-page__examples-header {
  display: grid;
  gap: 0.24rem;
}

.extrubot-page__examples-title {
  margin: 0;
  color: #123764;
  font-size: 1.02rem;
  font-weight: 800;
}

.extrubot-page__examples-subtitle {
  margin: 0;
  color: #557195;
  font-size: 0.9rem;
  line-height: 1.45;
}

.extrubot-page__examples-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.extrubot-page__example-chip {
  min-height: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(107, 149, 219, 0.26);
  border-radius: 1rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 249, 255, 0.94));
  color: #17497f;
  font: inherit;
  font-size: 0.94rem;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.extrubot-page__example-chip:hover,
.extrubot-page__example-chip:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(29, 102, 201, 0.44);
  background: #ffffff;
  box-shadow: 0 14px 24px rgba(24, 55, 104, 0.12);
  outline: none;
}

.extrubot-explainer__details {
  margin-top: 1rem;
  border: 1px solid rgba(100, 147, 219, 0.28);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.extrubot-explainer__details-summary {
  cursor: pointer;
  padding: 0.85rem 1rem;
  color: #17497f;
  font-weight: 700;
  list-style: none;
}

.extrubot-explainer__details-summary::-webkit-details-marker {
  display: none;
}

.extrubot-explainer__details-summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  margin-right: 0.45rem;
  color: #1d66c9;
  font-size: 1rem;
  font-weight: 700;
}

.extrubot-explainer__details[open] .extrubot-explainer__details-summary::before {
  content: "-";
}

.extrubot-explainer__details .extrubot-explainer__list {
  margin: 0;
  padding: 0 1.25rem 1rem 2.3rem;
}

.extrubot-chat__privacy-toggle {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-top: 0.8rem;
  color: #2b557d;
  font-size: 0.92rem;
  line-height: 1.45;
  cursor: pointer;
}

.extrubot-chat__privacy-checkbox {
  margin-top: 0.16rem;
  accent-color: #1d66c9;
}

.extrubot-chat {
  border-color: rgba(87, 133, 211, 0.3);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 38px rgba(24, 55, 104, 0.15);
}

.extrubot-chat__messages {
  background: linear-gradient(180deg, rgba(243, 248, 255, 0.8) 0%, rgba(247, 251, 255, 0.94) 100%);
}

.extrubot-page .hero__assistant-response {
  padding: 0.25rem;
  gap: 0.9rem;
  align-content: start;
  grid-auto-rows: max-content;
  justify-items: start;
}

.extrubot-page .hero__chat-message {
  position: relative;
  max-width: min(78%, 760px);
  padding: 0.82rem 1rem;
  border-radius: 1rem;
  box-shadow: 0 8px 20px rgba(23, 54, 105, 0.12);
}

.extrubot-page .hero__chat-message--assistant {
  color: #173960;
  background: #ffffff;
  border: 1px solid rgba(116, 154, 219, 0.36);
}

.extrubot-page .hero__chat-message--assistant::after {
  content: "";
  position: absolute;
  left: -8px;
  top: 14px;
  width: 14px;
  height: 14px;
  transform: rotate(45deg);
  background: #ffffff;
  border-left: 1px solid rgba(116, 154, 219, 0.36);
  border-bottom: 1px solid rgba(116, 154, 219, 0.36);
}

.extrubot-page .hero__chat-message--user {
  color: #ffffff;
  background: linear-gradient(145deg, #1f92ff, #1c75ea);
  border: 1px solid rgba(43, 124, 234, 0.58);
}

.extrubot-page .hero__chat-message--user::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 14px;
  width: 14px;
  height: 14px;
  transform: rotate(45deg);
  background: #1d86f3;
  border-right: 1px solid rgba(43, 124, 234, 0.58);
  border-top: 1px solid rgba(43, 124, 234, 0.58);
}

.extrubot-page .hero__chat-message--status {
  max-width: min(94%, 820px);
  border-radius: 0.8rem;
  box-shadow: none;
}

.extrubot-loading {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
}

.extrubot-loading__spinner {
  width: 1rem;
  height: 1rem;
  margin-top: 0.18rem;
  border: 2px solid rgba(29, 102, 201, 0.18);
  border-top-color: #1d66c9;
  border-radius: 50%;
  animation: extrubot-spin 0.9s linear infinite;
  flex: 0 0 auto;
}

.extrubot-loading__content {
  display: grid;
  gap: 0.22rem;
}

.extrubot-loading__title,
.extrubot-loading__phase,
.extrubot-loading__meta,
.extrubot-loading__hint {
  margin: 0;
}

.extrubot-loading__title {
  color: #17497f;
  font-size: 0.92rem;
  font-weight: 700;
}

.extrubot-loading__phase {
  color: #2b557d;
  font-size: 0.9rem;
}

.extrubot-loading__meta {
  color: #5b7393;
  font-size: 0.82rem;
}

.extrubot-loading__hint {
  color: #446485;
  font-size: 0.84rem;
  line-height: 1.45;
}

.extrubot-chat__message-title {
  color: inherit;
}

.hero__chat-richtext {
  gap: 0.62rem;
}

.hero__chat-richtext .hero__chat-text,
.hero__chat-list {
  line-height: 1.65;
  font-size: 0.99rem;
}

.hero__chat-heading {
  margin: 0;
  font-size: 1rem;
  line-height: 1.4;
  color: inherit;
}

.hero__chat-richtext code {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  background: rgba(15, 46, 92, 0.08);
  border-radius: 0.35rem;
  padding: 0.05rem 0.35rem;
  font-size: 0.92em;
}

.extrubot-page .hero__chat-message--user .hero__chat-richtext a {
  color: #deeeff;
}

.extrubot-page .hero__chat-message--assistant .hero__chat-richtext a {
  color: #1d66c9;
}

.extrubot-citation {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  margin: 0 0.08rem;
  font-size: 0.95em;
  line-height: 1.45;
  text-decoration: none;
  border-radius: 0.45rem;
}

.extrubot-page .hero__chat-message--assistant .extrubot-citation--study {
  color: #195eb8;
  font-weight: 600;
}

.extrubot-page .hero__chat-message--assistant .extrubot-citation--claim {
  color: #295784;
  font-weight: 600;
  border-bottom: 1px dashed rgba(41, 87, 132, 0.38);
}

.extrubot-page .hero__chat-message--assistant .extrubot-citation:hover,
.extrubot-page .hero__chat-message--assistant .extrubot-citation:focus {
  color: #0f4d99;
}

.extrubot-page .hero__chat-source-summary {
  display: grid;
  gap: 0.8rem;
}

.extrubot-reference-section {
  display: grid;
  gap: 0.48rem;
}

.extrubot-reference-section__title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1f4f86;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.extrubot-reference-list {
  list-style: none;
  display: grid;
  gap: 0.48rem;
  margin: 0;
  padding: 0;
}

.extrubot-reference-list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.58rem 0.7rem;
  border: 1px solid rgba(100, 147, 219, 0.28);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.78);
}

.extrubot-reference-list__item--claim {
  align-items: stretch;
  gap: 0.38rem;
}

.extrubot-reference-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  padding: 0.18rem 0.48rem;
  border-radius: 999px;
  background: #e7f1ff;
  color: #1e538d;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.extrubot-reference-link,
.extrubot-reference-text {
  color: #184a80;
  font-size: 0.92rem;
  line-height: 1.5;
}

.extrubot-reference-link {
  text-decoration: none;
}

.extrubot-reference-link:hover,
.extrubot-reference-link:focus {
  text-decoration: underline;
}

.extrubot-reference-meta {
  color: #6481a6;
  font-size: 0.82rem;
}

.extrubot-reference-claim-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.extrubot-reference-claim-label {
  color: #1d4d82;
  font-size: 0.92rem;
  font-weight: 700;
}

.extrubot-reference-claim-text,
.extrubot-reference-support {
  margin: 0;
  width: 100%;
  color: #294866;
  font-size: 0.9rem;
  line-height: 1.55;
}

.extrubot-chat__composer {
  background: #ffffff;
  border-top: 1px solid rgba(119, 156, 219, 0.28);
}

.extrubot-chat__feedback {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: 0.65rem;
  flex-wrap: wrap;
}

.extrubot-chat__feedback-label {
  font-size: 0.82rem;
  color: #5a7193;
}

.extrubot-chat__feedback-button {
  min-width: 2rem;
  padding: 0.2rem 0.5rem;
  line-height: 1.2;
}

.extrubot-chat__feedback-button.is-selected {
  border-color: rgba(29, 102, 201, 0.55);
  background: #e8f1ff;
}

.extrubot-chat__feedback-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.extrubot-chat__label {
  color: #1f4779;
}

.extrubot-chat__disclosure {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #4f6485;
  white-space: nowrap;
  max-width: 70ch;
}

.extrubot-chat__input {
  border-color: rgba(114, 153, 219, 0.55);
}

@media (max-width: 720px) {
  .extrubot-page .hero__chat-message {
    max-width: 94%;
  }

  .extrubot-page__controls {
    align-items: stretch;
  }

  .extrubot-page__action-buttons {
    justify-content: stretch;
  }

  .extrubot-page__action-buttons .button {
    flex: 1 1 140px;
  }

  .extrubot-page__examples-list {
    grid-template-columns: 1fr;
  }

  .extrubot-page__example-chip {
    width: 100%;
  }

  .extrubot-reference-list__item {
    padding: 0.55rem 0.62rem;
  }

  .extrubot-citation {
    display: inline;
  }
}

@keyframes extrubot-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
