/* =============================================
   OpenAI ChatGPT 页面样式 · v2
   4个独立面板：新聊天、深度研究、图片生成、图片探索
   ============================================= */

/* ─── OpenAI 主布局 ───────────────────────────── */
.openai-panel {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
  margin: 0;
}

/* ─── 灵感页tab内部布局 ────────────────────────── */
#tab-inspiration {
  display: none;
  height: 100%;
  overflow: hidden;
}

#tab-inspiration.active {
  display: flex;
}

#tab-inspiration .oai-container {
  display: grid;
  grid-template-columns: 240px 1fr;
  flex: 1;
  overflow: hidden;
}

/* 右侧内容区（独立滚动，不影响侧边栏） */
.oai-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
}

/* ─── 左侧边栏 ───────────────────────────────── */
.oai-sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%; /* 约束高度，确保内部滚动独立 */
}

/* 模式切换区域（固定在顶部，不随历史列表滚动） */
.oai-sidebar-section:first-child {
  flex-shrink: 0;
  overflow: hidden;
}

/* 历史对话区域（独立滚动框，占满剩余空间） */
.oai-sidebar-section:last-child {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0; /* 关键：让 flex 子项可以正确收缩 */
}

.oai-sidebar-section:last-child .oai-conversation-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 2px; /* 给滚动条留空间 */
}

/* 小滚动条样式 */
.oai-conversation-list::-webkit-scrollbar {
  width: 4px;
}
.oai-conversation-list::-webkit-scrollbar-track {
  background: transparent;
}
.oai-conversation-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}
.oai-conversation-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.oai-new-chat-btn {
  width: 100%;
  padding: 10px 16px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  font-family: inherit;
}

.oai-new-chat-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

/* 模式切换 */
.oai-mode-list {
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.oai-mode-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text-sub);
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  font-family: inherit;
  text-align: left;
  width: 100%;
}

.oai-mode-item:hover {
  background: var(--bg3);
  color: var(--text);
}

.oai-mode-item.active {
  background: var(--accent-light);
  color: var(--accent);
}

.oai-mode-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  background: var(--bg3);
}

.oai-mode-item.active .oai-mode-icon {
  background: var(--accent);
  color: #fff;
}

.oai-mode-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.oai-mode-desc {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 对话历史 */
.oai-history-section {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  border-top: 1px solid var(--border);
}

.oai-history-section-title {
  font-size: 11px;
  color: var(--text-muted);
  padding: 8px 12px 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.oai-history-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.oai-history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-sub);
  font-size: 12px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
  font-family: inherit;
  text-align: left;
  width: 100%;
  position: relative;
}

.oai-history-item:hover {
  background: var(--bg3);
  color: var(--text);
}

.oai-history-item.active {
  background: var(--accent-light);
}

.oai-history-item.active .oai-history-item-title {
  color: var(--accent);
  font-weight: 600;
}

.oai-history-item-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.oai-history-item-content {
  flex: 1;
  min-width: 0;
}

.oai-history-item-title {
  font-size: 12px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.oai-history-item-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.oai-history-item-delete {
  display: none;
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg4, #e8e9eb);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  padding: 0;
  border-radius: 50%;
  flex-shrink: 0;
  z-index: 2;
  line-height: 1;
  width: 16px;
  height: 16px;
  text-align: center;
}

.oai-history-title {
  padding: 12px 12px 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.oai-history-title .oai-sidebar-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.oai-history-item:hover .oai-history-item-delete {
  display: block;
}

.oai-history-item-delete:hover {
  color: #fff;
  background: var(--red, #e74c3c);
}

/* 底部模型选择 */
.oai-sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.oai-model-select {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.oai-model-select:focus {
  outline: none;
  border-color: var(--accent);
}

.oai-model-select option {
  background: var(--bg2);
}

/* ─── 右侧内容区 ─────────────────────────────── */
.oai-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  position: relative;
}

/* 面板切换：只显示当前模式的面板 */
.oai-view {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.oai-view.active {
  display: flex;
}

/* ─── 顶部标题栏 ─────────────────────────────── */
.oai-chat-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.oai-chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.oai-chat-header-icon {
  font-size: 18px;
}

.oai-chat-header-title {
  font-size: 15px;
  font-weight: 600;
}

.oai-chat-header-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.oai-chat-header-model {
  font-size: 11px;
  padding: 3px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-sub);
}

/* ─── 消息列表 ───────────────────────────────── */
.oai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.oai-messages-scroll {
  max-width: 768px;
  margin: 0 auto;
  padding: 24px 20px 32px;
}

/* 空状态 */
.oai-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  text-align: center;
}

.oai-empty-icon {
  font-size: 56px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.oai-empty-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.oai-empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
  max-width: 400px;
  line-height: 1.6;
}

/* 快捷提示词 */
.oai-quick-prompts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-width: 500px;
  width: 100%;
}

.oai-quick-prompt {
  padding: 14px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-sub);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  text-align: left;
  line-height: 1.5;
}

.oai-quick-prompt:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-light);
}

.oai-quick-prompt-icon {
  font-size: 18px;
  margin-bottom: 6px;
  display: block;
}

/* 单条消息 */
.oai-message {
  margin-bottom: 28px;
  animation: oaiMsgIn 0.3s ease;
}

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

.oai-message-role {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.oai-message-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  background: var(--bg3);
}

.oai-message-avatar.user {
  background: var(--accent-light);
}

.oai-message-name {
  font-size: 13px;
  font-weight: 600;
}

.oai-message-time {
  font-size: 11px;
  color: var(--text-muted);
}

.oai-message-body {
  padding-left: 40px;
  font-size: 14.5px;
  line-height: 1.55;
  word-break: break-word;
  color: var(--text);
}

.oai-message-body p {
  margin-bottom: 1px;
  line-height: 1.5;
}

/* 段落之间只有小间距 */
.oai-message-body p + p {
  margin-top: 2px;
}

.oai-message-body code {
  background: var(--bg3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
}

.oai-message-body pre {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  overflow-x: auto;
  margin: 8px 0;
  font-size: 13px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  line-height: 1.5;
}

.oai-message-body ul, .oai-message-body ol {
  padding-left: 22px;
  margin: 6px 0 8px;
}

.oai-message-body li {
  margin-bottom: 2px;
  line-height: 1.5;
}

/* 消息中的图片 */
.oai-message-image {
  max-width: 400px;
  max-height: 400px;
  border-radius: var(--radius-sm);
  margin: 8px 0;
  cursor: zoom-in;
  transition: transform 0.2s;
}

.oai-message-image:hover {
  transform: scale(1.02);
}

/* 消息中的文件标签 */
.oai-message-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 8px 0;
  font-size: 13px;
  color: var(--text-sub);
}

/* 消息操作栏 */
.oai-message-actions {
  display: flex;
  gap: 6px;
  padding-left: 40px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}

.oai-message:hover .oai-message-actions {
  opacity: 1;
}

.oai-msg-action-btn {
  padding: 4px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.oai-msg-action-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

/* 搜索来源 */
.oai-sources {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.oai-sources-title {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.oai-sources-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.oai-source-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  overflow: hidden;
  transition: color 0.15s;
}

.oai-source-item:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.oai-source-item-favicon {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background: var(--bg3);
  flex-shrink: 0;
}

.oai-source-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 打字指示器 */
.oai-typing {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 40px;
  color: var(--text-muted);
  font-size: 12px;
}

.oai-typing-dots {
  display: flex;
  gap: 3px;
}

.oai-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: oaiDotPulse 1.2s ease-in-out infinite;
}

.oai-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.oai-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes oaiDotPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ═══ 图片生成面板 ═════════════════════════════ */
.oai-img-gen-toolbar {
  padding: 16px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}

.oai-img-gen-toolbar-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.oai-img-gen-opt {
  display: flex;
  align-items: center;
  gap: 6px;
}

.oai-img-gen-opt-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.oai-img-gen-opt select {
  padding: 6px 24px 6px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}

.oai-img-gen-opt select:focus {
  outline: none;
  border-color: var(--accent);
}

.oai-img-gen-opt select option {
  background: var(--bg2);
}

/* 风格标签 */
.oai-img-gen-style-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.oai-img-gen-tag {
  padding: 5px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-sub);
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.oai-img-gen-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* 生成记录 */
.oai-img-gen-history {
  padding: 16px 20px;
}

.oai-img-gen-history-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 12px;
}

.oai-img-gen-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.oai-img-gen-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: all 0.2s;
  background: var(--bg2);
}

.oai-img-gen-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.oai-img-gen-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.oai-img-gen-card-info {
  padding: 8px 10px;
}

.oai-img-gen-card-prompt {
  font-size: 11px;
  color: var(--text-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}

.oai-img-gen-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.oai-img-gen-card-model {
  font-size: 10px;
  color: var(--text-muted);
}

.oai-img-gen-card-actions {
  display: flex;
  gap: 4px;
}

.oai-img-gen-card-btn {
  padding: 2px 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.oai-img-gen-card-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* 消息中生成的图片 */
.oai-gen-images {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 0;
}

.oai-gen-image-wrap {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  max-width: 512px;
}

.oai-gen-image {
  max-width: 512px;
  display: block;
  cursor: zoom-in;
}

.oai-gen-image-actions {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}

.oai-gen-image-wrap:hover .oai-gen-image-actions {
  opacity: 1;
}

.oai-gen-action-btn {
  padding: 6px 12px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.oai-gen-action-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
}

/* ═══ 图片探索面板 ═════════════════════════════ */
.oai-explore-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  flex: 1;
}

.oai-explore-dropzone {
  width: 100%;
  max-width: 500px;
  min-height: 260px;
  border: 2px dashed var(--border);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  background: var(--bg2);
}

.oai-explore-dropzone:hover,
.oai-explore-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.oai-explore-dropzone.has-image {
  border-style: solid;
  border-color: var(--accent);
  min-height: auto;
}

.oai-explore-dropzone-content {
  text-align: center;
  padding: 40px 20px;
}

.oai-explore-dropzone-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.oai-explore-dropzone-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.oai-explore-dropzone-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.oai-explore-dropzone-formats {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.oai-explore-format {
  padding: 3px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 10px;
  color: var(--text-muted);
}

.oai-explore-preview-img {
  max-width: 100%;
  max-height: 360px;
  border-radius: 12px;
  object-fit: contain;
}

.oai-explore-remove-img {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(100,100,100,0.6);
  backdrop-filter: blur(8px);
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  z-index: 2;
}

.oai-explore-remove-img:hover {
  background: #ef4444;
  transform: scale(1.1);
}

/* 分析快捷入口 */
.oai-explore-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 500px;
  width: 100%;
  margin-top: 16px;
}

.oai-explore-action {
  padding: 14px 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-sub);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.oai-explore-action:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.oai-explore-action-icon {
  font-size: 16px;
}

/* ─── 输入区域 ─────────────────────────────────── */
.oai-input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.oai-input-inner {
  max-width: 768px;
  margin: 0 auto;
}

.oai-input-preview {
  display: flex;
  gap: 8px;
  padding: 8px 0 0;
  flex-wrap: wrap;
}

.oai-input-preview-item {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.oai-input-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.oai-input-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: none;
  background: rgba(100,100,100,0.5);
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.oai-input-preview-remove:hover {
  background: var(--red);
}

.oai-input-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  transition: border-color 0.2s;
}

.oai-input-box:focus-within {
  border-color: var(--accent);
}

.oai-input-box textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  resize: none;
  outline: none;
  max-height: 150px;
  min-height: 24px;
}

.oai-input-box textarea::placeholder {
  color: var(--text-muted);
}

.oai-send-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  font-family: inherit;
}

.oai-send-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.oai-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.oai-send-btn.stop-btn {
  background: var(--red);
}

.oai-send-btn.stop-btn:hover {
  background: #dc2626;
}

/* 图片上传按钮（输入框内） */
.oai-input-upload-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.oai-input-upload-btn:hover {
  background: var(--bg3);
  color: var(--text);
}

.oai-input-upload-btn.hidden {
  display: none;
}

/* 上传按钮（新版） */
.oai-upload-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.oai-upload-btn:hover {
  background: var(--bg3);
  color: var(--text);
}

/* 附件预览区域 */
.oai-attachment-preview {
  padding: 8px 12px;
  margin-bottom: 8px;
  background: var(--bg3);
  border-radius: 8px;
  display: none;
  align-items: center;
  gap: 12px;
}

.oai-attachment-preview.has-attachment {
  display: flex;
}

.oai-attachment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg2);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
}

.oai-attachment-item img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
}

.oai-attachment-item .file-icon {
  font-size: 20px;
}

.oai-attachment-item .file-name {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.oai-attachment-item .remove-btn {
  margin-left: 4px;
  padding: 2px 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  border-radius: 4px;
}

.oai-attachment-item .remove-btn:hover {
  background: var(--bg3);
  color: var(--red);
}

.oai-input-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* 搜索模式标识条 */
.oai-search-badge-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 8px;
}

.oai-search-badge {
  padding: 3px 10px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 12px;
  color: #22c55e;
  font-size: 11px;
  font-weight: 500;
}

.oai-search-badge-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* 未配置 API Key 提示 */
.oai-not-configured {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
}

.oai-not-configured-icon {
  font-size: 56px;
  margin-bottom: 20px;
  opacity: 0.4;
}

.oai-not-configured-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.oai-not-configured-desc {
  font-size: 13px;
  color: var(--text-sub);
  max-width: 400px;
  line-height: 1.6;
  margin-bottom: 20px;
}

.oai-not-configured code {
  background: var(--bg3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--accent);
}

/* ─── Markdown 消息样式 ───────────────────────── */
.oai-msg-bold { font-weight: 700; }
.oai-msg-italic { font-style: italic; }
.oai-msg-link { color: var(--accent); text-decoration: underline; cursor: pointer; }
.oai-msg-h3 { font-size: 16px; font-weight: 700; margin: 12px 0 6px; }
.oai-msg-blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  color: var(--text-sub);
  margin: 8px 0;
}

/* ─── 响应式 ───────────────────────────────────── */
@media (max-width: 900px) {
  .openai-panel {
    grid-template-columns: 1fr;
  }

  .oai-sidebar {
    display: none;
  }

  .oai-chat-header {
    display: none;
  }

  .oai-quick-prompts {
    grid-template-columns: 1fr;
  }

  .oai-img-gen-toolbar-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .oai-explore-quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .oai-input-area {
    padding: 12px;
  }
}
