/* === 06-panels.css (原 user.css L1540-L1793,Section 8+9+10 弹窗模态 + 表单控件 + 面板) === */

/* === Section 8 弹窗 / 模态 (原 L1540-L1665) === */

/* ========================================
   8. 弹窗 / 模态（.modal-overlay, .modal-sheet）
   ======================================== */

/* 平台选择对话框 */
.dialog-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--shadow-overlay);
  display: flex; align-items: center; justify-content: center;
}
.dialog-panel {
  background: var(--bg-hover); border-radius: 12px;
  padding: 24px; max-width: 400px; width: 90%; color: var(--text-main);
}
.dialog-title { margin: 0 0 16px; font-size: 18px; }
.dialog-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; margin-bottom: 16px;
}
.dialog-btn {
  padding: 12px; border: 1px solid var(--border-glass); border-radius: 8px;
  background: var(--bg-surface); cursor: pointer;
  font-size: 15px; color: var(--text-main); transition: background 0.2s;
}
.dialog-btn:hover { background: var(--info-bg); }
.dialog-btn-dashed {
  padding: 12px; border: 1px dashed var(--text-muted); border-radius: 8px;
  background: var(--bg-surface); cursor: pointer;
  font-size: 15px; color: var(--text-muted);
}
.dialog-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px; cursor: pointer;
  font-size: 14px; color: var(--text-muted);
}
.dialog-cancel {
  width: 100%; padding: 10px; border: none; border-radius: 8px;
  background: var(--bg-surface); cursor: pointer;
  font-size: 15px; color: var(--text-main);
}

/* 浏览器授权 overlay */
.auth-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--shadow-deep);
  display: flex; flex-direction: column;
}
.auth-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px; color: var(--text-main); flex-wrap: wrap; gap: 8px;
}
.auth-toolbar-actions { display: flex; align-items: center; gap: 6px; }
.auth-input {
  padding: 4px 8px; border-radius: 4px; border: 1px solid var(--text-dim);
  background: var(--text-dim); color: var(--text-main); width: 160px; font-size: 13px;
}
.auth-btn-send {
  background: var(--brand-secondary); color: var(--text-on-color); border: none;
  padding: 5px 12px; border-radius: 4px; cursor: pointer;
  font-size: 13px; white-space: nowrap;
}
.auth-btn-complete {
  background: var(--success-color); color: var(--text-on-color); border: none;
  padding: 6px 16px; border-radius: 6px; cursor: pointer;
}
.auth-btn-cancel {
  background: var(--text-tertiary); color: var(--text-on-color); border: none;
  padding: 6px 16px; border-radius: 6px; cursor: pointer;
}
.auth-fallback {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-secondary); padding: 24px;
}
.auth-fallback-title { font-size: 16px; margin-bottom: 8px; }
.auth-fallback-hint { font-size: 13px; color: var(--text-tertiary); margin-bottom: 24px; }
.auth-clipboard-box {
  background: var(--bg-layer-1); border: 1px solid var(--border-light); border-radius: 8px;
  padding: 20px; width: 100%; max-width: 420px; text-align: center;
}
.auth-clipboard-hint { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; }
.auth-clipboard-row { display: flex; gap: 8px; margin-bottom: 10px; }
.auth-clipboard-input {
  flex: 1; padding: 8px 12px; border-radius: 6px;
  border: 1px solid var(--text-dim); background: var(--bg-layer-1); color: var(--text-main); font-size: 14px;
}
.auth-clipboard-btn {
  background: var(--brand-secondary); color: var(--text-on-color); border: none;
  padding: 8px 20px; border-radius: 6px; cursor: pointer; font-size: 14px;
}
.auth-clipboard-btn-alt {
  background: var(--accent-orange); color: var(--text-on-color); border: none;
  padding: 8px 20px; border-radius: 6px; cursor: pointer; font-size: 14px;
}
.auth-clipboard-btns { display: flex; gap: 8px; justify-content: center; }
.auth-clipboard-note { font-size: 12px; color: var(--text-tertiary); margin-top: 10px; }
.auth-link { color: var(--accent-cyan); margin-top: 16px; font-size: 13px; }
.auth-error { display: none; color: var(--error-color); text-align: center; padding: 16px; }

/* 设置面板容器 */
.settings-container { padding: 24px; max-width: 600px; margin: 0 auto; width: 100%; }

.modal-overlay {
  position: fixed; inset: 0; background: var(--shadow-deep);
  z-index: 100; display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .2s ease;
}
.modal-sheet {
  background: var(--bg-layer-2); border-radius: 28px 28px 0 0;
  border-top: 1px solid var(--bg-active);
  padding: 20px 16px; padding-bottom: calc(20px + env(safe-area-inset-bottom));
  width: 100%; max-height: 85vh; display: flex; flex-direction: column;
  animation: sheetUp .3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-sheet-handle {
  width: 36px; height: 5px; border-radius: 3px;
  background: var(--border-light); margin: 0 auto 14px;
}
.editor-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.editor-header h2 { font-size: 17px; font-weight: 700; color: var(--text-main); }
.editor-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.editor-footer { padding-top: 12px; border-top: 1px solid var(--border-glass); margin-top: 12px; }


/* === Section 9 表单控件 (原 L1666-L1733) === */

/* ========================================
   9. 表单控件（input, textarea, select, .btn-*）
   ======================================== */

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 14px; color: var(--text-muted);
  margin-bottom: 6px; font-weight: 500;
}
.form-group .hint { font-weight: 400; font-size: 12px; color: var(--text-dim); }

/* P406:助手编辑器内"头像"行 — 左侧 48 预览 + 右侧"选择头像"按钮 */
.edit-avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.edit-avatar-slot { flex-shrink: 0; }
.edit-avatar-btn { white-space: nowrap; }
.form-group input[type="text"],
.form-group select,
.form-group textarea {
  width: 100%; padding: 10px 14px;
  background: var(--bg-surface); border: 1px solid var(--border-glass);
  border-radius: 10px; color: var(--text-main); font-size: 15px;
  font-family: inherit; outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--brand-primary); }
.form-group select { -webkit-appearance: none; appearance: none; }
.form-group textarea { resize: vertical; min-height: 100px; line-height: 1.5; }

/* Chip 多选 */
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
/* 分类分组模式:容器改为垂直堆叠,每组内部再 flex-wrap */
.chip-group:has(.chip-cat-group) { display: block; }
.chip-cat-group { margin-bottom: 10px; }
.chip-cat-group:last-child { margin-bottom: 0; }
.chip-cat-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-dim);
  margin-bottom: 6px; letter-spacing: 0.3px;
}
.chip-cat-title .category-icon { opacity: 0.75; flex-shrink: 0; }
.chip-cat-body { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 12px; border-radius: 8px; font-size: 13px;
  background: var(--bg-surface); border: 1px solid var(--border-glass);
  color: var(--text-muted); cursor: pointer; transition: all 0.2s;
  user-select: none;
}
.chip.selected {
  background: var(--brand-bg);
  border-color: var(--brand-primary);
  color: var(--text-main);
}
.chip:active { transform: scale(0.95); }

.btn-primary {
  display: block; width: 100%; padding: 12px; border-radius: 14px; border: none;
  background: var(--brand-gradient); color: var(--text-on-color); font-size: 16px;
  font-weight: 500; cursor: pointer; font-family: inherit;
  transition: transform 0.2s;
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-danger {
  display: block; width: 100%; padding: 12px; border-radius: 14px; border: none;
  background: var(--error-bg); color: var(--error-color);
  font-size: 15px; font-weight: 500; cursor: pointer; font-family: inherit;
  transition: background 0.2s; margin-top: 8px;
}
.btn-danger:active { background: var(--error-bg-strong); }


/* === Section 10 面板 (原 L1734-L1793) === */

/* ========================================
   10. 面板（.settings-*, .persona-*;助手眼中的你见 44-understanding）
   ======================================== */

/* 全屏图片 */
.image-viewer {
  position: fixed; inset: 0; background: var(--shadow-deep); z-index: 250;
  display: flex; align-items: center; justify-content: center; animation: fadeIn .2s ease;
}
.image-viewer img { max-width: 94vw; max-height: 90vh; border-radius: 4px; object-fit: contain; }

::-webkit-scrollbar { width: 0; height: 0; background: transparent; }

/* 对话消息区滚动条:默认隐藏,滚动时淡入停止后淡出,主题同色不突兀 */
#chat-messages { scrollbar-width: thin; scrollbar-color: transparent transparent; transition: scrollbar-color var(--transit-normal); }
#chat-messages::-webkit-scrollbar { width: 6px; height: 6px; }
#chat-messages::-webkit-scrollbar-track { background: transparent; }
#chat-messages::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; transition: background var(--transit-normal); }
#chat-messages.is-scrolling { scrollbar-color: var(--border-light) transparent; }
#chat-messages.is-scrolling::-webkit-scrollbar-thumb { background: var(--border-light); }
#chat-messages::-webkit-scrollbar-thumb:hover { background: var(--bg-active); }

