/**
 * 星河 AI V2 — 十大军师对话区样式
 */

#advisor-chat-mount,
.advisor-chat-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
}

#advisor-chat-mount[hidden],
#advisor-chat-root[hidden] {
  display: none !important;
}

.advisor-topbar {
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.advisor-page-head {
  min-width: 0;
  flex: 1;
}

.advisor-page-kicker {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #64748b;
  margin-bottom: 6px;
}

.advisor-page-headline {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.advisor-page-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgba(139, 92, 246, 0.16);
  border: 1px solid rgba(139, 92, 246, 0.28);
}

.advisor-page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  margin: 0;
}

.advisor-page-desc {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  color: var(--text-subtle);
  line-height: 1.4;
}

.advisor-chat-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.advisor-messages {
  --xh-advisor-column: min(880px, calc(100% - 48px));
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 24px 0 28px;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(167, 139, 250, 0.35) transparent;
}

.advisor-messages::-webkit-scrollbar {
  width: 6px;
}

.advisor-messages::-webkit-scrollbar-track {
  background: transparent;
}

.advisor-messages::-webkit-scrollbar-thumb {
  background: rgba(167, 139, 250, 0.32);
  border-radius: 999px;
}

.advisor-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(196, 181, 253, 0.48);
}

.advisor-messages > .advisor-empty,
.advisor-messages > .advisor-msg {
  width: var(--xh-advisor-column);
  max-width: var(--xh-advisor-column);
  box-sizing: border-box;
}

.advisor-empty {
  margin: auto;
  padding: 28px 18px 40px;
  text-align: center;
  color: rgba(241, 236, 255, 0.78);
}

.advisor-empty-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
}

.advisor-empty-mark {
  font-size: 40px;
  line-height: 1;
  filter: drop-shadow(0 0 16px rgba(196, 181, 253, 0.5));
}

.advisor-empty h2 {
  margin: 0;
  color: #fff;
  font-size: 30px;
  font-weight: 700;
}

.advisor-empty-lead {
  margin: 0;
  font-size: 14px;
  color: rgba(221, 214, 254, 0.78);
}

.advisor-empty-capabilities {
  list-style: none;
  margin: 0 auto 22px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 420px;
}

.advisor-empty-capabilities li {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(167, 139, 250, 0.22);
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
}

.advisor-empty-cta {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: rgba(196, 181, 253, 0.72);
}

.advisor-msg {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: advisorMsgIn 0.28s ease;
}

@keyframes advisorMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.advisor-msg--user {
  align-items: flex-end;
}

.advisor-msg--assistant {
  align-items: stretch;
}

.advisor-msg__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px;
  color: rgba(235, 227, 255, 0.48);
  font-size: 12px;
}

.advisor-msg__label time,
.advisor-msg__time {
  color: rgba(235, 227, 255, 0.38);
  font-size: 11px;
}

.advisor-msg__card {
  border-radius: 20px;
  border: 1px solid rgba(167, 139, 250, 0.34);
  background:
    linear-gradient(160deg, rgba(88, 56, 170, 0.16), rgba(18, 16, 34, 0.72) 42%, rgba(10, 12, 24, 0.82));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 0 28px rgba(124, 92, 215, 0.16),
    0 18px 44px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  padding: 14px 16px 16px;
}

.advisor-msg__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 10px;
}

.advisor-msg__brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
  color: #f3e8ff;
}

.advisor-msg__model {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(74, 222, 128, 0.22);
  background: rgba(16, 185, 129, 0.08);
  color: rgba(209, 250, 229, 0.9);
  font-size: 11px;
}

.advisor-msg__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.8);
}

.advisor-msg__time {
  margin-left: auto;
}

.advisor-msg__bubble {
  max-width: 100%;
  line-height: 1.8;
  font-size: 0.9375rem;
  word-break: break-word;
}

.advisor-msg--user .advisor-msg__bubble {
  width: fit-content;
  max-width: min(400px, 100%);
  margin-left: auto;
  padding: 12px 14px;
  border-radius: 18px 18px 6px 18px;
  color: #faf8ff;
  background: linear-gradient(135deg, rgba(109, 74, 230, 0.94), rgba(147, 91, 214, 0.9));
  border: 1px solid rgba(196, 181, 253, 0.28);
  box-shadow: 0 12px 28px rgba(88, 48, 180, 0.28);
  line-height: 1.65;
  font-size: 14px;
}

.advisor-msg--assistant .advisor-msg__bubble {
  color: rgba(248, 245, 255, 0.94);
  background: transparent;
  border: 0;
  padding: 0;
}

.advisor-msg__bubble.is-markdown p {
  margin: 0 0 0.85em;
}

.advisor-msg__bubble.is-markdown p:last-child {
  margin-bottom: 0;
}

.advisor-msg__bubble.is-markdown h2,
.advisor-msg__bubble.is-markdown h3,
.advisor-msg__bubble.is-markdown h4 {
  margin: 0.9em 0 0.45em;
  color: #f5f3ff;
  font-weight: 650;
  line-height: 1.35;
}

.advisor-msg__bubble.is-markdown h2 { font-size: 1.2em; }
.advisor-msg__bubble.is-markdown h3 { font-size: 1.08em; }
.advisor-msg__bubble.is-markdown h4 { font-size: 1em; }

.advisor-msg__bubble.is-markdown ul {
  margin: 0.4em 0 0.9em;
  padding-left: 1.25em;
}

.advisor-msg__bubble.is-markdown li {
  margin: 0.25em 0;
}

.advisor-msg__bubble.is-markdown code {
  padding: 0.12em 0.4em;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.advisor-msg__code {
  margin: 0.7em 0;
  padding: 12px 14px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(167, 139, 250, 0.22);
  background: rgba(5, 8, 18, 0.72);
  scrollbar-width: thin;
  scrollbar-color: rgba(167, 139, 250, 0.35) transparent;
}

.advisor-msg__code code {
  padding: 0;
  background: transparent;
  color: rgba(237, 233, 254, 0.94);
  font-size: 0.86em;
  white-space: pre;
}

.advisor-msg__bubble.is-markdown a {
  color: #c4b5fd;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.advisor-msg--assistant.is-streaming .advisor-msg__card {
  border-color: rgba(196, 181, 253, 0.48);
}

.advisor-msg__actions.chat-workspace-action-bar,
.advisor-msg__card > .chat-workspace-action-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.advisor-msg__card .chat-workspace-action-btn {
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(226, 232, 240, 0.78);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.advisor-msg__card .chat-workspace-action-btn i {
  font-size: 14px;
  line-height: 1;
}

.advisor-msg__card .chat-workspace-action-btn:hover {
  color: #fff;
  border-color: rgba(167, 139, 250, 0.42);
  background: rgba(124, 92, 255, 0.14);
  transform: translateY(-1px);
}

.advisor-msg__card .chat-workspace-action-btn.is-saved {
  color: #fff;
  border-color: rgba(255, 122, 160, 0.45);
  background: rgba(255, 92, 138, 0.15);
}

/* Composer shell — match general chat AI workspace */
.advisor-composer {
  flex-shrink: 0;
  width: min(880px, calc(100% - 48px));
  margin: 0 auto;
  padding: 6px 0 22px;
}

.advisor-composer-status {
  max-width: none;
  margin: 0 0 8px;
  padding: 0 4px;
  font-size: 12px;
  color: rgba(236, 229, 255, 0.62);
}

.advisor-composer-status.is-error {
  color: #fca5a5;
}

.advisor-composer-wrap {
  width: 100%;
  max-width: none;
  margin: 0;
}

.advisor-composer .xh-ai-composer-shell,
.advisor-composer .chat-input-container {
  width: 100%;
  max-width: 100%;
  border-radius: 22px;
  border: 1px solid rgba(167, 139, 250, 0.28);
  background:
    linear-gradient(180deg, rgba(28, 22, 52, 0.72), rgba(12, 14, 28, 0.88));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 0 32px rgba(124, 92, 215, 0.14),
    0 18px 40px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px) saturate(125%);
  -webkit-backdrop-filter: blur(16px) saturate(125%);
}

.advisor-composer .xh-ai-composer-shell:focus-within,
.advisor-composer .chat-input-container:focus-within {
  border-color: rgba(196, 181, 253, 0.48);
  box-shadow:
    0 0 0 1px rgba(196, 181, 253, 0.12) inset,
    0 0 36px rgba(139, 92, 246, 0.22),
    0 18px 40px rgba(0, 0, 0, 0.3);
}

.advisor-composer .composer-media-add {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 56px;
  min-height: 56px;
  border-radius: 14px;
  border: 1px dashed rgba(196, 181, 253, 0.35);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(237, 231, 255, 0.82);
}

.advisor-composer .composer-media-add-label {
  font-size: 10px;
  letter-spacing: 0.04em;
  color: rgba(221, 214, 254, 0.72);
}

.advisor-composer #advisorUserInput,
.advisor-composer .advisor-composer-input {
  width: 100%;
  resize: none;
  border: 0;
  outline: 0;
  color: #fff;
  background: transparent;
  font: inherit;
  font-size: 15px;
  line-height: 1.6;
  min-height: 56px;
}

.advisor-composer #advisorUserInput::placeholder,
.advisor-composer .advisor-composer-input::placeholder {
  color: rgba(236, 229, 255, 0.4);
}

.advisor-composer .toolbar-pill {
  border: 1px solid rgba(74, 222, 128, 0.2);
  background: rgba(16, 185, 129, 0.08);
}

.advisor-composer .xh-ai-composer-toolbar .input-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.advisor-composer .advisor-send-btn.btn-send-agent {
  min-width: 0;
  padding: 0;
  border-radius: 50%;
}

.advisor-composer .composer-action-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.advisor-composer .xh-charge-estimate-hint {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: rgba(148, 156, 176, 0.55);
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.advisor-composer .advisor-send-btn.btn-send-agent:disabled {
  cursor: wait;
  opacity: 0.6;
}

@media (max-width: 640px) {
  .advisor-messages {
    --xh-advisor-column: calc(100% - 24px);
    padding-top: 16px;
    gap: 16px;
  }
  .advisor-composer {
    width: calc(100% - 24px);
  }
  .advisor-empty-capabilities {
    grid-template-columns: 1fr;
  }
}

/* Advisor model menu — fixed overlay, independent from homepage provider storage */
#advisorModelPresetMenu.model-preset-menu {
  position: fixed;
  z-index: 9999;
  min-width: 220px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

#advisorModelPresetMenu.model-preset-menu.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

#advisorModelPresetMenu.model-preset-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 0;
  background: transparent;
  color: #fff;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

#advisorModelPresetMenu.model-preset-menu button:hover {
  background: rgba(255, 255, 255, 0.08);
}

#advisorModelPresetMenu.model-preset-menu .model-preset-check {
  display: none;
}

#advisorModelPresetMenu.model-preset-menu button.selected .model-preset-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

#main-viewport.is-advisor-view #secondary-page-mount,
#main-viewport.is-advisor-view #image-workspace-mount,
#main-viewport.is-advisor-view #video-workspace-mount {
  display: none;
}
