/* ============================================================
   Landing Page AI 工厂 — 蓝色商务主题 CSS 覆盖
   Flex 布局：sidebar + workspace(preview + chat)
   ============================================================ */


:root {
  --lp-primary: #0076FE;
  --lp-primary-dark: #2563eb;
  --lp-primary-deeper: #1e40af;
  --lp-bg: #ffffff;
  --lp-sidebar-bg: #ffffff;
  --lp-sidebar-hover: #f1f5f9;
  --lp-text: #0f172a;
  --lp-text-secondary: #64748b;
  --lp-border: #e2e8f0;
  --lp-radius: 12px;
  --lp-font: Roboto, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Arial, sans-serif;
  --lp-sidebar-width: 300px;
  --lp-header-height: 68px;
}

/* ── 隐藏 Chainlit 原生元素 ──────────────────────────────── */
.disclaimer,
[data-testid="disclaimer"],
#readme-button {
  display: none !important;
}


/* ── 强制浅色主题 ────────────────────────────────────────── */
html[data-theme="dark"],
html.dark,
html {
  color-scheme: light !important;
  --bg-primary: #ffffff !important;
  --bg-secondary: #ffffff !important;
  --bg-tertiary: #ffffff !important;
  --text-primary: #0f172a !important;
  --text-secondary: #64748b !important;
  --border-primary: #e2e8f0 !important;
  --accent: 220 14% 91% !important;
  --card: 0 0% 100% !important;
  --popover: 0 0% 100% !important;
  --muted: 220 14% 91% !important;
  --muted-foreground: 215 16% 47% !important;
  --input: 214 32% 91% !important;
  --ring: 221 83% 53% !important;
  --primary: 221 83% 53% !important;
  --secondary: 220 14% 91% !important;
  --destructive: 0 84% 60% !important;
  --foreground: 222 47% 11% !important;
  --border: 214 32% 91% !important;
}

/* ── 全局基础 ─────────────────────────────────────────────── */
html, body {
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  font-family: var(--lp-font) !important;
  background: var(--lp-bg) !important;
  color: var(--lp-text) !important;
}

/* ── 主应用容器：flex 水平布局 ──────────────────────────── */
#lp-app {
  display: flex;
  height: calc(100vh - 20px);
  width: 100vw;
  overflow: hidden;
}

/* ── 侧边栏 ──────────────────────────────────────────────── */
#lp-sidebar {
  width: var(--lp-sidebar-width, 300px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--lp-sidebar-bg, #ffffff);
  border-right: 1px solid var(--lp-border, #e2e8f0);
  overflow: hidden;
  transition: width 0.3s ease;
  z-index: 100;
}
/* 侧边栏收起：宽度变 0，flex 自动填充 */
body.lp-sidebar-collapsed #lp-sidebar {
  width: 0;
  border-right: none;
}

/* ── 主内容区 ────────────────────────────────────────────── */
#lp-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ── 系统顶栏 ────────────────────────────────────────────── */
#lp-header {
  height: var(--lp-header-height, 68px);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 24px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--lp-border);
  z-index: 99;
  font-family: var(--lp-font);
}

.lp-header-logo {
  height: 28px;
  width: auto;
  flex-shrink: 0;
  vertical-align: middle;
}

.lp-header-actions {
  margin-left: auto;
}

/* Feedback button — white outlined */
.lp-header-btn-outline {
  width: 113px;
  height: 36px;
  gap: 8px;
  padding-right: 12px;
  padding-left: 12px;
  border-radius: 8px;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  color: #333;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--lp-font);
  display: flex;
  align-items: center;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}

.lp-header-btn-outline:hover {
  background: #F5F5F7;
}

/* 11.png style: blue gradient primary button */
.lp-header-btn-primary {
  width: 107px;
  height: 36px;
  gap: 8px;
  padding-right: 12px;
  padding-left: 12px;
  border-radius: 8px;
  background: linear-gradient(97.64deg, #46D7E8 -11.45%, #3B82F6 25.61%, #6C63FF 103.55%);
  color: #fff;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--lp-font);
  display: flex;
  align-items: center;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}

.lp-header-btn-primary:hover {
  opacity: 0.9;
}

/* Button icon */
.lp-btn-icon {
  flex-shrink: 0;
}

/* Avatar clickable for logout */
.lp-user-avatar {
  cursor: pointer;
}

/* ── 工作区：preview + chat 水平 flex ───────────────────── */
#lp-workspace {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* ── 预览区域（始终存在） ────────────────────────────────── */
#lp-preview-area {
  flex: 4;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  overflow: hidden;
  position: relative;
}
/* 预览区域标题栏 */
#lp-preview-toolbar {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: #ffffff;
  border-bottom: 1px solid var(--lp-border);
  flex-shrink: 0;
  gap: 8px;
}
/* 预览内容 */
#lp-preview-content {
  flex: 1;
  position: relative;
  overflow: auto;
  background: #f1f5f9;
}
/* 预览 iframe */
#lp-preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
}
/* 空状态占位 */
#lp-preview-skeleton {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: white;
  z-index: 4;
}

/* Upload zone inside skeleton */
#lp-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  padding: 40px;
  border: 2px dashed transparent;
  border-radius: 12px;
  transition: border-color 0.2s, background 0.2s;
}
#lp-upload-zone.lp-drag-over {
  border-color: var(--lp-primary);
  background: rgba(0,118,254,0.04);
}
#lp-upload-img {
  opacity: 0.85;
  user-select: none;
  pointer-events: none;
}
.lp-upload-text {
  font-size: 14px;
  color: var(--lp-text-secondary);
  text-align: center;
  line-height: 1.6;
  max-width: 320px;
  font-family: var(--lp-font);
}
#lp-upload-text-1 {
  font-size: 15px;
  font-weight: 500;
}
#lp-upload-text-2 {
  font-size: 13px;
  color: #94a3b8;
}

/* 手机模式模拟器框架 */
#lp-preview-content.lp-mobile-mode {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  background: #f1f5f9;
}
/* Phone emulator wrapper — created by JS when mobile mode activates */
#lp-phone-frame {
  width: 393px;
  height: 852px;
  margin: 20px auto;
  background: #000;
  border-radius: 44px;
  padding: 12px 12px 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.08) inset;
  position: relative;
  overflow: hidden;
}
/* Notch */
#lp-phone-frame::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 26px;
  background: #000;
  border-radius: 0 0 16px 16px;
  z-index: 10;
}
/* Home indicator */
#lp-phone-frame::after {
  content: '';
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 4px;
  background: #333;
  border-radius: 2px;
  z-index: 10;
}
#lp-preview-content.lp-mobile-mode #lp-preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 32px;
}
#lp-preview-content:not(.lp-mobile-mode) #lp-preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ── 拖拽分割线 ──────────────────────────────────────────── */
#lp-drag-divider {
  width: 6px;
  cursor: col-resize;
  flex-shrink: 0;
  background: transparent;
  transition: background 0.15s;
  z-index: 10;
}
#lp-drag-divider:hover,
#lp-drag-divider.lp-drag-active {
  background: var(--lp-primary);
}

/* ── 聊天区域 ────────────────────────────────────────────── */
#lp-chat-area {
  flex: 3;
  min-width: 280px;
  position: relative;
  overflow: hidden;
  background: #F5F5F7;
}

/* Chainlit #root 填满聊天区域（绝对定位，撑满 #lp-chat-area） */
#root {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  min-width: 0 !important;
  z-index: 1 !important;
  color-scheme: light !important;
  background: #F5F5F7 !important;
}

/* React 挂载点：设定高度锚点，让 Chainlit 内部的 h-full 能正确解析 */
#root > div {
  height: 100% !important;
  background: #F5F5F7 !important;
}

/* ── Chainlit 内部颜色覆盖（强制浅色） ───────────────────── */
#root,
[data-theme="dark"] #root,
#root[data-theme="dark"],
html[data-theme="dark"] #root,
html.dark #root {
  --bg-primary: #F5F5F7 !important;
  --bg-secondary: #F5F5F7 !important;
  --bg-tertiary: #ffffff !important;
  --text-primary: #0f172a !important;
  --text-secondary: #64748b !important;
  --border-primary: #e2e8f0 !important;
  --accent: 220 14% 91% !important;
  --card: 0 0% 100% !important;
  --popover: 0 0% 100% !important;
  --muted: 220 14% 91% !important;
  --muted-foreground: 215 16% 47% !important;
  --input: 214 32% 91% !important;
  --ring: 221 83% 53% !important;
  --primary: 221 83% 53% !important;
  --secondary: 220 14% 91% !important;
  --destructive: 0 84% 60% !important;
  --foreground: 222 47% 11% !important;
  --border: 214 32% 91% !important;
  color-scheme: light !important;
}

/* 隐藏 Chainlit 原生顶栏 */
#root header,
#root #header {
  display: none !important;
}

/* 聊天输入区域样式覆盖 */
#root textarea[data-testid="chat-input"],
#root textarea[placeholder] {
  font-family: var(--lp-font) !important;
  border-radius: var(--lp-radius) !important;
  background: transparent !important;
  color: #0f172a !important;
}

/* 输入框容器 — Chainlit 2.x: #message-composer */
#root #message-composer {
  background: #ffffff !important;
}

/* 发送按钮 — Chainlit 2.x: #chat-submit */
#root #chat-submit {
  background: #4F6BFF !important;
}
#root #chat-submit:hover {
  background: #3D55E0 !important;
}

/* ── Mobile 标签栏（桌面隐藏） ──────────────────────────── */
#lp-mobile-tabs {
  display: none;
  height: 44px;
  flex-shrink: 0;
  background: #ffffff;
  border-top: 1px solid var(--lp-border);
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0 16px;
}
.lp-tab {
  flex: 1;
  height: 44px;
  border: none;
  background: transparent;
  font-family: var(--lp-font);
  font-size: 14px;
  font-weight: 600;
  color: var(--lp-text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.lp-tab.lp-tab-active {
  color: var(--lp-primary);
  border-bottom-color: var(--lp-primary);
}
.lp-tab:hover:not(.lp-tab-active) {
  color: var(--lp-text);
}

.lp-open-btn {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  color: var(--lp-text-secondary);
  width: 36px; height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  box-sizing: border-box;
}
.lp-open-btn:hover {
  background: #F5F5F7;
  color: var(--lp-text);
}

/* 预览工具按钮区 */
.lp-preview-tools {
  display: flex;
  gap: 8px;
  background: #F5F5F7;
  border-radius: 8px;
  padding: 4px;
  flex-shrink: 0;
}
.lp-preview-tool-btn {
  width: 30px;
  height: 30px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  background: #F5F5F7;
  color: var(--lp-text-secondary);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.lp-preview-tool-btn:hover {
  background: #E5E7EB;
}

.lp-preview-tool-btn.lp-tool-active {
  background: #FFFFFF;
  color: var(--lp-text);
  border: none;
  box-shadow: 0px 1px 2px 0px #090A141A;
}

.lp-preview-tool-btn.lp-tool-active:hover {
  background: #E5E7EB;
}

/* ── 响应式：移动端 (<1030px) ──────────────────────────── */
@media (max-width: 1029px) {
  /* 侧边栏变成固定抽屉 */
  #lp-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--lp-sidebar-width, 300px) !important;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
  }
  body.lp-sidebar-open #lp-sidebar {
    transform: translateX(0);
  }
  /* 移除收起状态下 width:0 的规则，由 transform 控制 */
  body.lp-sidebar-collapsed #lp-sidebar {
    width: var(--lp-sidebar-width, 300px) !important;
    border-right: 1px solid var(--lp-border);
  }

  /* 隐藏拖拽分割线 */
  #lp-drag-divider {
    display: none;
  }

  /* 强制覆盖拖拽分割线设置的 inline style（防止桌面端拖拽宽度残留） */
  #lp-preview-area {
    flex: 1 !important;
    width: auto !important;
    min-width: 0 !important;
  }
  #lp-chat-area {
    flex: 1 !important;
    width: auto !important;
    min-width: 0 !important;
  }

  /* 工作区切换：预览/聊天互斥 */
  #lp-workspace.lp-show-chat #lp-preview-area {
    display: none !important;
  }
  #lp-workspace.lp-show-preview #lp-chat-area {
    display: none !important;
  }

  /* 显示 Mobile 标签栏 */
  #lp-mobile-tabs {
    display: flex;
  }

  /* 侧边栏遮罩 */
  #lp-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 999;
  }
  body.lp-sidebar-open #lp-sidebar-overlay {
    display: block;
  }
}

/* ── 侧边栏遮罩（桌面不需要，移动端由 JS 创建） ──────── */
#lp-sidebar-overlay {
  display: none;
}

/* ── 加载遮罩 ────────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #0076FE 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 999999;
  font-family: var(--lp-font);
}
.loading-overlay .lp-generating-spinner {
  width: 44px; height: 44px;
}
.loading-overlay .text {
  margin-top: 20px;
  color: rgba(255,255,255,0.9);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.5px;
}
/* Hide loading overlay when layout is ready */
body.lp-ready .loading-overlay {
  display: none !important;
}

/* Hide Chainlit's own connection/loading overlay */
#root [class*="loading"],
#root [class*="connection-overlay"],
#root [class*="backdrop"],
#root [class*="overlay"][class*="fixed"],
#root .st-loading,
#root .connection-status {
  display: none !important;
}

/* ── 隐藏 p-4 pt-0 wrapper（高度归零，保留文件 input） ──── */
#root [class*="p-4"][class*="pt-0"][class*="mx-auto"],
#root .flex.flex-col.mx-auto.w-full.p-4.pt-0 {
  position: relative !important;
  height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  transform: none !important;
  left: -9999px !important;
}


/* ── Visual Editor Toolbar ───────────────────────────────── */
#lp-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #fefce8;
  border-bottom: 1px solid #fde68a;
  flex-shrink: 0;
  gap: 8px;
  font-family: var(--lp-font);
  flex-wrap: wrap;
}
.lp-editor-toolbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.lp-editor-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.lp-editor-label {
  font-size: 11px;
  color: #92400e;
  font-weight: 500;
}
.lp-color-picker-wrap {
  position: relative;
  display: inline-flex;
}
.lp-color-btn {
  width: 24px;
  height: 24px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  padding: 2px;
  background: #fff;
}
.lp-color-btn:hover {
  border-color: #9ca3af;
}
.lp-color-btn-inner {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 2px;
  position: relative;
}
.lp-color-btn-inner.lp-color-btn-none {
  background: repeating-linear-gradient(
    45deg,
    #f3f4f6,
    #f3f4f6 3px,
    #e5e7eb 3px,
    #e5e7eb 6px
  ) !important;
}
.lp-color-btn-inner.lp-color-btn-none::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, transparent 47%, #ef4444 47%, #ef4444 53%, transparent 53%);
  border-radius: 2px;
}
.lp-color-palette {
  display: none;
  position: absolute;
  top: 30px;
  left: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 8px;
  z-index: 1000;
}
.lp-palette-open {
  display: block;
}
.lp-custom-picker {
  user-select: none;
}
.lp-cp-sv-area {
  position: relative;
  width: 200px;
  height: 150px;
  margin-bottom: 8px;
  cursor: crosshair;
  border-radius: 4px;
  overflow: hidden;
}
.lp-cp-sv-canvas {
  display: block;
  border-radius: 4px;
}
.lp-cp-sv-cursor {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.3), 0 0 4px rgba(0,0,0,0.3);
  pointer-events: none;
  transform: translate(-50%, -50%);
  top: 0;
  left: 0;
}
.lp-cp-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.lp-cp-hue-area {
  position: relative;
  flex: 1;
  height: 14px;
  cursor: pointer;
  border-radius: 7px;
}
.lp-cp-hue-track {
  width: 100%;
  height: 100%;
  border-radius: 7px;
  background: linear-gradient(to right, #f00 0%, #ff8000 8%, #ff0 17%, #80ff00 25%, #0f0 33%, #00ff80 42%, #0ff 50%, #0080ff 58%, #00f 67%, #8000ff 75%, #f0f 83%, #ff0080 92%, #f00 100%);
}
.lp-cp-hue-thumb {
  position: absolute;
  top: -3px;
  width: 10px;
  height: 20px;
  border: 2px solid #fff;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.3);
  pointer-events: none;
  transform: translateX(-50%);
  left: 0;
}
.lp-cp-preview-swatch {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  flex-shrink: 0;
}
.lp-cp-hex-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.lp-cp-hex-label {
  font-size: 12px;
  color: #9ca3af;
  font-weight: 600;
  flex-shrink: 0;
}
.lp-cp-hex-input {
  flex: 1;
  height: 24px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
  font-family: Roboto, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Arial, sans-serif;
  color: #374151;
  outline: none;
  box-sizing: border-box;
}
.lp-cp-hex-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}
.lp-swatch-group-disabled {
  opacity: 0.35;
  pointer-events: none;
  cursor: not-allowed;
}
.lp-cp-none-row {
  margin-top: 6px;
}
.lp-cp-none-btn {
  width: 100%;
  height: 22px;
  border: 1px dashed #d1d5db;
  border-radius: 4px;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.03) 3px,
    rgba(0,0,0,0.03) 6px
  );
  color: #9ca3af;
  font-size: 11px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.lp-cp-none-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
}
.lp-editor-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--lp-font);
  transition: all 0.15s;
}
.lp-editor-action-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}
.lp-editor-status {
  font-size: 11px;
  color: #92400e;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lp-editor-save-btn {
  padding: 4px 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #e5e7eb;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 600;
  cursor: not-allowed;
  font-family: var(--lp-font);
  transition: all 0.15s;
}
.lp-editor-save-btn-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  cursor: pointer;
}
.lp-editor-save-btn-active:hover {
  background: #1d4ed8;
}
.lp-editor-cancel-btn {
  padding: 4px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #6b7280;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--lp-font);
  transition: all 0.15s;
}
.lp-editor-cancel-btn:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #ef4444;
}

/* ── 可视化编辑保存遮罩 ────────────────────────────────────── */
.lp-editor-save-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 10;
  pointer-events: all;
}
.lp-editor-save-overlay .lp-save-spinner {
  width: 40px; height: 40px;
}
.lp-editor-save-overlay .lp-save-text {
  font-size: 14px;
  color: #4b5563;
  font-weight: 500;
  font-family: var(--lp-font);
}

/* ═══════════════════════════════════════════════════════════════
   测试布局：隐藏侧栏 + 汉堡按钮，主区全宽
   ═══════════════════════════════════════════════════════════════ */
#lp-sidebar {
  display: none !important;
  width: 0 !important;
  flex-shrink: 0 !important;
}

#lp-hamburger {
  display: none !important;
}

/* 隐藏 Chainlit 顶栏工具栏按钮（汉堡旁边的） */
button.inline-flex.items-center.justify-center.gap-2.whitespace-nowrap.rounded-md {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════════
   按钮布局调整
   ═══════════════════════════════════════════════════════════════ */
/* 隐藏联系人和可视化编辑按钮 */
#lp-contact-btn,
#lp-visual-edit-btn {
  display: none !important;
}

/* 分享按钮（已移入 toolbar，继承 lp-open-btn 样式，SVG 尺寸由行内属性控制） */

/* ═══════════════════════════════════════════════════════════════
   分享面板
   ═══════════════════════════════════════════════════════════════ */

/* 面板容器 — 默认隐藏，lp-share-open 时显示 */
#lp-share-panel {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  align-items: center;
  justify-content: center;
}
#lp-share-panel.lp-share-open {
  display: flex;
}

/* 半透明遮罩 */
#lp-share-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: lp-share-fade-in 0.2s ease;
}
@keyframes lp-share-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* 卡片本体 */
#lp-share-card {
  position: relative;
  width: 480px;
  height: 498px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.06);
  padding: 32px;
  animation: lp-share-slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--lp-font);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}
@keyframes lp-share-slide-up {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── 卡片头部 ── */
.lp-share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.lp-share-title {
  font-size: 20px;
  font-weight: 600;
  color: #333940;
  white-space: nowrap;
  font-family: Roboto, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Arial, sans-serif;
}
.lp-share-close {
  width: 28px;
  height: 28px;
  border: none;
  background: #ffffff;
  color: #999999;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
  line-height: 1;
}
.lp-share-close:hover {
  background: #E5E7EB;
  color: #333333;
}

/* AI Chatbot Link 标签 */
.lp-share-body-label {
  font-family: Roboto, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Arial, sans-serif;
  font-weight: 500;
  font-size: 14px;
  line-height: 22px;
  letter-spacing: 0.005em;
  color: #333333;
  margin-bottom: 8px;
}

/* ── 链接行容器（URL row + Open btn 并排） ── */
.lp-share-link-row-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

/* ── 链接行（灰色条，包含 icon + URL + Copy） ── */
.lp-share-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  height: 36px;
  background: #F5F5F7;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 0 8px 0 12px;
  box-sizing: border-box;
}
.lp-share-url-row svg {
  flex-shrink: 0;
}
#lp-share-url-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: #333333;
  font-family: Roboto, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Arial, sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  outline: none;
  padding: 0;
  min-width: 0;
}
.lp-share-copy-btn {
  display: flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  background: #F5F5F7;
  color: #333333;
  border: none;
  border-radius: 6px;
  font-family: Roboto, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Arial, sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 22px;
  letter-spacing: 0.005em;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s;
}
.lp-share-copy-btn:hover {
  color: #4F6BFF;
}

/* Open 按钮 */
.lp-share-open-btn {
  width: 68px;
  height: 36px;
  padding: 6px 16px;
  border: none;
  background: #4F6BFF;
  color: #FFFFFF;
  border-radius: 8px;
  font-family: Roboto, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Arial, sans-serif;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-sizing: border-box;
  transition: background 0.15s;
}
.lp-share-open-btn:hover {
  background: #3D57F5;
}

/* QR 描述文字 */
.lp-share-qr-label {
  font-family: Roboto, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Arial, sans-serif;
  font-weight: 500;
  font-size: 14px;
  line-height: 22px;
  letter-spacing: 0.005em;
  color: #333333;
  text-align: left;
  margin-bottom: -8px;
  position: relative;
  z-index: 1;
}

/* QR + 下载容器 */
.lp-share-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 416px;
  height: 194px;
  background: #F5F5F7;
  border-radius: 12px;
  box-sizing: border-box;
}

/* ── 二维码 ── */
#lp-share-qr {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 8px;
  padding: 12px;
}
#lp-share-qr img,
#lp-share-qr canvas {
  width: 120px;
  height: 120px;
  display: block;
}

/* 下载按钮 */
.lp-share-download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 114px;
  height: 36px;
  padding: 0 12px;
  background: #FFFFFF;
  color: #333333;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: Roboto, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Arial, sans-serif;
  transition: all 0.15s;
}
.lp-share-download-btn:hover {
  background: #F5F5F7;
}

/* ── 社交分享行（水平左对齐，Y=424） ── */
.lp-share-social-row {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin-top: auto;
}
.lp-share-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
  font-family: Roboto, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Arial, sans-serif;
}
.lp-share-social-btn:hover {
  transform: translateY(-2px);
}

/* 平台图标（品牌色圆角方块 42x42） */
/* ── 工具栏按钮禁用态 ── */
.lp-toolbar-btn-disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}

/* ── 编辑按钮状态 ── */
.lp-edit-btn {
  display: inline-flex;
  align-items: center;
  width: 120px;
  height: 36px;
  gap: 8px;
  padding-right: 12px;
  padding-left: 12px;
  border-radius: 8px;
  background: #F5F5F7;
  font-family: Roboto, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Arial, sans-serif;
  font-weight: 400;
  font-size: 13px;
  line-height: 22px;
  color: #333333;
  cursor: pointer;
  transition: all 0.15s;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

.lp-edit-btn:hover {
  background: #E5E7EB;
}

/* Pick-from-page button (replaces edit-btn when picker active) */
#lp-pick-btn {
  width: 162px;
  color: #4F6BFF;
}

#lp-pick-btn svg {
  stroke: #4F6BFF;
}

.lp-pick-active {
  background: #EFEFFF;
  color: #4F6BFF;
  border: none !important;
}
.lp-pick-active:hover {
  background: #EFEFFF;
}

.lp-edit-inactive {
  background: #F5F5F7;
  color: #333333;
  border: none !important;
}
.lp-edit-inactive:hover {
  background: #E5E7EB;
}

/* ═══════════════════════════════════════════════════════════════
   Welcome Mode（无项目）：聊天区隐藏，预览区 100%
   ═══════════════════════════════════════════════════════════════ */
body.lp-welcome-mode #lp-chat-area {
  display: none !important;
}
body.lp-welcome-mode #lp-preview-area {
  flex: 1 !important;
  width: 100% !important;
  min-width: 0 !important;
}
body.lp-welcome-mode #lp-drag-divider {
  display: none !important;
}
body.lp-welcome-mode #lp-mobile-tabs {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════════
   上传遮罩（Uploading Overlay）
   ═══════════════════════════════════════════════════════════════ */
#lp-uploading-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  z-index: 6;
  gap: 16px;
  font-family: var(--lp-font);
}
#lp-uploading-overlay .lp-generating-spinner {
  width: 40px;
  height: 40px;
}
#lp-uploading-overlay .lp-uploading-text {
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
}
#lp-uploading-overlay .lp-uploading-sub {
  font-size: 13px;
  color: #94a3b8;
}

/* ═══════════════════════════════════════════════════════════════
   Toast 错误变体（红色背景 + 顶部定位）
   ═══════════════════════════════════════════════════════════════ */
.lp-toast.lp-toast-error {
  background: rgba(220, 38, 38, 0.92) !important;
  bottom: auto !important;
  top: 100px !important;
}

/* Ensure Chainlit upload button is always visible */
#upload-button {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  color: #64748b !important;
  opacity: 1 !important;
  display: inline-flex !important;
  flex-shrink: 0 !important;
}
#upload-button svg {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  display: block !important;
}
#upload-button:hover {
  color: #1e293b !important;
  background: #f1f5f9 !important;
}

/* ── 隐藏输入框（保留上传功能） ──────────────────────────── */
#root #message-composer {
  position: absolute !important;
  left: -9999px !important;
  visibility: hidden !important;
}

/* ── 消息滚动区域底部留 20px ────────────────────────────── */
#root [class*="overflow-y-auto"][class*="flex-grow"],
#root [class*="overflow-y-auto"][class*="grow"],
#root .relative.flex.flex-col.flex-grow.overflow-y-auto {
  padding-bottom: 50px !important;
}

/* ── 消除双滚动条 ──────────────────────────────────────── */
#root .flex.flex-row.flex-grow.overflow-auto {
  overflow: hidden !important;
}
#root .relative.flex.flex-col.flex-grow.overflow-y-auto {
  overflow-y: hidden !important;
}

/* ── 隐藏水印 ──────────────────────────────────────────── */
.watermark {
  display: none !important;
}

/* ── 禁止输入框交互（防止键盘弹出） ──────────────────────── */
#root #chat-input {
  pointer-events: none !important;
}

/* ── 隐藏 AI 编辑按钮 ────────────────────────────────────── */
#lp-edit-btn,
#lp-pick-btn,
#lp-visual-edit-btn {
  display: none !important;
}

/* ── 隐藏回退恢复按钮 ────────────────────────────────────── */
#lp-rollback-btn,
#lp-restore-btn {
  display: none !important;
}
