/* ========================================
   私人综合工作台 - 全局样式
   ======================================== */

/* ---- CSS 变量 ---- */
:root {
  --bg: #f0f2f5;
  --sidebar-bg: #ffffff;
  --card-bg: #ffffff;
  --text-primary: #2c3e50;
  --text-secondary: #7f8c8d;
  --text-muted: #b0b8c1;
  --accent: #5b8def;
  --accent-light: #e8f0fe;
  --accent-dark: #4a7bd8;
  --success: #52c41a;
  --success-light: #f0fae6;
  --warning: #faad14;
  --warning-light: #fff7e6;
  --danger: #ff6b6b;
  --danger-light: #fff0f0;
  --border: #e8eaed;
  --border-light: #f0f2f5;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.1);
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar-w: 220px;
  --bottom-nav-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* ---- 布局 ---- */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* ---- 侧边栏 ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.app-logo {
  padding: 20px 18px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-logo .logo-icon {
  font-size: 20px;
}

.nav-list {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  user-select: none;
}

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

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

.nav-item .nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sidebar-footer .btn {
  font-size: 12px;
  padding: 4px 10px;
}

/* ---- 主内容区 ---- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.content-header {
  background: var(--card-bg);
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.content-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.content-header .module-icon {
  font-size: 22px;
}

/* ---- 统计面板 ---- */
.stats-panel {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  min-width: 100px;
  flex-shrink: 0;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.stat-card .stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-card .stat-value.success { color: var(--success); }
.stat-card .stat-value.warning { color: var(--warning); }
.stat-card .stat-value.danger { color: var(--danger); }
.stat-card .stat-value.accent { color: var(--accent); }

.stat-card .stat-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- 工具栏 ---- */
.toolbar {
  display: flex;
  gap: 10px;
  padding: 12px 24px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}

.toolbar .search-box {
  flex: 1;
  min-width: 160px;
  position: relative;
}

.toolbar .search-box input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  background: var(--bg);
}

.toolbar .search-box input:focus {
  border-color: var(--accent);
  background: #fff;
}

.toolbar .search-box::before {
  content: "🔍";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  opacity: 0.5;
}

.toolbar select,
.toolbar .view-toggle {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: #fff;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
}

.toolbar .view-toggle {
  display: flex;
  gap: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.toolbar .view-toggle button {
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  background: #fff;
  border: none;
  transition: all 0.15s;
}

.toolbar .view-toggle button.active {
  background: var(--accent);
  color: #fff;
}

/* ---- 按钮 ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary {
  background: #fff;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover { background: #e85555; }

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

.btn-icon {
  padding: 5px 8px;
  font-size: 15px;
  border-radius: 4px;
  color: var(--text-muted);
  transition: all 0.15s;
}

.btn-icon:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

/* ---- 内容主体 ---- */
.content-body {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
}

/* ---- 表格视图 ---- */
.data-table {
  width: 100%;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.data-table table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead {
  background: var(--bg);
}

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.1s;
}

.data-table tbody tr:hover {
  background: var(--border-light);
}

.data-table .col-title {
  max-width: 260px;
  font-weight: 500;
  color: var(--text-primary);
}

.data-table .col-title:hover {
  color: var(--accent);
  cursor: pointer;
}

.data-table .col-actions {
  white-space: nowrap;
  text-align: right;
}

/* ---- 看板视图 ---- */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-column {
  flex: 1;
  min-width: 240px;
  max-width: 340px;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 12px;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
}

.kanban-column-header h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kanban-column-header .count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--card-bg);
  padding: 1px 8px;
  border-radius: 10px;
}

.kanban-column.pending .kanban-column-header h4::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
}

.kanban-column.active .kanban-column-header h4::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  display: inline-block;
}

.kanban-column.completed .kanban-column-header h4::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
}

.kanban-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: box-shadow 0.15s;
  border: 1px solid transparent;
}

.kanban-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--border);
}

.kanban-card .card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.4;
}

.kanban-card .card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.kanban-card .card-category {
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-light);
  padding: 1px 7px;
  border-radius: 3px;
}

.kanban-card .card-due {
  font-size: 11px;
  color: var(--text-muted);
}

.kanban-card .card-due.overdue {
  color: var(--danger);
  font-weight: 500;
}

/* ---- 标签 ---- */
.tag-list {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.tag {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--border-light);
  padding: 1px 7px;
  border-radius: 3px;
}

/* ---- 状态/优先级徽章 ---- */
.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-status-pending { background: var(--border-light); color: var(--text-secondary); }
.badge-status-active { background: var(--warning-light); color: var(--warning); }
.badge-status-completed { background: var(--success-light); color: var(--success); }

.badge-priority-high { background: var(--danger-light); color: var(--danger); }
.badge-priority-medium { background: var(--warning-light); color: var(--warning); }
.badge-priority-low { background: var(--border-light); color: var(--text-secondary); }

/* ---- 弹窗 ---- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

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

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---- 表单 ---- */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.form-group label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  background: #fff;
  color: var(--text-primary);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent);
}

.form-textarea {
  resize: vertical;
  min-height: 72px;
  line-height: 1.5;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ---- 每日规划 ---- */
.daily-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--card-bg);
  padding: 12px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.date-nav .date-display {
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  min-width: 180px;
}

.date-nav .date-display .weekday {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 2px;
}

.date-nav .date-display.today {
  color: var(--accent);
}

.daily-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

.daily-section-header h4 {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.daily-section-body {
  padding: 8px 16px 12px;
}

.daily-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

.daily-item:last-child { border-bottom: none; }

.daily-item .di-check {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.daily-item .di-check.checked {
  background: var(--success);
  border-color: var(--success);
}

.daily-item .di-check.checked::after {
  content: "✓";
  color: #fff;
  font-size: 12px;
  font-weight: bold;
}

.daily-item .di-content {
  flex: 1;
}

.daily-item .di-title {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}

.daily-item.completed .di-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.daily-item .di-meta {
  display: flex;
  gap: 6px;
  margin-top: 3px;
}

.daily-item .di-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.daily-item:hover .di-actions { opacity: 1; }

.daily-add-inline {
  padding: 8px 0;
  display: flex;
  gap: 8px;
}

.daily-add-inline input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
}

.daily-add-inline input:focus { border-color: var(--accent); }

/* ---- 空状态 ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state .empty-text {
  font-size: 14px;
  margin-bottom: 16px;
}

/* ---- 确认弹窗 ---- */
.confirm-dialog {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}

.confirm-dialog .confirm-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.confirm-dialog p {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.confirm-dialog .confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ---- Toast 提示 ---- */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(44, 62, 80, 0.9);
  color: #fff;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 300;
  animation: toastIn 0.25s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---- 移动端底部导航 ---- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h);
  background: var(--sidebar-bg);
  border-top: 1px solid var(--border);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 4px;
  flex: 1;
  transition: color 0.15s;
}

.bottom-nav-item.active {
  color: var(--accent);
}

.bottom-nav-item .bn-icon {
  font-size: 20px;
}

/* ---- 响应式 ---- */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content {
    margin-left: 0;
    padding-bottom: var(--bottom-nav-h);
  }
  .bottom-nav { display: flex; }

  .content-header { padding: 12px 16px; }
  .content-header h2 { font-size: 16px; }
  .stats-panel { padding: 10px 16px; gap: 8px; }
  .stat-card { padding: 8px 12px; min-width: 80px; }
  .stat-card .stat-value { font-size: 18px; }
  .toolbar { padding: 10px 16px; gap: 8px; }
  .toolbar .search-box { min-width: 120px; }
  .content-body { padding: 12px 16px; }

  .data-table { border-radius: var(--radius-sm); }
  .data-table th, .data-table td { padding: 8px 10px; }
  .data-table .col-title { max-width: 140px; }

  .kanban-board { flex-direction: column; }
  .kanban-column { max-width: 100%; min-width: auto; }

  .modal { max-width: 100%; max-height: 90vh; }
  .form-row { flex-direction: column; gap: 0; }

  .date-nav { padding: 10px 16px; }
  .date-nav .date-display { min-width: 140px; font-size: 14px; }
  .daily-section-header { padding: 10px 12px; }
  .daily-section-body { padding: 6px 12px 10px; }

  .toast { bottom: 70px; }
}

@media (max-width: 480px) {
  .content-header h2 { font-size: 15px; }
  .content-header .module-icon { font-size: 18px; }
  .stats-panel { flex-wrap: nowrap; overflow-x: auto; }
  .stat-card { min-width: 72px; padding: 6px 10px; }
  .stat-card .stat-value { font-size: 16px; }
  .stat-card .stat-label { font-size: 11px; }

  .data-table .hide-mobile { display: none; }
  .data-table th, .data-table td { padding: 6px 8px; font-size: 12px; }

  .btn { padding: 6px 12px; font-size: 12px; }
  .bottom-nav-item { font-size: 9px; }
  .bottom-nav-item .bn-icon { font-size: 18px; }
}

/* ---- 滚动条美化 ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* ---- 打印样式 ---- */
@media print {
  .sidebar, .bottom-nav, .toolbar, .content-header .btn { display: none; }
  .main-content { margin-left: 0; }
}
