/* index.css */
/* Modern Enterprise CSS Framework & Design System for 专注创作 · 个人版 */

:root {
  /* Fonts */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
  --font-mono: 'Source Code Pro', monospace;

  /* Priority Colors */
  --color-p0: #f43f5e; /* Rose 500 */
  --color-p1: #f59e0b; /* Amber 500 */
  --color-p2: #3b82f6; /* Blue 500 */
  --color-p3: #6b7280; /* Gray 500 */

  /* Area Labels Colors */
  --color-personal: #10b981; /* Emerald */
  --color-studio: #8b5cf6; /* Violet */
  --color-ops: #ec4899; /* Pink */
  --color-life: #06b6d4; /* Cyan */

  /* Light Theme variables */
  --bg-base: #f8fafc;
  --bg-surface: rgba(255, 255, 255, 0.75);
  --bg-surface-opaque: #ffffff;
  --bg-elevated: #f1f5f9;
  
  --border-color: rgba(226, 232, 240, 0.8);
  --border-focus: #6366f1;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: rgba(79, 70, 229, 0.1);
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  
  --accent-color: #06b6d4;
  --accent-gradient: linear-gradient(135deg, #22d3ee 0%, #06b6d4 100%);
  
  --glass-bg: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(255, 255, 255, 0.6);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-inset: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

[data-theme="dark"] {
  /* Dark Theme overrides */
  --bg-base: #090d16;
  --bg-surface: rgba(18, 24, 38, 0.75);
  --bg-surface-opaque: #121826;
  --bg-elevated: #1a2233;
  
  --border-color: rgba(38, 48, 68, 0.6);
  --border-focus: #818cf8;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  
  --primary-color: #6366f1;
  --primary-hover: #818cf8;
  --primary-light: rgba(99, 102, 241, 0.2);
  --primary-gradient: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
  
  --accent-color: #22d3ee;
  --accent-gradient: linear-gradient(135deg, #67e8f9 0%, #22d3ee 100%);
  
  --glass-bg: rgba(18, 24, 38, 0.55);
  --glass-border: rgba(255, 255, 255, 0.05);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

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

body, html {
  height: 100%;
  width: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar styles */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Layout */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--bg-surface);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  z-index: 10;
}

.sidebar-header {
  padding: 0 8px 24px 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

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

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

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  background-color: var(--primary-color);
  border-radius: 0 4px 4px 0;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* Main Content */
.main-content {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: radial-gradient(circle at 10% 20%, var(--primary-light) 0%, transparent 40%);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-count {
  font-size: 12px;
  font-weight: 600;
  background-color: var(--primary-light);
  color: var(--primary-color);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  opacity: 0.95;
}

.btn-primary:active {
  transform: translateY(0);
}

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

.btn-ghost:hover {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}

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

.btn-danger:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-full);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  transform: scale(1.05);
}

/* Card */
.card {
  background-color: var(--bg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

/* Form Controls */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.input-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.input, .textarea, .select {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  background-color: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.input:focus, .textarea:focus, .select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.textarea {
  min-height: 100px;
  resize: vertical;
}

/* Grid helper */
.grid-3x3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  flex: 1;
}

.review-cell {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.review-cell:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
}

.review-cell-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}

.review-cell-editor {
  flex: 1;
  background: transparent;
  border: none;
  resize: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(9, 13, 22, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}

.modal {
  width: 100%;
  max-width: 560px;
  background-color: var(--bg-surface-opaque);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

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

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

.btn-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
}

.btn-close:hover {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background-color: var(--bg-base);
}

/* Toast System */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  max-width: 380px;
}

.toast {
  background-color: var(--bg-surface-opaque);
  border-left: 4px solid var(--primary-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}

.toast-success {
  border-left-color: var(--color-personal);
}
.toast-error {
  border-left-color: var(--color-p0);
}
.toast-warning {
  border-left-color: var(--color-p1);
}
.toast-info {
  border-left-color: var(--color-p2);
}

.toast-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

/* Tabs switcher */
.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0px;
}

.tab-item {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  margin-bottom: -1px;
}

.tab-item:hover {
  color: var(--text-primary);
}

.tab-item.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  font-weight: 600;
}

/* Task Tree items */
.tree-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background-color: var(--bg-surface);
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.tree-node {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
  cursor: pointer;
  position: relative;
  gap: 8px;
}

.tree-node:hover {
  background-color: var(--bg-elevated);
}

.tree-indent-line {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background-color: var(--border-color);
}

.tree-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.tree-toggle.collapsed {
  transform: rotate(-90deg);
}

.task-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

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

/* Badges */
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-p0 { background-color: rgba(244, 63, 94, 0.15); color: var(--color-p0); }
.badge-p1 { background-color: rgba(245, 158, 11, 0.15); color: var(--color-p1); }
.badge-p2 { background-color: rgba(59, 130, 246, 0.15); color: var(--color-p2); }
.badge-p3 { background-color: rgba(107, 114, 128, 0.15); color: var(--color-p3); }

.badge-area {
  background-color: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* Kanban */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  flex: 1;
  overflow-x: auto;
  align-items: start;
}

.kanban-column {
  background-color: rgba(18, 24, 38, 0.03);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 500px;
}

[data-theme="dark"] .kanban-column {
  background-color: rgba(255, 255, 255, 0.01);
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-color);
}

.kanban-column-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.column-todo { border-bottom-color: var(--color-p3); }
.column-doing { border-bottom-color: var(--color-p2); }
.column-blocked { border-bottom-color: var(--color-p0); }
.column-done { border-bottom-color: var(--color-personal); }

.kanban-cards-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 400px;
}

.kanban-card {
  background-color: var(--bg-surface-opaque);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--color-p3);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: grab;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kanban-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.kanban-card.p0 { border-left-color: var(--color-p0); }
.kanban-card.p1 { border-left-color: var(--color-p1); }
.kanban-card.p2 { border-left-color: var(--color-p2); }
.kanban-card.p3 { border-left-color: var(--color-p3); }

/* Progress bar */
.progress-bar-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.progress-bar {
  width: 100%;
  height: 6px;
  background-color: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* Animations */
@keyframes slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

.slide-up { animation: slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.fade-in { animation: fade-in 0.2s ease forwards; }
.fade-out { animation: fade-out 0.2s ease forwards; }

/* Auth CSS */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, var(--bg-elevated) 0%, var(--bg-base) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10000;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  text-align: center;
  padding: 40px 32px;
}

.auth-title {
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.w-full {
  width: 100%;
}

.quick-add-bar {
  display: flex;
  gap: 8px;
  width: 100%;
}

.quick-add-input {
  flex: 1;
}

/* Project studio split panel */
.studio-layout {
  display: flex;
  gap: 24px;
  height: 100%;
  min-height: 500px;
}

.studio-sidebar {
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.studio-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: 300px;
}

.list-item {
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.list-item:hover {
  background-color: var(--bg-elevated);
}

.list-item.active {
  border-color: var(--primary-color);
  background-color: var(--primary-light);
}

/* Funnel chart */
.funnel-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin: 16px 0;
}

.funnel-row {
  display: flex;
  align-items: center;
  height: 36px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  transition: width 0.5s ease-out;
}

.funnel-label {
  padding-left: 12px;
  white-space: nowrap;
}

/* Dashboard metric grid */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.metric-card {
  background-color: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-card-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color);
}

.metric-card-label {
  font-size: 11px;
  color: var(--text-secondary);
}

.reviews-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100%;
}

.reviews-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.reviews-date-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 600;
}

.mood-selector {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.mood-btn {
  font-size: 28px;
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease;
  filter: grayscale(80%);
}

.mood-btn:hover {
  transform: scale(1.2);
  filter: grayscale(0);
}

.mood-btn.active {
  transform: scale(1.3);
  filter: grayscale(0);
}

.due-alert {
  color: var(--color-p0);
  font-weight: 600;
}

.stale-badge {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--color-p1);
  border: 1px solid var(--color-p1);
}

/* Empty states */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
}

.empty-state-text {
  font-size: 14px;
  font-weight: 500;
}

/* Markdown editor toggle */
.editor-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}
