/* demos-page.css - 深色主题优化版 */

:root {
  --bg: #0a0a0f;
  --bg2: #0f0f1a;
  --bg3: #13131f;
  --surface: #1a1a28;
  --surface2: #22223a;
  --border: rgba(120, 120, 255, 0.12);
  --border2: rgba(120, 120, 255, 0.22);
  --primary: #6c6fff;
  --primary-soft: rgba(108, 111, 255, 0.12);
  --primary-glow: rgba(108, 111, 255, 0.35);
  --accent: #00e5c4;
  --accent-soft: rgba(0, 229, 196, 0.1);
  --text: #f0f0f8;
  --text2: #9898b8;
  --text3: #5a5a78;
  --green: #00d68a;
  --orange: #ff7a3d;
  --red: #ff4d7a;
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Space Grotesk', 'Noto Sans SC', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* 网格背景 */
.demo-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(108, 111, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(108, 111, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

.demo-page {
  min-height: 100vh;
  padding-top: 80px;
  position: relative;
}

/* 主容器 - 优化间距 */
.demo-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 2rem;
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 0;
  position: relative;
  z-index: 1;
  justify-content: center;
}

/* 侧边栏 - 优化 */
.demo-sidebar {
  position: sticky;
  top: 100px;
  height: calc(100vh - 140px);
  overflow-y: auto;
}

.demo-sidebar::-webkit-scrollbar { width: 4px; }
.demo-sidebar::-webkit-scrollbar-track { background: transparent; }
.demo-sidebar::-webkit-scrollbar-thumb { background: var(--surface); border-radius: 2px; }

/* 侧边栏标题 */
.demo-sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
  padding-left: 0.75rem;
}

/* 导航列表 - 紧凑 */
.demo-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.demo-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text2);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.2s ease;
}

.demo-nav-item:hover {
  background: var(--surface);
  color: var(--text);
}

.demo-nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.demo-nav-icon { font-size: 16px; line-height: 1; }

/* 主内容区 */
.demo-main { 
  min-height: calc(100vh - 200px);
  max-width: 800px;
  margin: 0 auto;
}

/* 案例内容 */
.case-content { display: none; }
.case-content.active { display: block; }

/* 案例展示区 - 优化对齐 */
.case-showcase {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: 30px;
  margin-bottom: 3rem;
}

/* 代码面板 - 无外框直接展示 */
.case-code-panel {
  flex: 1;
  max-width: 560px;
  min-width: 400px;
  padding-right: 80px;
  height: 804px;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.case-code-panel .code-content {
  flex: 1;
  padding: 0;
  overflow-y: auto;
  background: transparent;
}

.case-code-panel .prompt-code-content {
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 2;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.case-code-panel .code-actions {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.case-code-panel .action-btn {
  flex: 1;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.case-code-panel .action-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* iPhone 模拟器 - 优化 */
.case-showcase > .case-simulator {
  width: 371px;
  height: 804px;
  background: #000;
  flex-shrink: 0;
  border-radius: 44px;
  padding: 4px;
  margin: 0 0 0 -100px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.case-showcase > .case-header { display: none; }

/* ========== 手机模拟器详细样式 ========== */
.case-simulator {
  width: 371px;
  height: 804px;
  margin: 0;
  position: relative;
  background: #000;
  border-radius: 44px;
  box-shadow: 
    0 0 0 1px rgba(255,255,255,0.1),
    0 50px 100px -20px rgba(0,0,0,0.5);
  overflow: hidden;
  padding: 12px;
}

/* 左侧按钮 */
.case-simulator::before {
  content: '';
  position: absolute;
  left: 0;
  top: 100px;
  width: 3px;
  height: 60px;
  background: linear-gradient(to bottom, #333, #222);
  border-radius: 0 2px 2px 0;
}

/* 右侧按钮 */
.case-simulator::after {
  content: '';
  position: absolute;
  right: 0;
  top: 80px;
  width: 3px;
  height: 80px;
  background: linear-gradient(to bottom, #333, #222);
  border-radius: 2px 0 0 2px;
}

/* 屏幕容器 */
.simulator-screen {
  width: 100%;
  height: 100%;
  background: #fff;
  border-radius: 36px;
  overflow: hidden;
  position: relative;
}

/* 顶部刘海 */
.simulator-screen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 34px;
  background: #000;
  border-radius: 0 0 20px 20px;
  z-index: 10;
}

/* 底部Home条 */
.simulator-screen::after {
  content: '';
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 134px;
  height: 5px;
  background: #000;
  border-radius: 3px;
  z-index: 10;
}

/* Iframe */
.app-iframe {
  width: 100%;
  height: 100%;
  min-height: 750px;
  border: none;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
}

.app-iframe.loaded {
  opacity: 1;
  overflow-y: auto;
}

/* ========== Simulator Window Styles ========== */
.simulator-header {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #e2e8f0;
}

.simulator-notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 24px;
  background: #1a1a1a;
  border-radius: 0 0 16px 16px;
  z-index: 10;
}

.simulator-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff5f57;
}

.simulator-dot:nth-child(2) { background: #febc2e; }
.simulator-dot:nth-child(3) { background: #28c840; }

.simulator-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1e293b;
  letter-spacing: 0.02em;
}

.simulator-body {
  padding: 1rem;
  min-height: 340px;
  background: linear(180deg, #f8fafc 0%, #ffffff 100%);
  background-color: #f8fafc;
}

/* ========== iPhone Chrome Styles ========== */
.iphone-frame {
  width: 100%;
  height: 100%;
  position: relative;
  border-radius: 40px;
  overflow: hidden;
  background: #1a1a1a;
}

.iphone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* 侧边按钮 */
.iphone-btn-volume-up,
.iphone-btn-volume-down,
.iphone-btn-power {
  position: absolute;
  background: #2a2a2a;
  border-radius: 2px;
  z-index: 10;
}
.iphone-btn-volume-up {
  left: -3px;
  top: 120px;
  width: 3px;
  height: 28px;
  border-radius: 2px 0 0 2px;
}
.iphone-btn-volume-down {
  left: -3px;
  top: 160px;
  width: 3px;
  height: 28px;
  border-radius: 2px 0 0 2px;
}
.iphone-btn-power {
  right: -3px;
  top: 180px;
  width: 3px;
  height: 40px;
  border-radius: 0 2px 2px 0;
}

/* 状态栏 */
.iphone-status-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 24px 6px;
  z-index: 5;
  pointer-events: none;
}

.iphone-status-time {
  font-size: 14px;
  font-weight: 600;
  color: #000;
  letter-spacing: 0;
}

.iphone-notch {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 22px;
  background: #000;
  border-radius:30px;
  z-index: 6;
  overflow: hidden;
}

.iphone-status-icons {

  margin-top: -20rpx!important;
  display: flex;
  align-items: center;
  gap: 4px;
}

.iphone-signal {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.iphone-signal-bar {
  width: 3px;
  background: #000;
  border-radius: 1px;
}
.iphone-signal-bar:nth-child(1) { height: 4px; }
.iphone-signal-bar:nth-child(2) { height: 6px; }
.iphone-signal-bar:nth-child(3) { height: 8px; }
.iphone-signal-bar:nth-child(4) { height: 10px; }

.iphone-wifi {
  display: none;
  width: 14px;
  height: 14px;
  position: relative;
}
.iphone-wifi::before {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: #000;
  border-radius: 50%;
}
.iphone-wifi::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid #000;
  border-radius: 2px;
}

.iphone-battery {
  display: flex;
  align-items: center;
  gap: 2px;
}
.iphone-battery-level {
  width: 20px;
  height: 10px;
  border: 1px solid #000;
  border-radius: 2px;
  padding: 1px;
}
.iphone-battery-level::before {
  content: '';
  display: block;
  height: 100%;
  width: 80%;
  background: #34c759;
  border-radius: 1px;
}

.iphone-home-indicator {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 4px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  z-index: 5;
}

/* ========== Case Header Styles ========== */
.case-header {
  margin-bottom: 2rem;
}

.case-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 0.5rem 0;
}

.case-desc {
  color: var(--text2);
  font-size: 1.0625rem;
  line-height: 1.7;
  margin: 0;
}

.case-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

/* ========== 案例头部卡片样式 ========== */
.case-header-card {
  padding: 24px;
  margin: 0;
  max-width: 100%;
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* 提示框样式 */
.case-header-hint {
  margin-top: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.case-header-hint-text {
  color: var(--text2);
  line-height: 1.7;
  font-size: 0.9375rem;
}

/* 标题样式 */
.case-header-title {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* 描述样式 */
.case-header-desc {
  margin: 0;
  color: var(--text2);
  line-height: 1.7;
  font-size: 0.9375rem;
}

/* 图标容器样式 */
.case-header-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 1.5rem;
  flex-shrink: 0;
}

/* 内容区域样式 */
.case-header-content {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex: 1;
}

.case-header-body {
  flex: 1;
  max-width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ========== Todo App Styles ========== */
.todo-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: white;
  border-radius: 12px;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.todo-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.todo-text {
  flex: 1;
  font-size: 0.9375rem;
  color: var(--text);
}

.todo-text.done {
  text-decoration: line-through;
  color: var(--text2);
}

.todo-input {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.todo-input input {
  flex: 1;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.875rem;
  background: var(--surface);
  color: var(--text);
}

.todo-input input:focus {
  outline: none;
  border-color: var(--primary);
}

.todo-input button {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--primary);
  color: white;
  border-radius: 12px;
  font-size: 1.25rem;
  cursor: pointer;
}

/* ========== Expense Tracker Styles ========== */
.expense-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem;
  background: white;
  border-radius: 12px;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.expense-icon { font-size: 1.25rem; }

.expense-text {
  flex: 1;
  font-size: 0.9375rem;
  color: var(--text);
}

.expense-amount {
  font-weight: 600;
  font-family: var(--mono);
}

.expense-amount.expense { color: var(--red); }
.expense-amount.income { color: var(--green); }

/* ========== Info Cards Styles ========== */
.case-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-card {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 1.5rem;
}

.info-card-icon {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.info-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.info-card-text ul {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text2);
  line-height: 1.8;
}

.info-card-text li { margin-bottom: 0.25rem; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.stat-item {
  text-align: center;
  padding: 0.75rem;
  background: var(--bg2);
  border-radius: 12px;
}

.stat-item .stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-item .stat-label {
  font-size: 0.75rem;
  color: var(--text2);
  margin-top: 0.25rem;
}

/* ========== API Documentation Styles ========== */
.case-api {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 1.5rem;
}

.case-api-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 1rem 0;
}

.api-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.api-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg2);
  border-radius: 12px;
}

.api-method {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  text-transform: uppercase;
  font-family: var(--mono);
}

.api-method.get { background: #dbeafe; color: #1d4ed8; }
.api-method.post { background: #dcfce7; color: #15803d; }
.api-method.put { background: #fef3c7; color: #b45309; }
.api-method.delete { background: #fee2e2; color: #b91c1c; }

.api-path {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--text);
  flex: 1;
}

.api-desc {
  font-size: 0.8125rem;
  color: var(--text2);
}

/* ========== Coming Soon Styles ========== */
.case-coming-soon {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
}

.coming-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
}

.case-coming-soon p {
  color: var(--text2);
  font-size: 1.125rem;
}

/* ========== Prompt Section Styles ========== */
.case-prompt {
  padding: 1.5rem 0;
  margin-top: 1.5rem;
}

.case-prompt-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.5rem 0;
}

.case-prompt-desc {
  font-size: 0.9375rem;
  color: var(--text2);
  margin: 0 0 1rem 0;
}

.prompt-code-block {
  background: var(--bg3);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.prompt-code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--border);
}

.prompt-code-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
}

.prompt-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  background: var(--primary);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.prompt-copy-btn:hover { background: var(--primary-soft); }
.prompt-copy-btn.copied { background: var(--green); }

.prompt-code-content {
  padding: 1.25rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.8;
  color: #e2e8f0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  max-height: 500px;
  overflow-y: auto;
}

/* ========== Case Prompt Panel ========== */
.case-prompt-panel { display: none; }

/* demo.html 中的代码预览窗口宽度与提示词代码框一致 */
.case-prompt .hero-code-preview {
  max-width: none;
  width: 100%;
  padding: 0;
}

/* ========== FAQ Section ========== */
.faq-section {
  margin: 0 auto;
  padding: 80px 0 !important;
}

.faq-title {
  text-align: center;
  font-size: 28px;
  margin-bottom: 30px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 auto;
}

.faq-item {
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.faq-item:hover {
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(108, 111, 255, 0.2);
}

/* 响应式 */
@media (max-width: 1200px) {
  .demo-container {
    padding: 2rem;
    gap: 0;
  }
  
  .case-showcase { gap: 30px; }
  
  .case-code-window {
    max-width: 450px;
    min-width: 320px;
  }
}

@media (max-width: 1024px) {
  .demo-container {
    grid-template-columns: 1fr;
    padding: 1.5rem;
    gap: 0;
  }

  .demo-sidebar {
    position: static;
    height: auto;
    padding-right: 0;
  }

  .demo-nav-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .demo-nav-item {
    width: auto;
    flex: 1;
    min-width: 120px;
  }

  .case-showcase {
    flex-direction: column;
    align-items: center;
    gap: 30px;
  }

  .case-code-panel {
    width: 100%;
    max-width: none;
    min-width: auto;
    height: auto;
    max-height: 500px;
    order: 1;
  }
  
  .case-showcase > .case-simulator { order: 0; }

  .case-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .demo-container { 
    padding: 1rem;
    gap: 0;
  }

  .demo-nav-item {
    min-width: 100px;
    padding: 8px 12px;
    font-size: 14px;
  }

  .faq-item { padding: 20px 24px; }
}
