/* ── Components ─────────────────────────────────────────────────
   Daily Focus v2 — Solid surface design, no glassmorphism
   All colors via CSS custom properties from base.css
   ──────────────────────────────────────────────────────────── */

/* ═══════════════════════════════════════════
   Header
   ═══════════════════════════════════════════ */

.header {
  margin-bottom: 40px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.date-section {
  margin-bottom: 18px;
}

.date-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  margin-bottom: 10px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s ease-in-out infinite;
}

.date-text {
  font-weight: 500;
  font-size: 12px;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
}

.app-title {
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.04em;
  line-height: 1.2;
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--duration-fast) ease, background var(--duration-fast) ease, border-color var(--duration-fast) ease;
  -webkit-app-region: no-drag;
}

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

/* ═══════════════════════════════════════════
   Progress
   ═══════════════════════════════════════════ */

.progress-section {
  display: flex;
  align-items: center;
  gap: 14px;
}

.progress-count {
  font-weight: 600;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  min-width: 40px;
}

.progress-track {
  flex: 1;
  height: 4px;
  background: var(--progress-track);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--progress-fill);
  border-radius: 2px;
  width: 0%;
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ═══════════════════════════════════════════
   Sections
   ═══════════════════════════════════════════ */

.section {
  margin-bottom: 32px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-left: 4px;
}

.section-icon {
  font-size: 15px;
  line-height: 1;
}

.section-header h2 {
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════
   Medication Cards
   ═══════════════════════════════════════════ */

.med-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: background var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
  padding: 16px;
  margin-bottom: 8px;
}

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

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

.med-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.med-name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.02em;
  color: var(--text);
}

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

.med-counter {
  font-weight: 600;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.med-counter.complete {
  color: var(--success);
}

.med-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.med-gear {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--duration-fast) ease, background var(--duration-fast) ease;
  -webkit-app-region: no-drag;
}

.med-gear:hover {
  color: var(--text);
  background: var(--bg-tertiary);
}

.med-doses {
  display: flex;
  gap: 6px;
}

.dose-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 8px;
  background: var(--bg-tertiary);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
  -webkit-app-region: no-drag;
  position: relative;
  overflow: hidden;
}

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

.dose-btn.next-dose {
  border-color: var(--meds-border);
  background: var(--meds-bg);
}

.dose-btn.taken {
  border-color: var(--success-border);
  background: var(--success-bg);
}

.dose-time {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.dose-label {
  font-size: 11px;
  color: var(--text-muted);
}

.dose-btn.taken .dose-label {
  color: var(--success);
  font-weight: 500;
}

.dose-btn.taken .dose-time {
  opacity: 0.4;
}

.dose-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(22, 163, 74, 0.2);
  transform: scale(0);
  pointer-events: none;
}

/* ═══════════════════════════════════════════
   Task Items
   ═══════════════════════════════════════════ */

.task-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
  -webkit-app-region: no-drag;
}

.task-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 2px 2px 0;
}

.task-item.priority-high::before {
  background: var(--urgent);
}

.task-item.priority-normal::before {
  background: var(--text-muted);
}

.task-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.task-item.done {
  opacity: 0.45;
}

.task-item.done:hover {
  opacity: 0.55;
}

.task-item.dragging {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
  z-index: 10;
  opacity: 0.9;
}

.task-item.removing {
  opacity: 0;
  transform: translateX(12px) scale(0.97);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.drop-indicator {
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  margin: 2px 0;
  transition: opacity var(--duration-fast) ease;
}

/* ── Checkbox ── */

.task-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid var(--border-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  transition: all var(--duration-fast) ease;
  flex-shrink: 0;
}

.task-item:hover .task-checkbox {
  border-color: var(--text-muted);
}

.task-item.done .task-checkbox {
  background: var(--accent);
  border-color: var(--accent);
  animation: checkPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.task-check-icon {
  display: none;
  font-size: 10px;
  color: var(--text-inverse);
  font-weight: 700;
}

.task-item.done .task-check-icon {
  display: block;
}

/* ── Content ── */

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

.task-name {
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.02em;
  line-height: 1.35;
  color: var(--text);
}

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

.task-detail {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
}

.task-item.done .task-detail {
  text-decoration: line-through;
}

/* ── Tag ── */

.task-tag {
  flex-shrink: 0;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: -0.01em;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  margin-top: 2px;
  white-space: nowrap;
}

/* ── Remove button ── */

.task-remove {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  border-radius: 5px;
  opacity: 0;
  transition: all 0.12s ease;
}

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

.task-remove:hover {
  background: var(--urgent-bg);
  color: var(--urgent);
}

/* ── Inline edit ── */

.task-edit-input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 10px;
  outline: none;
  box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.1);
}

[data-theme="dark"] .task-edit-input {
  box-shadow: 0 0 0 3px rgba(250, 250, 250, 0.1);
}

.task-edit-input::placeholder {
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════
   Add Task
   ═══════════════════════════════════════════ */

.add-task-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  background: transparent;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  font-family: inherit;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all var(--duration-fast) ease;
  -webkit-app-region: no-drag;
}

.add-task-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.add-form {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-top: 6px;
  padding: 14px;
  animation: slideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.add-form input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.add-form input::placeholder {
  color: var(--text-muted);
}

.add-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.1);
}

[data-theme="dark"] .add-form input:focus {
  box-shadow: 0 0 0 3px rgba(250, 250, 250, 0.1);
}

.add-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 12px;
}

.btn-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-weight: 500;
  font-size: 12px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  cursor: pointer;
  transition: color var(--duration-fast) ease;
}

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

.btn-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--text-inverse);
  font-family: inherit;
  font-weight: 600;
  font-size: 12px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  cursor: pointer;
  transition: opacity var(--duration-fast) ease, transform var(--duration-fast) ease;
}

.btn-add:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

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

/* ═══════════════════════════════════════════
   Tag Selector
   ═══════════════════════════════════════════ */

.tag-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
  align-items: center;
}

.tag-option {
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 11px;
  cursor: pointer;
  border: 1.5px solid transparent;
  opacity: 0.35;
  transition: all 0.12s ease;
}

.tag-option:hover {
  opacity: 0.6;
}

.tag-option.selected {
  opacity: 1;
  border-color: var(--border-hover);
}

.tag-create-btn {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration-fast) ease;
}

.tag-create-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-secondary);
}

.tag-create-form {
  margin-top: 10px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.tag-create-form.hidden {
  display: none;
}

.color-swatches {
  display: flex;
  gap: 7px;
  margin-bottom: 10px;
}

.color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  opacity: 0.5;
  transition: all var(--duration-fast) ease;
}

.color-swatch:hover {
  opacity: 0.8;
  transform: scale(1.15);
}

.color-swatch.selected {
  opacity: 1;
  border-color: var(--text);
  transform: scale(1.15);
}

/* ═══════════════════════════════════════════
   Sidebar
   ═══════════════════════════════════════════ */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 60px 20px 20px;
  overflow-y: auto;
}

.sidebar.open {
  transform: translateX(0);
}

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

.sidebar-title {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.sidebar-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--duration-fast) ease, background var(--duration-fast) ease;
  -webkit-app-region: no-drag;
}

.sidebar-close:hover {
  color: var(--text);
  background: var(--bg-tertiary);
}

.history-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: background var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
  padding: 14px;
  margin-bottom: 8px;
  cursor: pointer;
}

.history-item:hover {
  box-shadow: var(--shadow-md);
}

.history-date {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  color: var(--text);
}

.history-bar {
  height: 3px;
  background: var(--progress-track);
  border-radius: 2px;
  overflow: hidden;
}

.history-bar-fill {
  height: 100%;
  background: var(--progress-fill);
  border-radius: 2px;
}

.history-pct {
  font-weight: 600;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ═══════════════════════════════════════════
   Celebration
   ═══════════════════════════════════════════ */

.celebration {
  text-align: center;
  padding: 48px 20px;
  margin-top: 12px;
  position: relative;
}

.celebration.hidden {
  display: none;
}

.celebration-emoji {
  display: inline-block;
  font-size: 40px;
  animation: bounceIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.celebration-title {
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.04em;
  margin-top: 12px;
  color: var(--text);
}

.celebration-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}

#confetti-canvas {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

/* ═══════════════════════════════════════════
   Medication Config Form
   ═══════════════════════════════════════════ */

.med-config {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 14px;
  margin-top: 8px;
  animation: slideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.med-config.hidden {
  display: none;
}

.med-config input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.med-config input::placeholder {
  color: var(--text-muted);
}

.med-config input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.1);
}

[data-theme="dark"] .med-config input:focus {
  box-shadow: 0 0 0 3px rgba(250, 250, 250, 0.1);
}

.med-config-doses {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.med-dose-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.med-dose-row input {
  flex: 1;
}

.med-config-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 12px;
}
