/* CSS Variables - Design System */
:root {
  --bg-primary: #FAF8F5;
  --bg-secondary: #F2EDE6;
  --bg-tertiary: #E8E2D9;
  --text-primary: #2D2926;
  --text-secondary: #5C574F;
  --text-tertiary: #8F8981;
  --accent: #4A7C6F;
  --accent-soft: #E8F0ED;
  --accent-hover: #3D6A5E;
  --energy-low: #A8C5B8;
  --energy-med: #D4B896;
  --energy-high: #C49A9A;
  --ai-accent: #9B8FBF;
  --ai-bg: #F5F3F8;
  --white: #FFFFFF;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

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

html {
  font-size: 16px;
}

body {
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 100px;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  line-height: 1.2;
}

/* Container */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 32px;
}

.date {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.title {
  font-size: 2.5rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Priority Section */
.priority-section {
  margin-bottom: 24px;
}

.priority-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Priority Card */
.priority-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.priority-card.rank-1 {
  border-left: 4px solid var(--accent);
}

.priority-card.rank-2 {
  border-left: 4px solid var(--energy-med);
}

.priority-card.rank-3 {
  border-left: 4px solid var(--energy-low);
}

.priority-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.priority-card.rank-2 .priority-rank {
  background: #F5EFE6;
  color: #A68A5B;
}

.priority-card.rank-3 .priority-rank {
  background: #E8F0ED;
  color: #6B9B8A;
}

.priority-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.priority-description {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.priority-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
  gap: 4px;
}

.meta-badge.energy-low {
  background: var(--energy-low);
  color: #2D4A3E;
}

.meta-badge.energy-medium {
  background: var(--energy-med);
  color: #5A4832;
}

.meta-badge.energy-high {
  background: var(--energy-high);
  color: #5A3232;
}

.meta-badge.time {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.meta-badge.deadline {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.meta-badge.deadline.urgent {
  background: #FDEAEA;
  color: #9B3F3F;
}

/* AI Reasoning Box */
.ai-reasoning {
  background: var(--ai-bg);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  border-left: 3px solid var(--ai-accent);
}

.ai-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ai-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.ai-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Complete Button */
.complete-btn {
  width: 100%;
  padding: 12px 16px;
  background: var(--accent-soft);
  color: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.complete-btn:hover {
  background: var(--accent);
  color: var(--white);
}

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

/* Prioritize Button */
.prioritize-container {
  display: flex;
  justify-content: center;
  margin-bottom: 32px;
}

.prioritize-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--ai-accent), #7B6FA3);
  color: var(--white);
  border: none;
  border-radius: var(--radius-full);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.prioritize-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

.prioritize-icon {
  font-size: 1rem;
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--bg-tertiary);
}

.divider-text {
  padding: 0 16px;
  font-size: 0.875rem;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Task List (Regular) */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.task-checkbox {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 2px solid var(--bg-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.task-checkbox:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.task-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.task-checkbox.checked::after {
  content: '\2713';
  color: var(--white);
  font-size: 0.875rem;
  font-weight: 600;
}

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

.task-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

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

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.task-meta .meta-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
}

.task-delete {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 1.25rem;
}

.task-delete:hover {
  background: #FDEAEA;
  color: #9B3F3F;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  display: none;
}

.empty-state.visible {
  display: block;
}

.empty-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-subtitle {
  font-size: 0.9375rem;
  color: var(--text-tertiary);
}

/* Floating Action Button */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--white);
  border: none;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
  z-index: 100;
}

.fab:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.fab:active {
  transform: scale(0.95);
}

.fab-icon {
  font-size: 2rem;
  line-height: 1;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--white);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
  }

  .modal {
    border-radius: var(--radius-lg);
    max-height: 85vh;
  }
}

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

.modal-title {
  font-size: 1.5rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.modal-close:hover {
  background: var(--bg-tertiary);
}

/* Form */
.form-group {
  margin-bottom: 20px;
}

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

.form-group input[type="text"],
.form-group input[type="datetime-local"],
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--white);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

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

/* Pill Group */
.pill-group {
  display: flex;
  gap: 8px;
}

.pill {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-full);
  background: var(--white);
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.pill.active[data-value="low"] {
  background: var(--energy-low);
  border-color: var(--energy-low);
  color: #2D4A3E;
}

.pill.active[data-value="medium"] {
  background: var(--energy-med);
  border-color: var(--energy-med);
  color: #5A4832;
}

.pill.active[data-value="high"] {
  background: var(--energy-high);
  border-color: var(--energy-high);
  color: #5A3232;
}

/* Chip Group */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 14px;
  border: 1px solid var(--bg-tertiary);
  border-radius: var(--radius-md);
  background: var(--white);
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Submit Button */
.submit-btn {
  width: 100%;
  padding: 14px 24px;
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

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

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

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--bg-tertiary);
  border-top-color: var(--ai-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

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

.loading-text {
  font-size: 1rem;
  color: var(--text-secondary);
}

/* Completed Tasks */
.completed-list .task-card {
  opacity: 0.7;
}

.completed-divider {
  margin-top: 32px;
}

/* Responsive */
@media (max-width: 480px) {
  .container {
    padding: 16px;
  }

  .title {
    font-size: 2rem;
  }

  .priority-card {
    padding: 16px;
  }

  .priority-title {
    font-size: 1.125rem;
  }

  .pill-group {
    flex-wrap: wrap;
  }

  .pill {
    flex: none;
    min-width: calc(50% - 4px);
  }
}
