/* ==========================================================================
   公考学习工作台 - 全局设计系统 (Notion / Linear 极简风格)
   ========================================================================== */

:root {
  --bg-main: #F7F7F5;
  --bg-card: #FFFFFF;
  --bg-sidebar: #F0F0ED;
  --bg-hover: #E8E8E4;
  --bg-active: #E1E1DC;
  
  --primary: #E58522;
  --primary-hover: #D27315;
  --primary-light: #FDF6EE;
  --primary-border: rgba(229, 133, 34, 0.28);
  
  --text-primary: rgba(0, 0, 0, 0.85);
  --text-secondary: rgba(0, 0, 0, 0.52);
  --text-tertiary: rgba(0, 0, 0, 0.32);
  
  --border: rgba(0, 0, 0, 0.08);
  --border-subtle: rgba(0, 0, 0, 0.05);
  --border-strong: rgba(0, 0, 0, 0.14);
  
  --danger: #E03E3E;
  --danger-light: #FDF2F2;
  --success: #2B8A3E;
  --success-light: #EBFBEE;
  --info: #1971C2;
  --info-light: #E7F5FF;
  
  --radius-card: 12px;
  --radius-btn: 8px;
  --radius-input: 8px;
  --radius-pill: 9999px;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.05);
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
  background-color: var(--bg-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: text;
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* ================= 主布局 ================= */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  background-color: var(--bg-main);
}

/* 左侧固定导航栏 */
.app-sidebar {
  width: 210px;
  min-width: 210px;
  height: 100%;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 10px 16px 12px;
  z-index: 20;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 18px 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 14px;
}

.brand-icon {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  box-shadow: 0 2px 5px rgba(229, 133, 34, 0.25);
}

.brand-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.brand-badge {
  font-size: 10px;
  padding: 1px 5px;
  background: rgba(0,0,0,0.06);
  border-radius: 4px;
  color: var(--text-secondary);
  margin-left: auto;
  font-weight: 500;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-btn);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.nav-item:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

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

.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}

.nav-item.active .nav-icon {
  opacity: 1;
}

.sidebar-footer {
  padding: 12px 10px 4px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--success);
  display: inline-block;
  margin-right: 4px;
}

/* 右侧内容主区 */
.app-main {
  flex: 1;
  height: 100%;
  overflow: hidden;
  position: relative;
  background-color: var(--bg-main);
  display: flex;
  flex-direction: column;
}

/* ================= 基础卡片与通用组件 ================= */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-strong);
}

/* 按钮规范 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  outline: none;
  white-space: nowrap;
}

.btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(229, 133, 34, 0.2);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #FFFFFF;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-danger {
  color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger-light);
  border-color: rgba(224, 62, 62, 0.2);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
}
.btn-ghost:hover {
  background: var(--bg-hover);
}

/* 胶囊标签规范 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.4;
  border: 1px solid transparent;
}

.tag-orange {
  background: #FFF4E6;
  color: #D9480F;
  border-color: #FFE8CC;
}

.tag-red {
  background: #FFF0F6;
  color: #C92A2A;
  border-color: #FFDEEB;
}

.tag-blue {
  background: #E7F5FF;
  color: #1971C2;
  border-color: #D0EBFF;
}

.tag-green {
  background: #EBFBEE;
  color: #2B8A3E;
  border-color: #D3F9D8;
}

.tag-purple {
  background: #F3F0FF;
  color: #5F3DC4;
  border-color: #E5DBFF;
}

.tag-gray {
  background: #F1F3F5;
  color: #495057;
  border-color: #E9ECEF;
}

/* 输入框规范 */
.input, .select, .textarea {
  width: 100%;
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  outline: none;
  transition: var(--transition);
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(229, 133, 34, 0.12);
}

.textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

/* ================= 模态弹窗 ================= */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 150ms ease;
}

.modal-dialog {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  width: 90%;
  max-width: 680px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #FAF9F7;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* ================= 全局 Toast 提示 ================= */
.toast-container {
  position: fixed;
  top: 20px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius-btn);
  background: #2C2C2A;
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideInRight 180ms cubic-bezier(0, 0, 0.2, 1);
  pointer-events: auto;
}

.toast-success {
  background: #1E3A24;
  color: #D3F9D8;
  border: 1px solid rgba(43, 138, 62, 0.4);
}

.toast-error {
  background: #3B1B1B;
  color: #FFE3E3;
  border: 1px solid rgba(224, 62, 62, 0.4);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInRight {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
