/* ── Daily Focus — Global Styles ── */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500&display=swap');

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

:root {
  --bg:           #F5F2EC;
  --surface:      #FDFCF9;
  --border:       #E2DDD4;
  --border-focus: #A89880;
  --text:         #1C1914;
  --text-muted:   #8A8279;
  --text-hint:    #B5AFA6;
  --accent:       #2D5A3D;
  --accent-light: #EBF2ED;
  --accent-hover: #234830;
  --danger:       #C0392B;
  --danger-light: #FEF2F0;
  --danger-border:#F5C6C0;
  --warning:      #D97706;
  --serif:        'DM Serif Display', Georgia, serif;
  --sans:         'DM Sans', sans-serif;
  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    18px;
  --transition:   0.18s ease;
  --shadow-card:  0 2px 24px rgba(28,25,20,0.07);
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* Dot grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, #C8C0B0 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

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

/* ── Buttons ── */
.btn-primary {
  width: 100%;
  padding: 13px;
  font-size: 15px;
  font-weight: 500;
  font-family: var(--sans);
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px rgba(45,90,61,0.25);
}
.btn-primary:active { transform: scale(0.99); }

.btn-outline {
  width: 100%;
  padding: 11px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--sans);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.btn-outline:hover {
  border-color: var(--border-focus);
  color: var(--text);
  background: var(--bg);
}

/* Loading spinner on buttons */
.btn-primary.loading,
.btn-outline.loading { pointer-events: none; }
.btn-primary .btn-text,
.btn-outline .btn-text { transition: opacity 0.2s; }
.btn-primary.loading .btn-text,
.btn-outline.loading .btn-text { opacity: 0; }
.btn-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.btn-primary.loading .btn-spinner,
.btn-outline.loading .btn-spinner { opacity: 1; }
.btn-spinner svg {
  width: 20px;
  height: 20px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Full-page loading overlay (masks the flash of unstyled/stale content on fresh navigations) ── */
.page-loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.page-loading-overlay svg {
  width: 32px;
  height: 32px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  animation: spin 0.8s linear infinite;
}

/* ── Form elements ── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 11px 14px;
  font-size: 15px;
  font-family: var(--sans);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.form-group input:hover,
.form-group select:hover { border-color: var(--border-focus); }
.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(45,90,61,0.1);
}
.form-group input::placeholder { color: var(--text-hint); }
.form-group .error-msg {
  font-size: 12px;
  color: var(--danger);
  margin-top: 5px;
  display: none;
}
.form-group.has-error input { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(192,57,43,0.08); }
.form-group.has-error .error-msg { display: block; }

/* ── API error banner ── */
.api-error {
  display: none;
  background: var(--danger-light);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--danger);
  margin-bottom: 18px;
  align-items: center;
  gap: 8px;
}
.api-error.show { display: flex; }
.api-error svg {
  width: 16px; height: 16px;
  stroke: var(--danger);
  fill: none; stroke-width: 2; stroke-linecap: round;
  flex-shrink: 0;
}

/* ── Toast notification ── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--text);
  color: var(--surface);
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 8px;
  white-space: nowrap;
  z-index: 100;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── Divider ── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-hint);
  font-size: 12px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}

/* ── Navbar ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.navbar-brand {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.navbar-brand svg {
  width: 20px; height: 20px;
  stroke: var(--accent);
  fill: none; stroke-width: 2; stroke-linecap: round;
}

/* ── Page fade in ── */
.page-wrapper {
  position: relative;
  z-index: 1;
  animation: fadeUp 0.45s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Logout / nav action buttons ── */
.btn-logout {
  font-size: 13px;
  color: var(--text-muted);
  background: none;
  border: none;
  outline: none;
  cursor: pointer;
  font-family: var(--sans);
  transition: color var(--transition);
  padding: 4px 8px;
  border-radius: 6px;
  -webkit-appearance: none;
  appearance: none;
  text-decoration: none;
  display: inline-block;
}
.btn-logout:hover {
  color: var(--text);
  background: var(--bg);
}
.btn-logout:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Footer links ── */
.footer-links {
  text-align: center;
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-hint);
}
.footer-links a {
  color: var(--text-hint);
  text-decoration: none;
  margin: 0 8px;
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--text-muted); }

/* ── Feedback button (navbar) ── */
.btn-feedback {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-family: var(--sans);
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.btn-feedback svg {
  width: 15px; height: 15px;
  stroke: currentColor;
  fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.btn-feedback:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
}

/* ── Feedback modal ── */
.feedback-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28,25,20,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.feedback-modal-overlay.show { display: flex; }

.feedback-modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(28,25,20,0.25);
  padding: 32px 28px 28px;
  animation: fadeUp 0.25s ease both;
}

.feedback-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition);
}
.feedback-modal-close:hover { color: var(--text); background: var(--bg); }
.feedback-modal-close svg {
  width: 18px; height: 18px;
  stroke: currentColor;
  fill: none; stroke-width: 2; stroke-linecap: round;
}

.feedback-modal-title {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--text);
  margin-bottom: 16px;
  padding-right: 20px;
}

.feedback-textarea {
  width: 100%;
  min-height: 110px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  resize: vertical;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.feedback-textarea::placeholder { color: var(--text-hint); }
.feedback-textarea:hover { border-color: var(--border-focus); }
.feedback-textarea:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(45,90,61,0.1);
}

.feedback-categories {
  display: flex;
  gap: 10px;
  margin: 16px 0 22px;
  flex-wrap: wrap;
}

.feedback-category-option {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.feedback-category-option:hover { border-color: var(--border-focus); color: var(--text); }

.feedback-category-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

.feedback-radio-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--border-focus);
  position: relative;
  flex-shrink: 0;
  transition: border-color var(--transition);
}
.feedback-radio-dot::after {
  content: '';
  position: absolute;
  inset: 2.5px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0);
  transition: transform var(--transition);
}

.feedback-category-option input[type="radio"]:checked ~ .feedback-radio-dot {
  border-color: var(--accent);
}
.feedback-category-option input[type="radio"]:checked ~ .feedback-radio-dot::after {
  transform: scale(1);
}
.feedback-category-option:has(input[type="radio"]:checked) {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-light);
}

/* ── Delete account modal ── */
.delete-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28,25,20,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.delete-modal-overlay.show { display: flex; }

.delete-modal {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(28,25,20,0.25);
  padding: 32px 28px 28px;
  animation: fadeUp 0.25s ease both;
}

.delete-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition);
}
.delete-modal-close:hover { color: var(--text); background: var(--bg); }
.delete-modal-close svg {
  width: 18px; height: 18px;
  stroke: currentColor;
  fill: none; stroke-width: 2; stroke-linecap: round;
}

.delete-modal-title {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--danger);
  margin-bottom: 10px;
  padding-right: 20px;
}

.delete-modal-intro {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 16px;
}

.delete-modal-warning {
  background: var(--danger-light);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.delete-modal-warning-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--danger);
  margin-bottom: 8px;
}
.delete-modal-list {
  list-style: disc;
  padding-left: 20px;
  margin-bottom: 12px;
}
.delete-modal-list li {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.5;
}
.delete-modal-caution {
  font-size: 13px;
  font-weight: 500;
  color: var(--danger);
}

.delete-modal-confirm-label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.delete-modal-confirm-label strong { color: var(--text); }

.delete-confirm-input {
  width: 100%;
  padding: 11px 14px;
  font-size: 15px;
  font-family: var(--sans);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  outline: none;
  margin-bottom: 20px;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.delete-confirm-input::placeholder { color: var(--text-hint); }
.delete-confirm-input:focus {
  border-color: var(--danger);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.1);
}

.delete-modal-actions {
  display: flex;
  gap: 10px;
}
.delete-modal-actions .btn-outline { flex: 1; }

.btn-delete-confirm {
  flex: 1;
  padding: 13px;
  font-size: 15px;
  font-weight: 500;
  font-family: var(--sans);
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background var(--transition), opacity var(--transition);
}
.btn-delete-confirm:hover:not(:disabled) { background: #A5311F; }
.btn-delete-confirm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-delete-confirm.loading { pointer-events: none; }
.btn-delete-confirm .btn-text { transition: opacity 0.2s; }
.btn-delete-confirm.loading .btn-text { opacity: 0; }
.btn-delete-confirm .btn-spinner {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s;
}
.btn-delete-confirm.loading .btn-spinner { opacity: 1; }
.btn-delete-confirm .btn-spinner svg { width: 20px; height: 20px; animation: spin 0.8s linear infinite; }

/* ── Generic confirm modal (Sign out / Discard) ── */
.confirm-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28,25,20,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.confirm-modal-overlay.show { display: flex; }

.confirm-modal {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(28,25,20,0.25);
  padding: 26px 24px 24px;
  animation: fadeUp 0.25s ease both;
}
.confirm-modal-title {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--text);
  margin-bottom: 8px;
}
.confirm-modal-text {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}
.confirm-modal-actions {
  display: flex;
  gap: 10px;
}
.confirm-modal-actions .btn-outline,
.confirm-modal-actions .btn-primary { width: auto; flex: 1; }