/* ================================================================
   方舟一号 · 统一工作台样式
   - 左侧导航栏默认隐藏，30px触发区 + 可见提示条
   - 鼠标悬停触发区/导航栏时展开
   ================================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary: #06080d;
  --bg-secondary: #0d1117;
  --bg-card: #111827;
  --border: #1e293b;
  --border-light: #2a3444;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --blue: #3b82f6;
  --radius: 12px;
  --transition: 0.2s cubic-bezier(.4,0,.2,1);
  --nav-width: 220px;
  --nav-trigger: 30px;
}

html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary); color: var(--text-primary);
}

.workbench { display: flex; height: 100vh; position: relative; }

/* ==================== 左侧触发区 ==================== */
.nav-trigger-zone {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--nav-trigger);
  height: 100vh;
  z-index: 100;
  cursor: pointer;
}

/* 触发区提示条 - 始终可见的细线+箭头 */
.trigger-hint {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  height: 60px;
  opacity: 0.5;
  transition: opacity 0.25s ease, left 0.25s ease;
  pointer-events: none;
}
.nav-trigger-zone:hover .trigger-hint {
  opacity: 1;
  left: 4px;
}

/* 左侧渐变提示线 */
.hint-line {
  width: 3px;
  height: 100%;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(245, 158, 11, 0.4) 20%,
    rgba(245, 158, 11, 0.7) 50%,
    rgba(245, 158, 11, 0.4) 80%,
    transparent 100%
  );
}

/* 小箭头 */
.hint-arrow {
  color: rgba(245, 158, 11, 0.6);
  font-size: 10px;
  line-height: 1;
  transition: transform 0.25s ease, color 0.25s ease;
}
.nav-trigger-zone:hover .hint-arrow {
  transform: rotate(180deg);
  color: rgba(245, 158, 11, 0.9);
}

/* 导航栏展开时隐藏提示条 */
.wb-nav.expanded ~ .nav-trigger-zone .trigger-hint {
  opacity: 0;
  pointer-events: none;
}

/* ==================== 左侧导航栏 ==================== */
.wb-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--nav-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 90;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
  box-shadow: 4px 0 24px rgba(0,0,0,0.5);
}
.wb-nav.expanded { transform: translateX(0); }

/* 导航栏右侧边缘微光（hover引导线） */
.nav-edge-glow {
  display: none;
}

/* 导航品牌区 */
.nav-brand {
  height: 64px; padding: 0 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center;
}
.nav-brand-link {
  display: flex; align-items: center; gap: 10px; color: var(--text-primary); text-decoration: none; font-weight: 700; font-size: 16px;
}
.nav-brand-icon { font-size: 24px; }
.nav-brand-text { white-space: nowrap; }

/* 导航菜单 */
.nav-menu { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px;
  color: var(--text-secondary); text-decoration: none; cursor: pointer; transition: var(--transition);
  white-space: nowrap;
}
.nav-item:hover { background: rgba(255,255,255,.04); color: var(--text-primary); }
.nav-item.active { background: rgba(245,158,11,.12); color: var(--accent-light); border-left: 3px solid var(--accent); }
.nav-icon { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.nav-label { font-size: 14px; font-weight: 500; }

/* 导航底部 */
.nav-footer { padding: 14px 10px; border-top: 1px solid var(--border); }
.nav-footer-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px;
  color: var(--text-muted); text-decoration: none; cursor: pointer; transition: var(--transition);
}
.nav-footer-link:hover { background: rgba(239,68,68,.08); color: #f87171; }

/* ==================== 右侧内容区 ==================== */
.wb-content {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: var(--bg-primary);
  z-index: 1;
  transition: left 0.28s cubic-bezier(.4,0,.2,1), width 0.28s cubic-bezier(.4,0,.2,1);
}
.wb-content.nav-expanded {
  left: var(--nav-width);
  width: calc(100% - var(--nav-width));
}
.wb-content iframe { width: 100%; height: 100%; border: none; display: block; }

/* 导航展开时内容区遮罩 */
.wb-content.nav-expanded::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.2);
  pointer-events: none;
  z-index: 1;
}

/* ==================== 工作概览面板 ==================== */
.overview-panel {
  width: 100%; height: 100%; overflow-y: auto;
  padding: 40px 48px;
  max-width: 1100px;
  margin: 0 auto;
}

.overview-header {
  margin-bottom: 36px;
}
.overview-header h1 {
  font-size: 28px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 8px;
}
.overview-header h1 span {
  color: var(--accent-light);
}
.overview-header p {
  font-size: 15px; color: var(--text-muted);
}

/* 快捷入口卡片 */
.overview-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 36px;
}

.ov-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  gap: 20px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.ov-card:hover {
  border-color: var(--border-light);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.ov-card-icon {
  font-size: 36px;
  width: 60px; height: 60px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(245,158,11,.08);
  border-radius: 14px;
  flex-shrink: 0;
}

.ov-card-body {
  flex: 1;
  display: flex; flex-direction: column; gap: 6px;
}
.ov-card-title {
  font-size: 17px; font-weight: 600; color: var(--text-primary);
}
.ov-card-desc {
  font-size: 13px; color: var(--text-muted); line-height: 1.5;
  flex: 1;
}
.ov-card-btn {
  display: inline-block;
  color: var(--accent-light);
  text-decoration: none;
  font-size: 13px; font-weight: 600;
  transition: color var(--transition);
  margin-top: 4px;
}
.ov-card-btn:hover { color: var(--accent); }

/* 统计卡片 */
.overview-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 36px;
}

.ov-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  text-align: center;
}
.ov-stat-value {
  font-size: 32px; font-weight: 700;
  color: var(--accent-light);
  margin-bottom: 4px;
}
.ov-stat-label {
  font-size: 13px; color: var(--text-muted);
}

/* iframe 嵌入区 */
.overview-iframe-wrapper {
  width: 100%;
  height: calc(100vh - 60px);
}
.overview-iframe-wrapper iframe {
  width: 100%; height: 100%; border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* 用户信息 */
.nav-user-info {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; color: var(--text-muted); font-size: 13px;
}
.nav-user-avatar { font-size: 18px; }
.nav-user-name { color: var(--text-primary); }

/* ================================================================
   南鱼AI悬浮窗
   - 右下角固定按钮 + 展开式小窗
   ================================================================ */

/* 浮动按钮 */
.ai-float-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 2px solid rgba(245, 158, 11, 0.3);
  border-radius: 50%;
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(245, 158, 11, 0.15), 0 1px 4px rgba(0,0,0,0.3);
  transition: transform 0.25s cubic-bezier(.4,0,.2,1),
              box-shadow 0.25s cubic-bezier(.4,0,.2,1),
              border-color 0.25s cubic-bezier(.4,0,.2,1),
              opacity 0.25s cubic-bezier(.4,0,.2,1);
}
.ai-float-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 32px rgba(245, 158, 11, 0.28), 0 2px 8px rgba(0,0,0,0.4);
  border-color: rgba(245, 158, 11, 0.6);
}
.ai-float-btn.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

.ai-float-icon {
  font-size: 26px;
  line-height: 1;
  position: relative;
  z-index: 1;
}

/* 脉冲波纹 */
.ai-float-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.12);
  transform: translate(-50%, -50%);
  animation: float-pulse 2.5s ease-out infinite;
}

@keyframes float-pulse {
  0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.7; }
  100% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
}

/* AI徽章 */
.ai-float-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #0a0a0a;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 8px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.4);
}

/* 展开的对话窗口 */
.ai-float-window {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 400px;
  height: 560px;
  max-height: calc(100vh - 80px);
  background: var(--bg-secondary);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5), 0 2px 12px rgba(245, 158, 11, 0.08);
  z-index: 999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(.4,0,.2,1),
              transform 0.25s cubic-bezier(.4,0,.2,1);
}
.ai-float-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* 窗口头部 */
.ai-float-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-bottom: 1px solid rgba(245, 158, 11, 0.15);
  flex-shrink: 0;
}

.ai-float-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-float-avatar {
  font-size: 22px;
  line-height: 1;
}

.ai-float-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.ai-float-status {
  font-size: 11px;
  color: #4ade80;
  padding: 2px 8px;
  background: rgba(74, 222, 128, 0.1);
  border-radius: 10px;
  border: 1px solid rgba(74, 222, 128, 0.2);
}
.ai-float-status.thinking {
  color: var(--accent-light);
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.ai-float-header-actions {
  display: flex;
  gap: 6px;
}

.ai-float-minimize,
.ai-float-expand {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.ai-float-minimize:hover,
.ai-float-expand:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

/* 快捷操作按钮区 */
.ai-float-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ai-quick-btn {
  padding: 6px 14px;
  border: 1px solid rgba(245, 158, 11, 0.2);
  background: rgba(245, 158, 11, 0.06);
  color: var(--text-secondary);
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.ai-quick-btn:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: var(--accent-light);
}

/* 消息区域 */
.ai-float-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-float-messages::-webkit-scrollbar {
  width: 4px;
}
.ai-float-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
}

/* 消息气泡 */
.ai-msg {
  display: flex;
  gap: 10px;
  max-width: 88%;
  align-self: flex-start;
}

.ai-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-msg-avatar {
  font-size: 20px;
  line-height: 1;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
  flex-shrink: 0;
}

.ai-msg-user .ai-msg-avatar {
  background: rgba(59, 130, 246, 0.15);
}

.ai-msg-content {
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 10px 14px;
  line-height: 1.55;
  font-size: 13px;
  color: var(--text-secondary);
}

.ai-msg-user .ai-msg-content {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.15);
}

.ai-msg-welcome .ai-msg-content {
  background: rgba(245, 158, 11, 0.05);
  border: 1px solid rgba(245, 158, 11, 0.08);
}

.ai-msg-pending .ai-msg-content {
  opacity: 0.7;
}

.ai-msg-text {
  word-break: break-word;
}

.ai-msg-text p {
  margin-bottom: 6px;
}
.ai-msg-text p:last-child {
  margin-bottom: 0;
}
.ai-msg-text code {
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}
.ai-msg-text pre {
  background: rgba(0,0,0,0.3);
  padding: 8px 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 11px;
  margin: 4px 0;
}

.ai-msg-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.ai-msg-source {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 11px;
  color: var(--text-muted);
}

/* v1.3: 追问问题按钮 */
.ai-msg-followups {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255,255,255,0.08);
}
.ai-followup-label {
  font-size: 11px;
  color: var(--accent-light);
  font-weight: 600;
  margin-bottom: 6px;
}
.ai-followup-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 12px;
  margin-bottom: 6px;
  border-radius: 8px;
  font-size: 12px;
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.12);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-followup-btn:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--accent-light);
}
.ai-followup-btn:last-child {
  margin-bottom: 0;
}

/* 输入区域 */
.ai-float-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(0,0,0,0.15);
}

.ai-float-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.ai-float-input-row textarea {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  max-height: 100px;
  line-height: 1.5;
  transition: border-color 0.2s;
  outline: none;
}
.ai-float-input-row textarea:focus {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(255,255,255,0.07);
}
.ai-float-input-row textarea::placeholder {
  color: var(--text-muted);
}

.ai-float-send {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.1));
  color: var(--accent-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}
.ai-float-send:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(245, 158, 11, 0.2));
}
.ai-float-send:active {
  transform: scale(0.92);
}
.ai-float-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ai-float-points-info {
  text-align: right;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}
.ai-float-points-info span {
  color: var(--accent-light);
  font-weight: 600;
}

/* 悬浮窗麦克风按钮 */
.ai-float-mic {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  user-select: none;
  -webkit-user-select: none;
}
.ai-float-mic:hover {
  border-color: var(--accent);
  color: var(--accent-light);
  background: rgba(245, 158, 11, 0.08);
}
.ai-float-mic.recording {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--accent);
  color: var(--accent-light);
  animation: voice-pulse 0.8s ease-in-out infinite;
}
.ai-float-mic:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .ai-float-btn {
    bottom: 20px;
    right: 16px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
  }
  .ai-float-icon { font-size: 22px; }
  .ai-float-badge { font-size: 9px; padding: 1px 5px; }
  .ai-float-window {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    border: none;
  }
  .ai-float-window.open {
    border-radius: 0;
  }
}
