/* ============================================================
   Notion-style theme system
   Light theme = Notion's actual light palette
   Dark theme  = Notion's actual dark palette
   ============================================================ */

:root {
  /* ---- Light theme (default) ---- */
  --bg: #ffffff;
  --bg-secondary: #f7f6f3;
  --bg-tertiary: #edecea;
  --bg-hover: rgba(55, 53, 47, 0.06);
  --bg-card: #ffffff;
  --sidebar-bg: #fbfbfa;
  --border: rgba(55, 53, 47, 0.09);
  --border-strong: rgba(55, 53, 47, 0.16);
  --text-primary: #37352f;
  --text-secondary: rgba(55, 53, 47, 0.65);
  --text-tertiary: rgba(55, 53, 47, 0.45);
  --accent: #2383e2;
  --accent-soft: rgba(35, 131, 226, 0.1);
  --highlight: #fdecc8;
  --highlight-strong: #fbe39b;
  --success: #2f7b4f;
  --success-bg: #dbeddb;
  --warning: #b87503;
  --warning-bg: #fbecdd;
  --danger: #e03e3e;
  --danger-bg: #fbe4e4;
  --review-bg: #e8deee;
  --review-text: #6940a5;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 3px 6px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 9px 24px rgba(0,0,0,0.12);
  --online-dot: #2f7b4f;
  --offline-dot: #e03e3e;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial,
             "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
}

[data-theme="dark"] {
  --bg: #191919;
  --bg-secondary: #202020;
  --bg-tertiary: #2a2a2a;
  --bg-hover: rgba(255, 255, 255, 0.055);
  --bg-card: #202020;
  --sidebar-bg: #202020;
  --border: rgba(255, 255, 255, 0.094);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: rgba(255, 255, 255, 0.9);
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-tertiary: rgba(255, 255, 255, 0.4);
  --accent: #4ba3f5;
  --accent-soft: rgba(75, 163, 245, 0.15);
  --highlight: #4a3b1f;
  --highlight-strong: #5c4a26;
  --success: #4caf7d;
  --success-bg: rgba(76, 175, 125, 0.15);
  --warning: #d9913b;
  --warning-bg: rgba(217, 145, 59, 0.15);
  --danger: #e96767;
  --danger-bg: rgba(233, 103, 103, 0.15);
  --review-bg: rgba(154, 117, 209, 0.18);
  --review-text: #b18fe0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 3px 6px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 9px 24px rgba(0,0,0,0.5);
  --online-dot: #4caf7d;
  --offline-dot: #e96767;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

body {
  font-size: 15px;
  line-height: 1.5;
  transition: background 0.15s ease, color 0.15s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}
h1 { font-size: 1.875rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.1rem; }

button {
  font-family: var(--font-ui);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font-size: 14px;
}

input, textarea, select {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  outline: none;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid transparent;
  transition: background 0.1s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ghost {
  background: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }

.btn-danger { color: var(--danger); }

/* ---- Theme toggle ---- */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  font-size: 13px;
}
.theme-toggle:hover { background: var(--bg-hover); }

/* ---- Status / connection dot ---- */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-online { background: var(--online-dot); box-shadow: 0 0 0 3px color-mix(in srgb, var(--online-dot) 20%, transparent); }
.status-offline { background: var(--offline-dot); box-shadow: 0 0 0 3px color-mix(in srgb, var(--offline-dot) 20%, transparent); }

.conn-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: capitalize;
}
.badge-todo { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-in_progress { background: var(--warning-bg); color: var(--warning); }
.badge-review { background: var(--review-bg); color: var(--review-text); }
.badge-done { background: var(--success-bg); color: var(--success); }

/* ---- Utility ---- */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.muted { color: var(--text-secondary); }
.tiny { font-size: 12px; }
