/* ===== Google Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ===== CSS Variables (matching HomeOps theme) ===== */
:root {
  --radius: 0.625rem;
  --background: oklch(0.97 0.015 85);
  --foreground: oklch(0.25 0.02 50);
  --card: oklch(0.99 0.008 90);
  --card-foreground: oklch(0.25 0.02 50);
  --popover: oklch(0.99 0.008 90);
  --popover-foreground: oklch(0.25 0.02 50);
  --primary: oklch(0.35 0.08 55);
  --primary-foreground: oklch(0.98 0.01 90);
  --secondary: oklch(0.93 0.02 85);
  --secondary-foreground: oklch(0.3 0.04 55);
  --muted: oklch(0.92 0.02 85);
  --muted-foreground: oklch(0.5 0.03 55);
  --accent: oklch(0.72 0.15 55);
  --accent-foreground: oklch(0.99 0.01 90);
  --destructive: oklch(0.55 0.2 25);
  --destructive-foreground: #fff;
  --border: oklch(0.88 0.02 85);
  --input: oklch(0.9 0.02 85);
  --ring: oklch(0.65 0.15 55);
  --emerald-600: oklch(0.60 0.17 160);
}

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

html {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--background);
  color: var(--foreground);
  min-height: 100svh;
  padding-bottom: env(safe-area-inset-bottom, 0);
  line-height: 1.5;
  font-size: 14px;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
  color: inherit;
}

input {
  font-family: inherit;
  font-size: inherit;
}

/* ===== Layout Utilities ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.gap-0-5 { gap: 0.125rem; }
.gap-1 { gap: 0.25rem; }
.gap-1-5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.min-w-0 { min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.w-full { width: 100%; }
.min-h-svh { min-height: 100svh; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.relative { position: relative; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }

/* ===== Typography ===== */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.05em; }
.italic { font-style: italic; }
.line-through { text-decoration: line-through; }

/* ===== Color Classes ===== */
.text-foreground { color: var(--foreground); }
.text-muted-foreground { color: var(--muted-foreground); }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-destructive { color: var(--destructive); }
.text-accent-foreground { color: var(--accent-foreground); }
.bg-background { background: var(--background); }
.bg-card { background: var(--card); }
.bg-muted { background: var(--muted); }
.bg-secondary { background: var(--secondary); }
.bg-accent { background: var(--accent); }
.bg-destructive { background: var(--destructive); }

/* ===== Card ===== */
.card {
  background: var(--card);
  color: var(--card-foreground);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  padding: 1.5rem 0;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 1.5rem;
}

.card-title {
  font-weight: 600;
  line-height: 1;
}

.card-description {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.card-content {
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card-footer {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0 1.5rem;
}

/* ===== Button ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
  outline: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  height: 2.25rem;
  padding: 0.5rem 1rem;
}

.btn:disabled {
  pointer-events: none;
  opacity: 0.5;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}
.btn-primary:hover { opacity: 0.9; }

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}
.btn-secondary:hover { background: oklch(0.91 0.02 85); }

.btn-ghost {
  background: transparent;
  color: inherit;
}
.btn-ghost:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.btn-sm {
  height: 2rem;
  padding: 0 0.75rem;
  font-size: 0.75rem;
  gap: 0.25rem;
  border-radius: calc(var(--radius) - 2px);
}

.btn-icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
}

.btn-icon-sm {
  width: 2rem;
  height: 2rem;
  padding: 0;
}

.btn-round {
  border-radius: 9999px;
}

.btn-accent {
  background: var(--accent);
  color: var(--accent-foreground);
}
.btn-accent:hover { opacity: 0.9; }

.btn-w-full { width: 100%; }

/* ===== Input ===== */
.input {
  height: 2.25rem;
  width: 100%;
  min-width: 0;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--input);
  background: transparent;
  padding: 0.25rem 0.75rem;
  font-size: 1rem;
  color: var(--foreground);
  box-shadow: 0 1px 1px 0 rgb(0 0 0 / 0.03);
  transition: box-shadow 0.15s, border-color 0.15s;
  outline: none;
}

.input::placeholder {
  color: var(--muted-foreground);
}

.input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px oklch(0.65 0.15 55 / 0.2);
}

.input-round {
  border-radius: 9999px;
  background: oklch(0.92 0.02 85 / 0.5);
  border-color: var(--border);
  box-shadow: none;
  padding: 0.5rem 0.75rem;
}

.input-round:focus {
  box-shadow: none;
  border-color: var(--border);
}

/* ===== Form Field ===== */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-field label {
  font-size: 0.875rem;
  font-weight: 500;
}

/* ===== Header ===== */
.workspace-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
  background: var(--background);
  padding: 0.75rem 1rem 0.5rem;
}

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

.workspace-header .sprint-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

.workspace-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-bell {
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: oklch(0.93 0.02 85 / 0.8);
  color: var(--muted-foreground);
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.header-bell:hover {
  background: var(--secondary);
}

/* ===== Task Input Bar ===== */
.task-input-bar {
  border-bottom: 1px solid var(--border);
  background: var(--background);
  padding: 0.75rem 1rem;
}

.task-input-bar form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ===== Sprint Selector ===== */
.sprint-selector-btn {
  height: 2rem;
  gap: 0.25rem;
  border-radius: 9999px;
  background: oklch(0.93 0.02 85 / 0.8);
  color: var(--muted-foreground);
  padding: 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
  position: relative;
}

.sprint-selector-btn:hover {
  background: var(--secondary);
}

.sprint-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 50;
  min-width: 10rem;
  background: var(--popover);
  color: var(--popover-foreground);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.25rem;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  display: none;
}

.sprint-dropdown.open {
  display: block;
}

.sprint-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.375rem 0.5rem;
  font-size: 0.875rem;
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  text-align: left;
  transition: background 0.1s;
}

.sprint-dropdown-item:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

/* ===== Add Button ===== */
.add-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background: var(--accent);
  color: var(--accent-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}

.add-btn:hover { opacity: 0.9; }

/* ===== Section Header ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
}

.section-header .left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

.section-dot-accent { background: var(--accent); }
.section-dot-muted { background: oklch(0.5 0.03 55 / 0.6); }

.section-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--foreground);
}

.section-meta {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* ===== Sprint Drop Zone ===== */
.sprint-drop-zone {
  min-height: 2rem;
  border-radius: 0.5rem;
  transition: background 0.15s, box-shadow 0.15s;
}

.sprint-drop-zone.drag-over {
  background: oklch(0.72 0.15 55 / 0.15);
  box-shadow: inset 0 0 0 1px oklch(0.72 0.15 55 / 0.5);
}

/* ===== Task Item ===== */
.task-item {
  position: relative;
  overflow: hidden;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  margin-bottom: 0.5rem;
}

.task-item:last-child { margin-bottom: 0; }

.task-swipe-actions {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  display: flex;
  width: 120px;
}

.swipe-action-priority {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background: oklch(0.72 0.15 55 / 0.9);
  color: var(--accent-foreground);
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  transition: background 0.1s;
}

.swipe-action-priority:active { background: var(--accent); }

.swipe-action-priority.is-high {
  background: var(--accent);
}

.swipe-action-delete {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background: var(--destructive);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  transition: background 0.1s;
}

.swipe-action-delete:active {
  background: oklch(0.5 0.18 25);
}

.task-card {
  position: relative;
  z-index: 10;
  border-radius: 0.75rem;
  background: var(--card);
  padding: 0.625rem 0.75rem;
  transition: transform 0.2s ease-out;
  user-select: none;
  -webkit-user-select: none;
}

.task-card.swiping {
  transition: none;
}

.task-card.completed {
  opacity: 0.8;
}

.task-card-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Drag Handle */
.drag-handle {
  cursor: grab;
  touch-action: none;
  border-radius: 0.25rem;
  padding: 0.125rem;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  transition: background 0.1s, color 0.1s;
}

.drag-handle:hover {
  background: var(--muted);
  color: var(--foreground);
}

.drag-handle:active {
  cursor: grabbing;
}

/* Task Content */
.task-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

/* Checkbox Circle */
.task-check {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 2px solid var(--accent);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
  color: transparent;
}

.task-check.checked {
  border-color: var(--emerald-600);
  background: var(--emerald-600);
  color: white;
}

/* Task Text Area */
.task-text-area {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
}

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

.task-label {
  font-size: 0.75rem;
  font-weight: 500;
}

.task-label.high { color: var(--accent); }
.task-label.done {
  color: var(--muted-foreground);
  font-style: italic;
  text-decoration: line-through;
}

/* Task Actions */
.task-actions {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  flex-shrink: 0;
}

.task-action-btn {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted-foreground);
  transition: background 0.1s, color 0.1s;
}

.task-action-btn:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.task-action-btn.star-active {
  color: var(--accent);
}

.task-action-btn.star-active:hover {
  color: var(--accent);
}

.task-action-btn.delete-btn:hover {
  color: var(--destructive);
  background: oklch(0.55 0.2 25 / 0.1);
}

/* ===== Collapsible Section ===== */
.collapsible-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.5rem 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

.collapsible-btn .left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.collapsible-chevron {
  color: var(--muted-foreground);
  transition: transform 0.2s;
  display: flex;
}

.collapsible-chevron.open {
  transform: rotate(180deg);
}

/* Upcoming cards row */
.upcoming-cards {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.upcoming-card {
  flex-shrink: 0;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--card);
  padding: 0.5rem 0.75rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.upcoming-card .sprint-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-foreground);
}

.upcoming-card .task-count {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
}

/* ===== Bottom Nav ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-top: 1px solid var(--border);
  background: var(--background);
  padding: 0.5rem 0.5rem;
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

.nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
  border-radius: 0.5rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 0.15s;
}

.nav-link:hover {
  color: var(--foreground);
}

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

.nav-link svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* ===== Task List Container ===== */
.task-list-container {
  padding: 0.75rem 1rem;
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding-bottom: 5rem;
}

/* ===== Empty State ===== */
.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* ===== Auth Pages ===== */
.auth-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 24rem;
}

.auth-link {
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
}

.auth-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ===== Placeholder Pages ===== */
.placeholder-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding-bottom: 5rem;
}

/* ===== SVG Icon sizing ===== */
.icon-sm { width: 1rem; height: 1rem; }
.icon-md { width: 1.25rem; height: 1.25rem; }
.icon-check { width: 0.875rem; height: 0.875rem; stroke-width: 2.5; }

/* ===== Dragging state ===== */
.task-item.dragging {
  opacity: 0.5;
}

/* ===== Responsive ===== */
@media (min-width: 640px) {
  .input { font-size: 0.875rem; }
}
