/* LifeOS — Premium Dark Theme Styles */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a2e;
  --bg-card: #16162a;
  --bg-hover: #1e1e3a;
  --bg-input: #1a1a2e;
  --border: #2a2a4a;
  --border-light: #333366;
  --text-primary: #e8e8f0;
  --text-secondary: #9999bb;
  --text-muted: #666688;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, .25);
  --accent-bg: rgba(99, 102, 241, .1);
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, .1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, .1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, .1);
  --info: #06b6d4;
  --info-bg: rgba(6, 182, 212, .1);
  --sidebar-w: 240px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 4px 24px rgba(0, 0, 0, .4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .3);
  --transition: .2s cubic-bezier(.4, 0, .2, 1);
}

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

html {
  font-size: 15px;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  outline: none;
}

input,
textarea,
select {
  font-family: inherit;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  font-size: .9rem;
  transition: border-color var(--transition);
}

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

select option {
  background: var(--bg-secondary);
}

/* Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.sidebar-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -.5px;
}

.sidebar-subtitle {
  font-size: .7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: .9rem;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
  background: none;
  width: 100%;
  text-align: left;
}

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

.nav-item.active {
  background: var(--accent-bg);
  color: var(--accent-light);
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: .75rem;
  color: var(--text-muted);
  text-align: center;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 32px;
  min-height: 100vh;
  animation: fadeIn .3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -.5px;
  margin-bottom: 4px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: .9rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--transition);
}

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

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-xs);
  font-size: .85rem;
  font-weight: 500;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

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

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

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

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

.btn-sm {
  padding: 5px 10px;
  font-size: .8rem;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-size: 1rem;
}

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

/* Grid */
.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Dashboard Widgets */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -.5px;
}

.stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Badges & Tags */
.badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.badge-high {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-medium {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-low {
  background: var(--info-bg);
  color: var(--info);
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-accent {
  background: var(--accent-bg);
  color: var(--accent-light);
}

/* Task List */
.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: all var(--transition);
}

.task-item:hover {
  border-color: var(--border-light);
}

.task-item.completed {
  opacity: .5;
}

.task-item.completed .task-title-text {
  text-decoration: line-through;
}

.task-item.overdue {
  border-left: 3px solid var(--danger);
}

.task-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: transparent;
  font-size: .7rem;
}

.task-check:hover {
  border-color: var(--accent);
}

.task-check.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.task-info {
  flex: 1;
  min-width: 0;
}

.task-title-text {
  font-weight: 500;
  font-size: .9rem;
}

.task-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  flex-wrap: wrap;
}

.task-meta span {
  font-size: .75rem;
  color: var(--text-muted);
}

.task-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}

.task-item:hover .task-actions {
  opacity: 1;
}

/* Filters */
.filters-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 500;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-chip:hover {
  border-color: var(--accent);
}

.filter-chip.active {
  background: var(--accent-bg);
  color: var(--accent-light);
  border-color: var(--accent);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .2s ease;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 20px;
}

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

.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

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

.form-row>* {
  flex: 1;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

input[type="text"],
input[type="date"],
input[type="time"],
textarea,
select {
  width: 100%;
}

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

/* Progress Bar */
.progress-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .5s ease;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
}

/* Goal Card */
.goal-card {
  margin-bottom: 12px;
}

.goal-card .milestone-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: .85rem;
}

/* Time Blocks */
.timeline {
  position: relative;
  padding-left: 60px;
}

.time-label {
  position: absolute;
  left: 0;
  font-size: .75rem;
  color: var(--text-muted);
  width: 50px;
  text-align: right;
}

.time-block {
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  margin-bottom: 4px;
  border-left: 3px solid var(--accent);
  font-size: .85rem;
  position: relative;
  transition: all var(--transition);
}

.time-block:hover {
  transform: translateX(4px);
}

.time-block .tb-title {
  font-weight: 500;
}

.time-block .tb-time {
  font-size: .75rem;
  color: var(--text-muted);
}

/* Habit Grid */
.habit-grid {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.habit-cell {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  transition: all var(--transition);
}

.habit-cell.empty {
  background: var(--bg-tertiary);
}

.habit-cell.filled {
  background: var(--accent);
}

.habit-cell.partial {
  background: rgba(99, 102, 241, .4);
}

.habit-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.habit-check {
  cursor: pointer;
}

.streak-badge {
  font-size: .75rem;
  color: var(--warning);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Pomodoro */
.pomodoro-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 40px 0;
}

.timer-ring {
  position: relative;
  width: 260px;
  height: 260px;
}

.timer-ring svg {
  transform: rotate(-90deg);
}

.timer-ring circle {
  fill: none;
  stroke-width: 6;
}

.timer-ring .ring-bg {
  stroke: var(--bg-tertiary);
}

.timer-ring .ring-progress {
  stroke: var(--accent);
  stroke-linecap: round;
  transition: stroke-dashoffset .5s ease;
}

.timer-display {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.timer-time {
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
}

.timer-label {
  font-size: .85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.timer-controls {
  display: flex;
  gap: 12px;
}

.timer-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all var(--transition);
}

.timer-btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.timer-btn.primary:hover {
  transform: scale(1.08);
}

.timer-btn.secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

/* Notes */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.note-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: default;
  transition: all var(--transition);
  position: relative;
}

.note-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.note-card .note-title {
  font-weight: 600;
  margin-bottom: 8px;
  font-size: .95rem;
}

.note-card .note-body {
  font-size: .85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.note-card .note-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.note-tag {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: .7rem;
  font-weight: 500;
  background: var(--accent-bg);
  color: var(--accent-light);
}

.note-card .note-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition);
}

.note-card:hover .note-actions {
  opacity: 1;
}

/* Quote */
.quote-card {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-tertiary));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.quote-card::before {
  content: '"';
  position: absolute;
  top: -10px;
  left: 12px;
  font-size: 6rem;
  color: var(--accent);
  opacity: .15;
  font-family: Georgia, serif;
}

.quote-text {
  font-size: 1rem;
  font-style: italic;
  line-height: 1.6;
  color: var(--text-primary);
  position: relative;
}

.quote-author {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 10px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: .5;
}

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

/* Tooltip & Tags Input */
.tags-input {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px;
}

.tag-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--accent-bg);
  color: var(--accent-light);
  border-radius: 12px;
  font-size: .75rem;
}

.tag-remove {
  cursor: pointer;
  font-size: .8rem;
}

/* Search */
.search-input {
  position: relative;
  margin-bottom: 16px;
}

.search-input input {
  padding-left: 36px;
}

.search-input .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .9rem;
}

/* Productivity Score */
.score-ring {
  position: relative;
  width: 100px;
  height: 100px;
}

.score-ring svg {
  transform: rotate(-90deg);
}

.score-ring circle {
  fill: none;
  stroke-width: 8;
}

.score-ring .score-bg {
  stroke: var(--bg-tertiary);
}

.score-ring .score-fill {
  stroke: var(--accent);
  stroke-linecap: round;
}

.score-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
}

/* Calendar Grid */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cal-header {
  background: var(--bg-tertiary);
  padding: 10px 4px;
  text-align: center;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.cal-cell {
  background: var(--bg-card);
  min-height: 100px;
  padding: 6px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cal-cell:hover {
  background: var(--bg-hover);
}

.cal-cell.cal-other {
  opacity: .4;
}

.cal-cell.cal-today {
  background: var(--accent-bg);
}

.cal-cell.cal-selected {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.cal-day {
  font-size: .8rem;
  font-weight: 500;
  margin-bottom: 2px;
  color: var(--text-secondary);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-day-today {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-weight: 700;
}

.cal-event {
  font-size: .68rem;
  padding: 2px 5px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: all var(--transition);
  border-left: 2px solid;
}

.cal-event:hover {
  filter: brightness(1.2);
}

.cal-more {
  font-size: .65rem;
  color: var(--text-muted);
  padding: 1px 4px;
}

/* Category Colors */
.cat-work {
  background: rgba(99, 102, 241, .15);
  border-color: #6366f1;
  color: #818cf8;
}

.cat-personal {
  background: rgba(168, 85, 247, .15);
  border-color: #a855f7;
  color: #c084fc;
}

.cat-health {
  background: rgba(34, 197, 94, .15);
  border-color: #22c55e;
  color: #4ade80;
}

.cat-finance {
  background: rgba(245, 158, 11, .15);
  border-color: #f59e0b;
  color: #fbbf24;
}

.cat-learning {
  background: rgba(6, 182, 212, .15);
  border-color: #06b6d4;
  color: #22d3ee;
}

.cat-other {
  background: rgba(156, 163, 175, .15);
  border-color: #9ca3af;
  color: #d1d5db;
}

.tb-cat-work {
  background: rgba(99, 102, 241, .12);
  border-left-color: #6366f1;
}

.tb-cat-personal {
  background: rgba(168, 85, 247, .12);
  border-left-color: #a855f7;
}

.tb-cat-health {
  background: rgba(34, 197, 94, .12);
  border-left-color: #22c55e;
}

.tb-cat-finance {
  background: rgba(245, 158, 11, .12);
  border-left-color: #f59e0b;
}

.tb-cat-learning {
  background: rgba(6, 182, 212, .12);
  border-left-color: #06b6d4;
}

.tb-cat-other {
  background: rgba(156, 163, 175, .12);
  border-left-color: #9ca3af;
}

/* Mobile Hamburger */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  z-index: 90;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.hamburger {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-primary);
  font-size: 1.3rem;
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 95;
}

.mobile-overlay.show {
  display: block;
}

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    z-index: 100;
  }

  .main-content {
    margin-left: 0;
    padding: 72px 16px 24px;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .form-row {
    flex-direction: column;
  }

  .filters-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 8px;
  }

  .task-actions {
    opacity: 1;
  }

  .note-card .note-actions {
    opacity: 1;
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: 1.4rem;
  }

  .stat-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .timer-ring {
    width: 200px;
    height: 200px;
  }

  .timer-time {
    font-size: 2.5rem;
  }
}