/* TOKI 秘书 - 统一样式 V6.0 */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Roboto', 'Noto Sans SC', 'Source Han Sans CN', 'PingFang SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  background: #f7f7f8;
  font-size: 14px;
  color: #333;
  line-height: 1.5;
}

/* 主容器 - 模拟手机 */
.app-container {
  max-width: 420px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  position: relative;
}

/* 状态栏 */
.status-bar {
  display: flex;
  justify-content: space-between;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  background: #fff;
}

/* 顶部栏 */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: #fff;
}
.top-bar-title {
  font-size: 17px;
  font-weight: 600;
}
.top-bar-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #f0f0f0;
  cursor: pointer;
  transition: background 0.2s;
}
.top-bar-btn:active { background: #e0e0e0; }
.top-bar-btn svg { width: 24px; height: 24px; stroke: #667eea; fill: none; stroke-width: 1.5; }

/* 底部导航 */
.bottom-nav {
  display: flex;
  justify-content: space-around;
  padding: 8px 0 12px;
  background: #fff;
  border-top: 1px solid #eee;
  flex-shrink: 0;
}
.nav-item {
  text-align: center;
  cursor: pointer;
  padding: 4px 12px;
}
.nav-item .nav-icon {
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.nav-item .nav-icon svg { width: 24px; height: 24px; fill: none; stroke-width: 1.2; }
.nav-item .nav-label { font-size: 11px; color: #999; }
.nav-item.active .nav-label { color: #667eea; }
.nav-item.active .nav-icon svg { stroke: #667eea; }
.nav-item .nav-icon svg { stroke: #999; }

/* 页面内容区 */
.page-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 首页 */
.home-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  flex: 1;
}
.home-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 20px rgba(102,126,234,0.3);
  margin-bottom: 20px;
}
.welcome-bubble {
  background: white;
  padding: 16px 20px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  text-align: left;
  max-width: 260px;
}
.welcome-bubble .greeting { font-weight: 600; color: #333; font-size: 15px; }
.welcome-bubble .time { color: #667eea; font-size: 14px; margin-top: 4px; }
.welcome-bubble .message { color: #666; font-size: 14px; margin-top: 8px; }

/* 智能体页面 */
.agent-page { padding: 0 0 16px; }
.section-title {
  font-size: 14px;
  font-weight: 600;
  padding: 16px 16px 8px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title svg { width: 20px; height: 20px; stroke: #667eea; fill: none; stroke-width: 1.2; }
.func-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 16px 8px;
}
.func-card {
  background: white;
  padding: 14px 12px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.func-card:active { transform: scale(0.98); }
.func-card .func-icon { 
  height: 24px; 
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 6px;
}
.func-card .func-icon svg { width: 24px; height: 24px; stroke: #667eea; fill: none; stroke-width: 1.2; }
.func-card .func-name { font-size: 13px; color: #333; }

/* 对话页面 */
.chat-container { display: flex; flex-direction: column; height: 100%; }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.chat-message {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.chat-message.user { flex-direction: row-reverse; }
.message-avatar { 
  width: 32px; 
  height: 32px; 
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.message-avatar .toki-avatar { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.message-content {
  max-width: 70%;
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
}
.chat-message.assistant .message-content {
  background: white;
  color: #333;
}
.chat-message.user .message-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

/* 工具栏 - 横向滚动 */
.tool-bar {
  display: flex;
  overflow-x: auto;
  padding: 10px 12px;
  gap: 8px;
  background: white;
  border-top: 1px solid #eee;
}
.tool-bar::-webkit-scrollbar { display: none; }
.tool-item, .tool-bar-item {
  min-width: 52px;
  text-align: center;
  padding: 8px 4px;
  cursor: pointer;
}
.tool-bar-item .tool-icon { 
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tool-bar-item .tool-icon svg { width: 24px; height: 24px; stroke: #667eea; fill: none; stroke-width: 1.2; }
.tool-bar-item .tool-name { font-size: 11px; color: #666; margin-top: 4px; }

/* 输入区域 */
.input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #eee;
  flex-shrink: 0;
}
.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.voice-btn {
  flex: 1;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  height: 44px;
  border-radius: 22px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.voice-btn:active { opacity: 0.9; }
.voice-btn svg { width: 20px; height: 20px; stroke: white; fill: none; stroke-width: 2; }
.input-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  border-radius: 10px;
  border: none;
  cursor: pointer;
}
.input-btn svg { width: 24px; height: 24px; stroke: #667eea; fill: none; stroke-width: 1.5; }
.text-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.text-input-row input {
  flex: 1;
  height: 40px;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  padding: 0 16px;
  font-size: 14px;
  outline: none;
}
.text-input-row input:focus { border-color: #667eea; }
.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon {
  width: 36px;
  height: 36px;
  border: none;
  background: #f0f0f0;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

/* 功能子页面 */
.feature-page { display: flex; flex-direction: column; height: 100%; }
.feature-header {
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.feature-header .back-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #333;
}
.feature-header h2 { font-size: 17px; font-weight: 600; }
.feature-body { flex: 1; overflow-y: auto; padding: 16px; }
.feature-input {
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid #f0f0f0;
}
.feature-input textarea {
  width: 100%;
  height: 80px;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  resize: none;
  outline: none;
  font-family: inherit;
}
.feature-input textarea:focus { border-color: #667eea; }
.feature-input .actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}
.feature-input .upload-btn, .feature-input .submit-btn {
  padding: 10px 20px;
  border-radius: 20px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.feature-input .submit-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}
.feature-input .upload-btn {
  background: #f0f0f0;
  color: #333;
}

/* 结果展示 */
.result-card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  line-height: 1.7;
  white-space: pre-wrap;
}

/* Loading */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #f0f0f0;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: #999; font-size: 13px; margin-top: 12px; }

/* 我的页面 */
.mine-page { background: #f7f7f8; }
.mine-header {
  text-align: center;
  padding: 30px 20px 20px;
  background: white;
}
.mine-header .avatar { 
  width: 80px; 
  height: 80px; 
  border-radius: 50%; 
  object-fit: cover; 
  margin-bottom: 12px; 
}
.mine-header .name { font-size: 16px; font-weight: 600; }
.mine-header .edit { color: #667eea; font-size: 13px; margin-top: 6px; }

/* 统计行 */
.stats-row {
  display: flex;
  justify-content: space-around;
  padding: 16px;
  background: white;
  margin: 0 16px 16px;
  border-radius: 12px;
}
.stat-item { text-align: center; }
.stat-item .value { font-size: 17px; font-weight: 600; color: #667eea; }
.stat-item .label { font-size: 13px; color: #999; margin-top: 4px; }

.mine-section { background: white; margin-bottom: 8px; }
.menu-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #f5f5f5;
  cursor: pointer;
}
.menu-item:last-child { border-bottom: none; }
.menu-item .menu-icon { 
  margin-right: 12px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.menu-item .menu-icon svg { width: 24px; height: 24px; stroke: #667eea; fill: none; stroke-width: 1.2; }
.menu-item .menu-title { flex: 1; font-size: 14px; color: #333; }
.menu-item .menu-arrow { color: #ccc; font-size: 14px; }

/* 设置 */
.settings-divider { height: 8px; background: #f7f7f8; }
.settings-group { background: white; }
.settings-section { background: white; margin-bottom: 8px; }
.setting-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: white;
  border-bottom: 1px solid #f5f5f5;
}
.setting-item:last-child { border-bottom: none; }
.setting-item .setting-label { flex: 1; font-size: 14px; }
.setting-item .setting-value { color: #667eea; font-size: 14px; }
.toggle-switch {
  width: 44px;
  height: 24px;
  background: #e0e0e0;
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s;
}
.toggle-switch.active { background: #667eea; }
.toggle-switch::after {
  content: '';
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: left 0.3s;
}
.toggle-switch.active::after { left: 22px; }
.version-info {
  text-align: center;
  padding: 20px;
  font-size: 13px;
  color: #999;
}

/* 登录页 */
.login-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
}
.login-logo {
  text-align: center;
  padding: 50px 20px 30px;
}
.login-logo .avatar-large { 
  width: 80px; 
  height: 80px; 
  border-radius: 50%; 
  object-fit: cover; 
  box-shadow: 0 8px 30px rgba(102,126,234,0.4);
}
.login-logo .title { font-size: 22px; font-weight: 600; color: #333; margin-top: 16px; }
.login-logo .subtitle { color: #666; margin-top: 8px; font-size: 14px; }

/* 欢迎气泡 */
.login-bubble {
  text-align: center;
  margin: 0 24px 20px;
}
.login-bubble .bubble-content {
  display: inline-block;
  background: white;
  padding: 12px 18px;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  max-width: 220px;
}
.login-bubble .bubble-text { font-size: 14px; color: #333; }
.login-bubble .bubble-text span { color: #667eea; font-weight: 600; }
.login-bubble .bubble-sub { font-size: 13px; color: #666; margin-top: 4px; }

.login-form { padding: 0 24px; flex: 1; }
.login-btn {
  display: block;
  width: 100%;
  padding: 14px;
  border-radius: 24px;
  border: none;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 12px;
}
.login-btn.primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
.login-btn.secondary { background: white; color: #333; border: 1px solid #ddd; }
.login-input {
  width: 100%;
  height: 48px;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 0 16px;
  font-size: 15px;
  margin-bottom: 12px;
  outline: none;
}
.login-input:focus { border-color: #667eea; }
.login-divider { text-align: center; margin: 16px 0; color: #999; font-size: 13px; }
.guest-link { text-align: center; padding: 16px; color: #667eea; font-size: 14px; cursor: pointer; }
.login-footer { text-align: center; padding: 16px; font-size: 12px; color: #bbb; }

/* 语音通话页 */
.voice-call-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
}
.call-header {
  padding: 20px;
  text-align: center;
  color: white;
}
.avatar-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.avatar-big {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: white;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-big img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; }
.call-name { color: white; font-size: 22px; font-weight: 600; }
.call-status { color: rgba(255,255,255,0.8); margin-top: 8px; font-size: 14px; }

/* 声波动画 */
.sound-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 60px;
  margin: 20px 0;
}
.sound-bar {
  width: 4px;
  background: rgba(255,255,255,0.8);
  border-radius: 2px;
  animation: soundWave 1s ease-in-out infinite;
}
.sound-bar:nth-child(1) { height: 20px; animation-delay: 0s; }
.sound-bar:nth-child(2) { height: 35px; animation-delay: 0.1s; }
.sound-bar:nth-child(3) { height: 50px; animation-delay: 0.2s; }
.sound-bar:nth-child(4) { height: 35px; animation-delay: 0.3s; }
.sound-bar:nth-child(5) { height: 45px; animation-delay: 0.4s; }
.sound-bar:nth-child(6) { height: 30px; animation-delay: 0.5s; }
.sound-bar:nth-child(7) { height: 40px; animation-delay: 0.6s; }
@keyframes soundWave {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.5); }
}

.call-controls {
  padding: 30px 20px 40px;
  display: flex;
  justify-content: center;
  gap: 40px;
}
.control-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
}
.control-btn svg { width: 24px; height: 24px; stroke: white; fill: none; stroke-width: 1.5; }
.control-btn.end {
  background: #ff4757;
  width: 64px;
  height: 64px;
}
.control-btn.end svg { width: 32px; height: 32px; }
.control-label { color: white; font-size: 11px; margin-top: 8px; text-align: center; }

/* 隐藏 */
.hidden { display: none !important; }
