/* Habitee — app styles (ported from the Next.js CSS modules). */

/* ── Global ───────────────────────────────────────────── */
:root {
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --font-sans: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --accent-rgb: 103, 168, 255;
  --accent-strong-rgb: 59, 130, 246;
  --success-rgb: 52, 211, 153;
  --warning-rgb: 245, 158, 11;
  --danger-rgb: 251, 113, 133;
}

html[data-theme="dark"] {
  --bg: #081425;
  --bg-alt: #0c1d34;
  --panel: rgba(12, 29, 52, 0.82);
  --surface: rgba(14, 33, 59, 0.8);
  --surface-strong: #102543;
  --surface-muted: rgba(24, 47, 82, 0.74);
  --card: rgba(12, 29, 52, 0.86);
  --border: rgba(151, 177, 219, 0.16);
  --border-strong: rgba(var(--accent-rgb), 0.3);
  --text: #edf4ff;
  --muted: #96aac8;
  --accent: rgb(var(--accent-rgb));
  --accent-strong: rgb(var(--accent-strong-rgb));
  --accent-soft: rgba(var(--accent-rgb), 0.16);
  --success: rgb(var(--success-rgb));
  --success-soft: rgba(var(--success-rgb), 0.14);
  --warning: rgb(var(--warning-rgb));
  --warning-soft: rgba(var(--warning-rgb), 0.14);
  --danger: rgb(var(--danger-rgb));
  --danger-soft: rgba(var(--danger-rgb), 0.14);
  --shadow-color: rgba(2, 10, 22, 0.36);
  --shadow-soft: rgba(4, 18, 34, 0.18);
  --page-glow-1: rgba(var(--accent-rgb), 0.2);
  --page-glow-2: rgba(24, 119, 242, 0.16);
  --page-glow-3: rgba(var(--success-rgb), 0.1);
  --page-line: rgba(120, 152, 202, 0.07);
}

html[data-theme="light"] {
  --bg: #f6f9ff;
  --bg-alt: #ffffff;
  --panel: rgba(255, 255, 255, 0.94);
  --surface: rgba(255, 255, 255, 0.96);
  --surface-strong: #ffffff;
  --surface-muted: #eef4ff;
  --card: rgba(255, 255, 255, 0.96);
  --border: rgba(22, 43, 82, 0.11);
  --border-strong: rgba(var(--accent-strong-rgb), 0.24);
  --text: #13233b;
  --muted: #657996;
  --accent: rgb(var(--accent-strong-rgb));
  --accent-strong: #1d4ed8;
  --accent-soft: rgba(var(--accent-strong-rgb), 0.12);
  --success: #059669;
  --success-soft: rgba(var(--success-rgb), 0.12);
  --warning: #d97706;
  --warning-soft: rgba(var(--warning-rgb), 0.12);
  --danger: #e11d48;
  --danger-soft: rgba(var(--danger-rgb), 0.11);
  --shadow-color: rgba(18, 38, 74, 0.12);
  --shadow-soft: rgba(18, 38, 74, 0.06);
  --page-glow-1: rgba(var(--accent-strong-rgb), 0.09);
  --page-glow-2: rgba(125, 166, 255, 0.08);
  --page-glow-3: rgba(var(--success-rgb), 0.06);
  --page-line: rgba(29, 78, 216, 0.06);
}

:root {
  --green: var(--accent);
  --green-dim: var(--accent-strong);
  --green-glow: var(--accent-soft);
  --green-subtle: var(--accent-soft);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg);
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(circle at top left, var(--page-glow-1), transparent 34%),
    radial-gradient(circle at bottom right, var(--page-glow-2), transparent 32%),
    linear-gradient(180deg, var(--bg-alt), var(--bg));
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color .25s ease, color .25s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 16% 20%, var(--page-glow-1), transparent 26%),
    radial-gradient(circle at 85% 18%, var(--page-glow-3), transparent 22%),
    radial-gradient(circle at 70% 72%, var(--page-glow-2), transparent 24%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--page-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--page-line) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 88%);
  pointer-events: none;
  z-index: 0;
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font: inherit;
}

::selection {
  background: rgba(var(--accent-rgb), 0.24);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(var(--accent-rgb), 0.24);
  border-radius: 999px;
}

/* ── Theme toggle (tt-) ───────────────────────────────── */
.tt-toggle {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 8px 6px 6px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 12px 28px var(--shadow-color);
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
  backdrop-filter: blur(14px);
}

.tt-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--accent-rgb), 0.38);
  box-shadow: 0 16px 34px var(--shadow-color);
}

.tt-toggleLight {
}

.tt-track {
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  padding: 2px;
}

.tt-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.98), rgba(var(--accent-strong-rgb), 0.98));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateX(0);
  transition: transform .18s ease;
  box-shadow: 0 6px 14px rgba(var(--accent-rgb), 0.28);
  flex-shrink: 0;
}

.tt-toggleLight .tt-thumb {
  transform: translateX(20px);
}

.tt-glyph {
  font-size: 12px;
  line-height: 1;
}

.tt-copy {
  display: grid;
  gap: 1px;
  text-align: left;
}

.tt-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .tt-copy {
    display: none;
  }

  .tt-toggle {
    padding-right: 6px;
    gap: 0;
  }
}

/* ── Dashboard ───────────────────────────────────────── */

.header {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 24px;
  margin-bottom: 28px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px rgba(var(--success-rgb), 0.4);
  animation: pulse 2s infinite;
}

.monthTitle {
  font-family: var(--font-sans);
  font-size: 29px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0;
}

.monthTitle span {
  color: var(--accent);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 22px;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
  box-shadow: 0 14px 36px var(--shadow-soft);
}

.card:hover {
  border-color: rgba(var(--accent-rgb), 0.32);
  box-shadow: 0 22px 44px var(--shadow-soft);
  transform: translateY(-2px);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  box-shadow: 0 22px 42px var(--shadow-color);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
}

.toastShow {
  transform: translateY(0) !important;
  opacity: 1 !important;
}

.modalBackdrop {
  position: fixed;
  inset: 0;
  z-index: 990;
  background: rgba(3, 12, 24, 0.58);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.settingsName {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.switchButton {
  width: 54px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  padding: 3px;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.switchButtonOn {
  background: rgba(var(--success-rgb), 0.2);
  border-color: rgba(var(--success-rgb), 0.34);
  box-shadow: 0 12px 24px rgba(var(--success-rgb), 0.12);
}

.switchThumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--muted);
  display: block;
  transition:
    transform 0.18s ease,
    background 0.18s ease;
}

.switchButtonOn .switchThumb {
  transform: translateX(24px);
  background: var(--success);
}

.confirmBackdrop {
  z-index: 1001;
}

.confirmModal {
  width: min(100%, 430px);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 26px;
  box-shadow: 0 24px 60px var(--shadow-color);
}

.confirmTitle {
  font-family: var(--font-sans);
  font-size: 23px;
  line-height: 1.2;
  margin-bottom: 10px;
}

.confirmText {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.confirmActions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

@media (max-width: 980px) {
  .header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: flex-start;
    column-gap: 18px;
    row-gap: 16px;
  }
}

@media (max-width: 640px) {

  .header {
    margin-bottom: 22px;
  }

  .monthTitle {
    font-size: 24px;
  }

  .confirmActions {
    flex-direction: column-reverse;
  }
}

/* ── Plain-JS additions ──────────────────────────────── */
.hidden {
  display: none !important;
}

/* Replaces react-spinners' ClipLoader */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-bottom-color: transparent;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  animation: spin 0.75s linear infinite;
}

.spinnerLarge {
  width: 28px;
  height: 28px;
  border-width: 3px;
}

/* Rows only animate in on the first render, not on every re-render */

/* Loading / error state while the account loads */
.appStatus {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
  color: var(--accent);
}

.appStatusTitle {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.appStatusText {
  max-width: 420px;
  color: var(--muted);
  margin-top: -8px;
}
