/* ============================================
   Todo for Notion - Microsoft ToDo Style CSS
   ============================================ */

/* CSS Custom Properties (Light Theme) */
:root {
  --primary: #2564CF;
  --primary-hover: #1B4A9E;
  --primary-light: #EBF1FB;
  --bg: #FAF9F8;
  --surface: #FFFFFF;
  --text-primary: #323130;
  --text-secondary: #605E5C;
  --text-tertiary: #A19F9D;
  --border: #EDEBE9;
  --border-light: #F3F2F1;
  --star-yellow: #FFB900;
  --star-yellow-hover: #E8A517;
  --danger: #D13438;
  --danger-hover: #A4262C;
  --success: #107C10;
  --sidebar-bg: #EBF1FB;
  --sidebar-hover: #D9E8FC;
  --sidebar-active: #CFE0FC;
  --overlay: rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --sidebar-width: 280px;
  --detail-width: 360px;
  --header-height: 56px;
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 250ms ease;
}

/* Dark Theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #4A90D9;
    --primary-hover: #6BA3E0;
    --primary-light: #1A3050;
    --bg: #1F1F1F;
    --surface: #2D2D2D;
    --text-primary: #FFFFFF;
    --text-secondary: #C8C6C4;
    --text-tertiary: #8A8886;
    --border: #3D3D3D;
    --border-light: #333333;
    --sidebar-bg: #252525;
    --sidebar-hover: #333333;
    --sidebar-active: #3A3A3A;
    --overlay: rgba(0, 0, 0, 0.6);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
  }
}

[data-theme="dark"] {
  --primary: #4A90D9;
  --primary-hover: #6BA3E0;
  --primary-light: #1A3050;
  --bg: #1F1F1F;
  --surface: #2D2D2D;
  --text-primary: #FFFFFF;
  --text-secondary: #C8C6C4;
  --text-tertiary: #8A8886;
  --border: #3D3D3D;
  --border-light: #333333;
  --sidebar-bg: #252525;
  --sidebar-hover: #333333;
  --sidebar-active: #3A3A3A;
  --overlay: rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

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

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

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* View System */
.view {
  height: 100vh;
  width: 100vw;
  position: absolute;
  top: 0;
  left: 0;
}

.view.hidden {
  display: none !important;
}

/* ============================================
   Buttons
   ============================================ */

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
  font-family: inherit;
}

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

.btn-primary:active {
  transform: scale(0.98);
}

.btn-large {
  height: 48px;
  padding: 0 32px;
  min-width: 200px;
}

.btn-full {
  width: 100%;
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

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

.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 20px;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

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

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

.btn-danger-text:hover {
  color: var(--danger-hover);
  background: rgba(209, 52, 56, 0.08);
}

.btn-add {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition-fast);
}

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

.btn-add.hidden {
  display: none;
}

/* ============================================
   Login View
   ============================================ */

#view-login {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-container {
  text-align: center;
  padding: 40px;
  max-width: 400px;
}

.login-icon {
  margin-bottom: 24px;
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.login-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 40px;
}

.login-links {
  margin-top: 32px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.login-links a {
  color: var(--text-secondary);
  text-decoration: none;
}

.login-links a:hover {
  text-decoration: underline;
}

.login-links span {
  margin: 0 8px;
}

/* ============================================
   Setup View
   ============================================ */

#view-setup {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: var(--bg);
  overflow-y: auto;
  padding: 60px 20px;
}

.setup-container {
  max-width: 480px;
  width: 100%;
}

.setup-step.hidden {
  display: none;
}

.setup-header {
  margin-bottom: 24px;
}

.setup-header h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.setup-header p {
  color: var(--text-secondary);
  line-height: 1.5;
}

.setup-header .btn-text {
  margin-bottom: 12px;
  padding: 4px 0;
}

/* Database list */
.db-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.db-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.db-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.db-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.db-card-icon {
  margin-right: 8px;
}

.db-card-info {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Property mappings */
.property-mappings {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.mapping-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.mapping-label {
  font-size: 14px;
  font-weight: 600;
  min-width: 100px;
  color: var(--text-primary);
}

.mapping-required {
  color: var(--danger);
  font-size: 12px;
  margin-left: 2px;
}

.mapping-select {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

.mapping-select:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

/* ============================================
   Main View Layout
   ============================================ */

#view-main {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 98;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  z-index: 99;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.sidebar-close {
  display: none;
}

.nav-lists {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  user-select: none;
  gap: 12px;
}

.nav-item:hover {
  background: var(--sidebar-hover);
}

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

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

.nav-label {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 400;
}

.nav-separator {
  height: 1px;
  background: var(--border);
  margin: 4px 12px;
  list-style: none;
}

.nav-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  padding: 12px 12px 4px;
  list-style: none;
}

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.btn-sidebar-action {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition-fast);
}

.btn-sidebar-action:hover {
  background: var(--sidebar-hover);
}

/* ============================================
   Content Area
   ============================================ */

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
  position: relative;
}

.content-header {
  display: flex;
  align-items: center;
  padding: 16px 24px;
  height: var(--header-height);
  flex-shrink: 0;
  gap: 12px;
}

.btn-menu {
  display: none;
}

.header-text {
  flex: 1;
  min-width: 0;
}

.content-header h1 {
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#content-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
}

.btn-refresh {
  color: var(--text-tertiary);
}

.btn-refresh:hover {
  color: var(--text-secondary);
}

.btn-refresh.spinning svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ============================================
   Tasks Container
   ============================================ */

.tasks-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.task-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 16px;
}

.task-list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
  text-align: center;
}

.task-list-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.task-list-empty-text {
  font-size: 15px;
  line-height: 1.5;
}

/* Task Section */
.task-section {
  margin-bottom: 8px;
}

.task-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  cursor: pointer;
  user-select: none;
}

.task-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.task-section-count {
  font-size: 12px;
  color: var(--text-tertiary);
}

.task-section-toggle {
  font-size: 10px;
  color: var(--text-tertiary);
  transition: transform var(--transition-fast);
}

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

.task-section-items.collapsed {
  display: none;
}

/* ============================================
   Task Item
   ============================================ */

.task-item {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 8px 16px;
  background: var(--surface);
  border-radius: var(--radius-md);
  margin-bottom: 2px;
  cursor: pointer;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
  gap: 12px;
  border: 1px solid transparent;
}

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

.task-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* Task Checkbox */
.task-check {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.check-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  font-size: 12px;
  color: transparent;
}

.task-check:hover .check-circle {
  border-color: var(--primary);
  background: var(--primary-light);
}

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

@keyframes checkmark-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.task-check.just-checked .check-circle {
  animation: checkmark-pop 300ms ease;
}

/* Task Content */
.task-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-title {
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

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

.due-badge {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.due-badge.overdue {
  color: var(--danger);
}

.due-badge.today {
  color: var(--primary);
  font-weight: 600;
}

.list-badge {
  font-size: 11px;
  color: var(--text-tertiary);
  background: var(--border-light);
  padding: 1px 8px;
  border-radius: 10px;
}

.notes-indicator {
  font-size: 12px;
  opacity: 0.6;
}

.myday-indicator {
  font-size: 12px;
  opacity: 0.7;
}

/* Task Star */
.task-star {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-tertiary);
  padding: 4px;
  flex-shrink: 0;
  transition: color var(--transition-fast), transform var(--transition-fast);
  line-height: 1;
}

.task-star:hover {
  color: var(--star-yellow);
  transform: scale(1.1);
}

.task-star.starred {
  color: var(--star-yellow);
}

/* Completed task styling */
.task-item.done {
  opacity: 0.6;
}

.task-item.done .task-title {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

/* ============================================
   Task Input
   ============================================ */

.task-input {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  gap: 12px;
  flex-shrink: 0;
}

.input-circle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-input.focused .input-circle svg circle {
  stroke: var(--primary);
}

#new-task-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: transparent;
}

#new-task-input::placeholder {
  color: var(--text-tertiary);
}

/* ============================================
   Detail Panel
   ============================================ */

.detail-panel {
  width: var(--detail-width);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  right: 0;
  top: 0;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
  z-index: 50;
}

.detail-panel.open {
  transform: translateX(0);
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 16px;
  flex-shrink: 0;
}

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px 24px;
}

.detail-title-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.detail-title-row .task-check {
  margin-top: 4px;
}

.detail-title-input {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  border: none;
  outline: none;
  color: var(--text-primary);
  background: transparent;
  font-family: inherit;
  padding: 2px 0;
  min-width: 0;
}

.detail-title-input::placeholder {
  color: var(--text-tertiary);
}

.detail-title-row .task-star {
  margin-top: 2px;
}

/* Detail Fields */
.detail-fields {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
}

.detail-field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.detail-field:hover {
  background: var(--border-light);
}

.detail-field-icon {
  font-size: 16px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.detail-field-label {
  font-size: 13px;
  color: var(--text-tertiary);
  min-width: 70px;
}

.detail-field-value {
  flex: 1;
  min-width: 0;
}

.detail-field input[type="date"],
.detail-field select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  width: 100%;
  cursor: pointer;
}

.detail-field input[type="date"]:focus,
.detail-field select:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.detail-myday-toggle {
  cursor: pointer;
}

.detail-myday-toggle.active {
  color: var(--primary);
}

.detail-myday-toggle.active .btn-text {
  color: var(--primary);
  font-weight: 600;
}

/* Notes */
.detail-notes-section {
  margin-top: 8px;
}

.detail-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: block;
}

.detail-notes {
  width: 100%;
  min-height: 80px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  resize: vertical;
  line-height: 1.5;
}

.detail-notes:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.detail-notes::placeholder {
  color: var(--text-tertiary);
}

/* Detail Footer */
.detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.detail-created {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ============================================
   Modal
   ============================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
}

.modal-content {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.modal-body {
  padding: 8px 24px 24px;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

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

.setting-item label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.setting-value {
  font-size: 14px;
  color: var(--text-secondary);
}

.setting-input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  width: 200px;
  text-align: right;
}

.setting-input:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.setting-item select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  cursor: pointer;
}

/* ============================================
   Toast / Snackbar
   ============================================ */

#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--text-primary);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 300ms ease forwards;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.error {
  background: var(--danger);
  color: white;
}

.toast.removing {
  animation: toast-out 300ms ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

/* ============================================
   Loading
   ============================================ */

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
  align-self: center;
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.task-list-loading {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}

.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-task {
  height: 52px;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   Responsive (Mobile < 768px)
   ============================================ */

@media (max-width: 767px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-close {
    display: flex;
  }

  .btn-menu {
    display: flex;
  }

  .content-header {
    padding: 12px 16px;
  }

  .detail-panel {
    width: 100%;
    box-shadow: none;
  }

  .task-item {
    padding: 8px 12px;
  }

  .task-input {
    padding: 10px 12px;
  }
}

/* ============================================
   Desktop adjustments
   ============================================ */

@media (min-width: 768px) {
  .sidebar-close {
    display: none;
  }

  .sidebar-overlay {
    display: none !important;
  }

  .btn-menu {
    display: none;
  }
}

/* ============================================
   Privacy / Terms pages
   ============================================ */

.legal-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 24px;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg);
  min-height: 100vh;
}

.legal-page h1 {
  font-size: 28px;
  margin-bottom: 8px;
}

.legal-page .legal-updated {
  color: var(--text-tertiary);
  font-size: 13px;
  margin-bottom: 32px;
}

.legal-page h2 {
  font-size: 18px;
  margin-top: 32px;
  margin-bottom: 12px;
}

.legal-page p {
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.legal-page ul {
  margin-bottom: 12px;
  padding-left: 24px;
  color: var(--text-secondary);
}

.legal-page li {
  margin-bottom: 6px;
}

.legal-page a {
  color: var(--primary);
}

.legal-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 24px;
}

.legal-back:hover {
  text-decoration: underline;
}

/* ============================================
   Utility
   ============================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
