/* css\assistant.css */
:root {
  --assistant-width-expanded: calc(100vw / 5);
  --assistant-width-collapsed: calc(100vw / 5);
}

/* Light theme variables for assistant */
.light-theme .assistant-container {
  --assistant-bg-color: #ffffff;
  --assistant-border-color: #e5e7eb;
  --assistant-text-color: #374151;
}

/* Dark theme variables for assistant (default) */
body:not(.light-theme) .assistant-container {
  --assistant-bg-color: #1f2937;
  --assistant-border-color: #374151;
  --assistant-text-color: #d1d5db;
}

/* Main container */
.assistant-container {
  position: fixed;
  top: calc(
    var(--nona-header-height) + var(--nona-project-name-height)
  );
  width: var(--assistant-width-expanded);
  background: var(--assistant-bg-color, #fff);
  border-left: 1px solid var(--assistant-border-color, #e5e7eb);
  border-top: 1px solid var(--assistant-border-color, #e5e7eb);
  height: calc(
    100vh - var(--nona-header-height) - var(--nona-project-name-height)
  );
  padding-bottom: 26px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  z-index: 50;
  right: 0;
  margin-right: 0 !important;
  transition: width 0.3s ease;
  overflow: hidden;
}

/* Collapsed state */
.assistant-container.collapsed {
  width: var(--assistant-width-collapsed);
}

/* Toggle button */
.assistant-collapse-toggle {
  position: absolute;
  left: 8px;
  top: 8px;
  width: 24px;
  height: 24px;
  padding: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1;
  transition: transform 0.3s ease;
  color: var(--color-icon);
}

/* Content sections */
.assistant-sections {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

/* Transparent text display box at the top of assistant sections */
.spacer-text-box {
  display: none !important; /* 完全隐藏 spacer */
}

.guidance-section {
  height: calc(
    var(--assistant-total-height) * var(--guide-content-height) / 100
  );
  display: flex;
  flex-direction: column;
  margin-top: 0; /* 移除 spacer 后不需要上边距 */
  position: relative;
}

.guidance-section .section-header {
  height: var(--section-header-height);
  min-height: var(--section-header-height);
}

.guidance-section .section-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.assistant-section {
  height: calc(
    var(--assistant-total-height) * var(--assistant-content-height) / 100
  );
  display: flex;
  flex-direction: column;
}

.assistant-section .section-header {
  height: var(--section-header-height);
  min-height: var(--section-header-height);
}

.assistant-section .messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.chat-input-container {
  min-height: fit-content;
  padding: 16px;
  border-top: 1px solid #e5e7eb;
}

/* Section headers */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  /* background-color: #0d8cff; */
  color: white;
}

/* Style for title headers with transparent background and border */
.section-header.nona-nav-link {
  background-color: transparent !important;
  border: 1px solid #003681;
  border-radius: 8px;
  margin: 4px;
}

/* Style for icons in section headers */
.section-header.nona-nav-link .nav-icon svg,
.section-header.nona-nav-link .icon {
  fill: #003681 !important;
  stroke: #003681 !important;
  color: #003681 !important;
}

.section-title {
  /* font-family: 'Open Sans', sans-serif; */
  font-weight: 500;  /* Match guidance-section nav-text weight */
  font-size: 14px;   /* Explicitly set to 14px to match guidance-section nav-text */
  margin: 0;
}

/* Section content */
.section-content {
  padding: 16px 16px 16px 0;
  overflow-y: auto;
  height: calc(100% - 48px);
}

/* Chat input area */
.chat-input-container {
  padding: 8px 16px;
  border-top: 1px solid #e5e7eb;
  background: white;
}

.chat-input-wrapper {
  position: relative;
  width: 100%;
}

.chat-input {
  width: 100%;
  padding-right: 40px; /* 为发送按钮留出空间 */
}

.send-button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #666; /* 图标颜色 */
  transition: color 0.2s;
}

.send-button:hover {
  color: #000; /* 悬停时的颜色 */
}

@media screen and (max-width: 768px) {
  .assistant-container {
    width: 260px;
  }

  .assistant-container.collapsed {
    width: var(--assistant-width-collapsed);
  }
}

/* Animation effects */
.assistant-container {
  transition: width 0.3s ease, transform 0.3s ease;
}

.section-content {
  transition: opacity 0.2s ease;
}

/* Collapsed state modifications */
.assistant-container.collapsed .section-title,
.assistant-container.collapsed .section-content,
.assistant-container.collapsed .chat-input-container {
  display: none;
}

/* Message styles */
.message {
  margin: 8px 0;
  padding: 8px;
  border-radius: 4px;
}

.message.user {
  /* background: #f3f4f6; */
  background: rgb(242, 247, 248);
  margin-left: 20%;
}

.message.assistant {
  /* background: #e5e7eb; */
  background: rgb(240, 250, 253);
  margin-right: 20%;
}

.nav-text {
  flex-grow: 1;
  font-family: Arial, sans-serif !important;
  white-space: nowrap;
  color: #003681;
  font-size: var(--font-size-nav-text) !important;  /* Use centralized nav text font size */
  font-weight: var(--font-weight-nav-text);  /* Use centralized nav text font weight */
}

.nav-icon {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon {
  width: 16px;
  height: 16px;
  color: var(--color-icon);
}

.nav-item.active .icon {
  color: var(--color-active);
}

/* Website Guide Theme Classes */
.guidance-theme-default,
.guidance-theme-default .section-content {
  background-color: #ffffff !important;
  color: #002671 !important;
}

.guidance-theme-success,
.guidance-theme-success .section-content {
  background-color: #d1fae5 !important;
  color: #065f46 !important;
}

.guidance-theme-error,
.guidance-theme-error .section-content {
  background-color: #fee2e2 !important;
  color: #991b1b !important;
}

.guidance-theme-warning,
.guidance-theme-warning .section-content {
  background-color: #fef3c7 !important;
  color: #92400e !important;
}

.guidance-theme-info,
.guidance-theme-info .section-content {
  background-color: #dbeafe !important;
  color: #1e40af !important;
}

.guidance-theme-processing,
.guidance-theme-processing .section-content {
  background-color: #f3f4f6 !important;
  color: #374151 !important;
}

.guidance-theme-custom,
.guidance-theme-custom .section-content {
  /* Custom theme colors will be applied via style attribute */
}

/* Text elements within themed sections */
.guidance-theme-default .guidance-text,
.guidance-theme-success .guidance-text,
.guidance-theme-error .guidance-text,
.guidance-theme-warning .guidance-text,
.guidance-theme-info .guidance-text,
.guidance-theme-processing .guidance-text {
  color: inherit !important;
}

/* Ensure proper contrast and readability */
.guidance-theme-default .guidance-text { color: #002671 !important; }
.guidance-theme-success .guidance-text { color: #065f46 !important; }
.guidance-theme-error .guidance-text { color: #991b1b !important; }
.guidance-theme-warning .guidance-text { color: #92400e !important; }
.guidance-theme-info .guidance-text { color: #1e40af !important; }
.guidance-theme-processing .guidance-text { color: #374151 !important; }

/* White background send button with plane icon */
.assistant-send-button {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #ffffff;
  color: var(--text-label) !important;
  border: 1px solid var(--border-accent);
  border-radius: 8px;
  padding: 8px 12px;
  margin-left: 8px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.assistant-send-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  border-color: var(--border-interactive) !important;
}

.assistant-send-button svg {
  fill: var(--brand-primary);
  width: 16px;
  height: 16px;
}
