/* ===== CSS Variables ===== */
:root {
  --bg: #f7f5f2;
  --bg-warm: #faf8f5;
  --surface: #ffffff;
  --surface-2: #f0ede8;
  --surface-3: #e8e3db;
  --border: #e2ddd7;
  --border-light: #ede9e3;
  --text: #1a1814;
  --text-secondary: #4a4540;
  --muted: #6b6560;
  --accent: #c1756b;
  --accent-hover: #a85d53;
  --accent-light: #f5e8e5;
  --accent-text: #ffffff;
  --teal: #0f7e84;
  --teal-hover: #0a5f64;
  --teal-light: #e6f4f5;
  --ok: #5a8a4a;
  --ok-light: #edf5e9;
  --warn: #c7944a;
  --warn-light: #fdf5e9;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.08), 0 8px 32px rgba(0,0,0,.04);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sidebar-width: 240px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  overflow-y: auto;
}

.sidebar-header {
  padding: 28px 20px 20px;
  border-bottom: 1px solid var(--border-light);
  text-align: center;
}

.logo-icon {
  font-size: 36px;
  line-height: 1;
  margin-bottom: 8px;
}

.logo-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}

.logo-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

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

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

.sidebar-footer {
  padding: 16px 20px 24px;
  border-top: 1px solid var(--border-light);
  text-align: center;
}

.footer-text {
  font-size: 12px;
  color: var(--muted);
}

.hearts {
  color: var(--accent);
  font-size: 14px;
  margin-top: 4px;
  letter-spacing: 4px;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px 36px 60px;
  min-width: 0;
}

.dashboard-section {
  display: none;
  animation: fadeSlideIn 0.35s ease;
}

.dashboard-section.active {
  display: block;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Section Header ===== */
.section-header {
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}

.section-desc {
  font-size: 15px;
  color: var(--muted);
  margin-top: 4px;
}

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}

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

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

.card-header h3 {
  font-size: 17px;
  font-weight: 700;
}

.card-actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
}

/* ===== Badge ===== */
.badge {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--ok-light);
  color: var(--ok);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.3;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 16px;
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-accent {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: var(--shadow-sm);
}

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

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

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: var(--shadow);
}

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

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

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

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

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

/* ===== Task Input Row ===== */
.task-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.task-input {
  flex: 1;
  padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-warm);
  transition: border-color var(--transition);
  outline: none;
}

.task-input:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.task-input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

/* ===== Task List ===== */
.task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  transition: background var(--transition);
  cursor: pointer;
}

.task-item:hover {
  background: var(--surface-2);
}

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

.task-checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  font-size: 12px;
  color: transparent;
}

.task-item.completed .task-checkbox {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}

.task-label {
  flex: 1;
  font-size: 15px;
  color: var(--text);
  transition: color var(--transition);
}

.task-delete {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--transition);
}

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

.task-delete:hover {
  background: #fce4e4;
  color: #d44;
}

/* ===== Compliment Card ===== */
.compliment-card {
  text-align: center;
  padding: 36px 24px;
}

.compliment-display {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-secondary);
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--bg-warm);
  border: 1px dashed var(--border);
  margin-bottom: 20px;
  transition: all var(--transition);
  line-height: 1.5;
}

.compliment-display.active {
  color: var(--accent);
  font-size: 22px;
  font-weight: 700;
  background: var(--accent-light);
  border-color: var(--accent);
  border-style: solid;
  animation: pulse 0.6s ease;
}

@keyframes pulse {
  0% { transform: scale(1); }
  30% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.compliment-counter {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}

/* ===== Week Grid ===== */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.week-day {
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
  transition: all var(--transition);
  min-height: 100px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.week-day:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.week-day.today {
  border-color: var(--accent);
  background: var(--accent-light);
  border-width: 2px;
}

.week-day-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.week-day.today .week-day-label {
  color: var(--accent);
}

.week-day-date {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.week-day-plan {
  font-size: 12px;
  color: var(--teal);
  font-weight: 600;
  min-height: 18px;
  word-break: break-word;
}

.week-day-empty {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

/* ===== Date Edit ===== */
.date-edit-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.date-edit-input {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font);
  font-size: 12px;
  outline: none;
}

.date-edit-input:focus {
  border-color: var(--accent);
}

.date-edit-save {
  padding: 4px 8px;
  font-size: 11px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
}

.date-edit-save:hover {
  background: var(--accent-hover);
}

/* ===== Idea Chips ===== */
.date-idea-pool {
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
}

.date-idea-pool h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.idea-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.idea-chip {
  padding: 8px 14px;
  background: var(--teal-light);
  color: var(--teal);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.idea-chip:hover {
  border-color: var(--teal);
  transform: translateY(-1px);
}

/* ===== Chores Grid ===== */
.chores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.chore-category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}

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

.chore-category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.chore-category-icon {
  font-size: 24px;
}

.chore-category-title {
  font-size: 16px;
  font-weight: 700;
}

.chore-category-progress {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.chore-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  margin-bottom: 2px;
}

.chore-item:hover {
  background: var(--surface-2);
}

.chore-check {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 5px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: transparent;
  transition: all var(--transition);
}

.chore-item.done .chore-check {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}

.chore-item.done .chore-name {
  text-decoration: line-through;
  color: var(--muted);
}

.chore-name {
  font-size: 14px;
  color: var(--text);
  transition: color var(--transition);
}

.chore-reset {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chore-reset:hover {
  color: var(--text);
}

/* ===== Gift Section ===== */
.gift-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.gift-reason {
  max-width: 180px;
  flex: 0 0 auto;
}

.gift-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gift-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg-warm);
  border: 1px solid var(--border-light);
  transition: all var(--transition);
}

.gift-item:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.gift-item.bought {
  opacity: 0.6;
}

.gift-item.bought .gift-name {
  text-decoration: line-through;
}

.gift-icon {
  font-size: 24px;
  flex-shrink: 0;
}

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

.gift-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.gift-reason-tag {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.gift-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.gift-action-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  color: var(--text-secondary);
}

.gift-action-btn:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--accent);
}

.gift-action-btn.bought-btn:hover {
  background: var(--ok-light);
  border-color: var(--ok);
  color: var(--ok);
}

.gift-action-btn.delete-btn:hover {
  background: #fce4e4;
  border-color: #d44;
  color: #d44;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
  font-size: 15px;
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .week-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .chores-grid {
    grid-template-columns: 1fr;
  }

  .gift-reason {
    max-width: 100%;
    flex: 1;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    position: relative;
    flex-direction: row;
    overflow-x: auto;
    padding: 12px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    box-shadow: none;
  }

  .sidebar-header,
  .sidebar-footer {
    display: none;
  }

  .sidebar-nav {
    flex-direction: row;
    gap: 4px;
    padding: 0;
  }

  .nav-item {
    font-size: 13px;
    padding: 8px 12px;
    white-space: nowrap;
  }

  .nav-icon {
    display: none;
  }

  .app-container {
    flex-direction: column;
  }

  .main-content {
    margin-left: 0;
    padding: 20px 16px 40px;
  }
}

@media (max-width: 480px) {
  .week-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
