/* REMINDA — Pages CSS
   Aesthetic: refined dark, editorial, clean geometry
   Font: DM Sans (body) + DM Mono (time/stats)
*/

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@300;400;500&display=swap');

/* ── Design tokens ───────────────────────────────── */
:root {
  --bg:         #080c12;
  --bg2:        #0e1420;
  --bg3:        #141c2e;
  --surface:    #1a2238;
  --surface2:   #202840;
  --border:     rgba(99, 120, 180, 0.15);
  --border2:    rgba(99, 120, 180, 0.28);

  --text:       #dde4f0;
  --text2:      #8a97b8;
  --text3:      #4e5d7a;

  --indigo:     #6470f0;
  --indigo2:    #8490ff;
  --indigo-dim: rgba(100, 112, 240, 0.12);
  --indigo-glow:rgba(100, 112, 240, 0.22);

  --red:        #ef4444;
  --red-dim:    rgba(239, 68, 68, 0.12);
  --amber:      #f59e0b;
  --amber-dim:  rgba(245, 158, 11, 0.12);
  --green:      #22c55e;
  --green-dim:  rgba(34, 197, 94, 0.12);

  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  14px;
  --radius-xl:  20px;

  --font:       'DM Sans', system-ui, sans-serif;
  --mono:       'DM Mono', 'Fira Code', monospace;

  --header-h:   58px;
  --nav-h:      60px;
  --transition: 0.18s ease;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

input, select, textarea, button { font-family: inherit; }

/* ── Scrollbar ───────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 99px; }

/* ── Layout ──────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Header ──────────────────────────────────────── */
header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: relative;
  z-index: 40;
  flex-shrink: 0;
}

.logo {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--indigo2);
  font-family: var(--mono);
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-dot {
  width: 7px; height: 7px;
  background: var(--indigo);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--indigo);
  animation: pulse-dot 2.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 6px var(--indigo); opacity: 1; }
  50% { box-shadow: 0 0 14px var(--indigo2), 0 0 24px var(--indigo-glow); opacity: 0.75; }
}

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--indigo);
  color: #fff;
}
.btn-primary:hover { background: var(--indigo2); }

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border2);
}
.btn-ghost:hover { background: var(--surface); color: var(--text); }

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.25);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: var(--radius-sm); }

.icon-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent;
  color: var(--text3); border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition);
}
.icon-btn:hover { background: var(--surface); color: var(--text2); }
.icon-btn.danger:hover { color: var(--red); background: var(--red-dim); }

/* ── Navigation Tabs ─────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--bg2);
  border-top: 1px solid var(--border);
  z-index: 40;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 8px;
  border-right: 1px solid var(--border);
  background: var(--bg2);
  width: 56px;
  flex-shrink: 0;
}

.nav-btn {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.nav-btn:hover { background: var(--surface); color: var(--text2); }

.nav-btn.active {
  background: var(--indigo-dim);
  color: var(--indigo2);
}

.nav-btn.active::before {
  content: '';
  position: absolute;
  left: -8px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--indigo);
  border-radius: 0 3px 3px 0;
}

/* Mobile nav */
.bottom-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--text3);
  font-size: 10px;
  cursor: pointer;
  transition: var(--transition);
}
.bottom-nav-btn.active { color: var(--indigo2); }
.bottom-nav-btn svg { width: 20px; height: 20px; }

/* ── Main layout ─────────────────────────────────── */
.body-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Views ───────────────────────────────────────── */
.view { display: none; flex-direction: column; gap: 16px; }
.view.active { display: flex; }

/* ── Filter bar ──────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar select {
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}
.filter-bar select:focus { border-color: var(--indigo); }

/* ── Stats grid ──────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.stat-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label {
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.stat-value {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
}

.stat-card.total  .stat-value { color: var(--indigo2); }
.stat-card.active .stat-value { color: var(--amber); }
.stat-card.done   .stat-value { color: var(--green); }
.stat-card.overdue .stat-value { color: var(--red); }

/* ── Section blocks ──────────────────────────────── */
.section {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.section-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; }

/* ── Reminder cards ──────────────────────────────── */
.reminder-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition);
  animation: slide-in 0.2s ease;
}

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

.reminder-card:hover { border-color: var(--border2); background: var(--surface2); }
.reminder-card.done { opacity: 0.5; }
.reminder-card.done .card-title { text-decoration: line-through; }

/* priority stripe */
.priority-stripe {
  width: 3px;
  border-radius: 99px;
  align-self: stretch;
  flex-shrink: 0;
}
.priority-stripe.high   { background: var(--red); }
.priority-stripe.medium { background: var(--amber); }
.priority-stripe.low    { background: var(--green); }

.card-check {
  width: 18px; height: 18px;
  border: 1.5px solid var(--border2);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  background: transparent;
}
.card-check:hover { border-color: var(--green); }
.card-check.checked { background: var(--green-dim); border-color: var(--green); }
.card-check.checked svg { color: var(--green); }

.card-body { flex: 1; min-width: 0; }

.card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 5px;
  align-items: center;
}

.badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 99px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-indigo  { background: var(--indigo-dim); color: var(--indigo2); }
.badge-red     { background: var(--red-dim); color: var(--red); }
.badge-amber   { background: var(--amber-dim); color: var(--amber); }
.badge-green   { background: var(--green-dim); color: var(--green); }
.badge-gray    { background: var(--surface2); color: var(--text3); }

.card-time {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-time.overdue { color: var(--red); }

.card-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0;
  transition: var(--transition);
}
.reminder-card:hover .card-actions { opacity: 1; }

/* ── Snooze dropdown ─────────────────────────────── */
.snooze-wrap { position: relative; }

.snooze-menu {
  display: none;
  position: absolute;
  right: 0; top: calc(100% + 4px);
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden;
  z-index: 50;
  min-width: 130px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.snooze-menu.open { display: block; }

.snooze-option {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text2);
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}
.snooze-option:hover { background: var(--surface); color: var(--text); }

/* ── Empty state ─────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 10px;
  color: var(--text3);
}

.empty-state svg { opacity: 0.3; width: 48px; height: 48px; }
.empty-state p { font-size: 13px; }

/* ── Calendar ────────────────────────────────────── */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cal-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day-name {
  text-align: center;
  font-size: 10px;
  color: var(--text3);
  font-weight: 600;
  text-transform: uppercase;
  padding: 6px 0;
  letter-spacing: 0.05em;
}

.cal-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  color: var(--text2);
}

.cal-cell:hover { background: var(--surface); color: var(--text); }
.cal-cell.today {
  background: var(--surface2);
  color: var(--indigo2);
  font-weight: 600;
}
.cal-cell.has-event::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 4px; height: 4px;
  background: var(--indigo);
  border-radius: 50%;
}
.cal-cell.empty { cursor: default; }

/* ── Modal ───────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  animation: modal-in 0.2s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-title { font-size: 15px; font-weight: 600; }

/* ── Form fields ─────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }

.field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field input,
.field select,
.field textarea {
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
  transition: var(--transition);
  width: 100%;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--indigo-dim);
}

.field textarea { resize: vertical; min-height: 70px; }

input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: invert(0.5) brightness(0.8);
  cursor: pointer;
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Settings panel ──────────────────────────────── */
.settings-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.settings-card h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }

.toggle-label { font-size: 13px; color: var(--text2); }
.toggle-hint  { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* Toggle switch */
.toggle {
  position: relative;
  width: 36px; height: 20px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--surface2);
  border-radius: 99px;
  cursor: pointer;
  transition: var(--transition);
}
.toggle input:checked + .toggle-track { background: var(--indigo); }
.toggle-track::after {
  content: '';
  position: absolute;
  left: 2px; top: 2px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}
.toggle input:checked + .toggle-track::after { left: 18px; }

/* ── Toast ───────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 12px;
  padding: 8px 16px;
  border-radius: 99px;
  z-index: 200;
  transition: transform 0.25s ease, opacity 0.25s ease;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── WA Status indicator ─────────────────────────── */
.wa-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 99px;
}

.wa-status.on  { background: var(--green-dim); color: var(--green); }
.wa-status.off { background: var(--surface2); color: var(--text3); }

.wa-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.wa-status.on .wa-dot { animation: wa-pulse 2s ease-in-out infinite; }

@keyframes wa-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 768px) {
  .bottom-nav { display: flex; }
  .side-nav   { display: none; }
  .main-content { padding: 14px 14px calc(var(--nav-h) + 14px); }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .field-row  { grid-template-columns: 1fr; }

  .card-actions { opacity: 1; }
}

@media (min-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}
