/* ===== Minimal Notes - Notion-Inspired Design ===== */
/* Based on popular-web-designs skill (Notion template) */

@import url('../vendor/fonts/fonts.css');

/* ===== Color Palette (Notion) ===== */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f6f5f4;
  --bg-hover: rgba(0,0,0,0.04);

  --text-primary: rgba(0,0,0,0.95);
  --text-secondary: #615d59;
  --text-muted: #a39e98;

  --accent: #0075de;
  --accent-hover: #005bab;
  --accent-light: #f2f9ff;

  --border: rgba(0,0,0,0.1);
  --border-light: rgba(0,0,0,0.05);

  --shadow-card: rgba(0,0,0,0.04) 0px 4px 18px,
                  rgba(0,0,0,0.027) 0px 2.025px 7.84688px,
                  rgba(0,0,0,0.02) 0px 0.8px 2.925px,
                  rgba(0,0,0,0.01) 0px 0.175px 1.04062px;

  --shadow-deep: rgba(0,0,0,0.01) 0px 1px 3px,
                 rgba(0,0,0,0.02) 0px 3px 7px,
                 rgba(0,0,0,0.02) 0px 7px 15px,
                 rgba(0,0,0,0.04) 0px 14px 28px,
                 rgba(0,0,0,0.05) 0px 23px 52px;

  --tag-teal: #2a9d99;
  --tag-green: #1aae39;
  --tag-orange: #dd5b00;
  --tag-pink: #ff64c8;
  --tag-purple: #6b4c9a;
  --tag-blue: #0075de;

  --sidebar-width: 260px;
  --sidebar-bg: #f9f8f6;
  --sidebar-border: rgba(0,0,0,0.06);
}

/* ===== Dark Mode ===== */
:root.dark {
  --bg-primary: #1e1e1e;
  --bg-secondary: #2d2d2d;
  --bg-hover: rgba(255,255,255,0.08);

  --text-primary: rgba(255,255,255,0.95);
  --text-secondary: #b0a8a0;
  --text-muted: #7a7570;

  --border: rgba(255,255,255,0.1);
  --border-light: rgba(255,255,255,0.05);

  --sidebar-bg: #262626;
  --sidebar-border: rgba(255,255,255,0.06);

  --accent-light: rgba(0, 117, 222, 0.2);

  --shadow-card: rgba(0,0,0,0.3) 0px 4px 18px,
                  rgba(0,0,0,0.2) 0px 2px 8px;
}


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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Noto Sans SC', 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  font-family: 'Noto Serif SC', 'Inter', serif;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
}

/* ===== App Layout ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform 0.25s ease;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Noto Serif SC', serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.sidebar-brand:hover {
  color: var(--text-primary);
}

/* Reset link colors inside sidebar */
.sidebar a {
  color: inherit;
  text-decoration: none;
}

.sidebar a:hover {
  color: inherit;
}

.sidebar a.active {
  color: var(--accent);
}

.sidebar-brand-icon {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-toggle-mobile {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  min-width: 36px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 16px;
  -webkit-overflow-scrolling: touch;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.sidebar-section {
  margin-bottom: 4px;
}

.sidebar-section-header,
.sidebar-folder-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  transition: background 0.15s ease;
  user-select: none;
}

.sidebar-section-header:hover,
.sidebar-folder-toggle:hover {
  background: var(--bg-hover);
}

.sidebar-section-header.active {
  background: rgba(0, 117, 222, 0.1);
  color: var(--accent);
}

.sidebar-icon {
  flex-shrink: 0;
  opacity: 0.6;
}

.folder-icon {
  opacity: 0.8;
  color: #c4b594;
}

.sidebar-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.folder-chevron {
  margin-left: auto;
  transition: transform 0.2s ease;
  opacity: 0.5;
}

.sidebar-folder-toggle[aria-expanded="true"] .folder-chevron {
  transform: rotate(90deg);
}

.sidebar-folder-items {
  padding-left: 20px;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
  flex-direction: column;
}

.sidebar-folder-items.open {
  max-height: 500px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  padding: 5px 10px 5px 20px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 2px solid transparent;
  min-height: 32px;
}

.sidebar-item::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
}

.sidebar-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-left-color: var(--accent);
}

.sidebar-item.active {
  color: var(--accent);
  background: rgba(0, 117, 222, 0.06);
  border-left-color: var(--accent);
}

/* Sidebar Footer */

/* ===== Tomorrow's Learning Input ===== */
.sidebar-tomorrow {
  padding: 12px 8px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-tomorrow-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-family: 'Noto Serif SC', serif;
  letter-spacing: 0.02em;
}

.sidebar-tomorrow-input {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: 'Noto Sans SC', sans-serif;
  border: 1px solid var(--sidebar-border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  transition: all 0.15s ease;
}

.sidebar-tomorrow-input::placeholder {
  color: var(--text-muted);
  font-size: 12px;
}

.sidebar-tomorrow-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 117, 222, 0.15);
}

/* Goal List */
.sidebar-goal-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
}

.sidebar-goal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  margin-bottom: 4px;
  background: var(--bg-primary);
  border: 1px solid var(--sidebar-border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-primary);
  transition: all 0.15s ease;
  animation: fadeIn 0.2s ease forwards;
}

.sidebar-goal-item:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.goal-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.goal-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  margin-right: 2px;
}

.goal-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.goal-remove:hover {
  background: rgba(231, 76, 60, 0.1);
  color: #e74c3c;
}

.sidebar-tomorrow-hint {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.sidebar-tomorrow-status {
  display: block;
  font-size: 11px;
  color: var(--tag-green);
  margin-top: 4px;
  line-height: 1.4;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-tomorrow-status.visible {
  opacity: 1;
}

.sidebar-tomorrow-status.error {
  color: #e74c3c;
}

.sidebar-footer {
  padding: 12px 8px 16px;
  border-top: 1px solid var(--sidebar-border);
  margin-top: auto;
}

.sidebar-footer-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s ease;
}

.sidebar-footer-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.sidebar-footer-link.active {
  color: var(--accent);
  background: rgba(0, 117, 222, 0.06);
}

/* Dark mode toggle button */
.dark-mode-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s ease;
    margin-left: auto;
}

.dark-mode-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dark-mode-icon { display: none; }
:root.dark .dark-mode-icon.sun { display: block; }
:root:not(.dark) .dark-mode-icon.moon { display: block; }

/* Account Switcher */
.account-switcher {
    padding: 12px 8px 16px;
    border-top: 1px solid var(--sidebar-border);
}

.account-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg-hover);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    position: relative;
}

.account-card:hover {
    background: var(--bg-secondary);
    border-color: var(--border);
}

.account-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.account-avatar.coco { background: linear-gradient(135deg, #FF9A9E, #FECFEF); }
.account-avatar.psych { background: linear-gradient(135deg, #A8E6CF, #DCEDC1); }
.account-avatar.hermes { background: linear-gradient(135deg, #D4A5E5, #B8D4E3); }

.account-info {
    flex: 1;
    min-width: 0;
}

.account-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.account-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.3;
}

.account-chevron {
    opacity: 0.4;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.account-card:hover .account-chevron {
    opacity: 0.7;
}

/* Account Dropdown Menu */
.account-menu {
    position: absolute;
    bottom: 100%;
    left: 8px;
    right: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-deep);
    padding: 6px;
    margin-bottom: 8px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: all 0.2s ease;
    z-index: 300;
}

.account-menu.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.account-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.account-menu-item:hover {
    background: var(--bg-hover);
}

.account-menu-item.active {
    background: var(--accent-light);
}

.menu-avatar {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.menu-avatar.coco { background: linear-gradient(135deg, #FF9A9E, #FECFEF); }
.menu-avatar.psych { background: linear-gradient(135deg, #A8E6CF, #DCEDC1); }
.menu-avatar.hermes { background: linear-gradient(135deg, #D4A5E5, #B8D4E3); }

.menu-text {
    flex: 1;
}

.menu-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

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

.menu-check {
    color: var(--accent);
    opacity: 0;
}

.account-menu-item.active .menu-check {
    opacity: 1;
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 150;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.sidebar-overlay.visible {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 24px;
  gap: 12px;
}

.sidebar-open-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  min-width: 36px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.sidebar-open-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.main-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.main-nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.main-nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.main-nav-link.active {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.content-area {
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px 40px;
  width: 100%;
}

.content-area.note-content {
  max-width: 680px;
}

/* ===== Page Title ===== */
.page-title {
  padding: 48px 0 32px;
}

.page-title h1 {
  font-size: 2.25rem;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.page-title p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 4px;
}

.page-quote {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 8px;
  font-style: italic;
  line-height: 1.5;
}

.page-quote .quote-author {
  display: block;
  color: var(--text-secondary);
  font-style: normal;
  font-size: 0.8rem;
  margin-top: 4px;
}

/* ===== Date Header ===== */
.date-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 24px 0 12px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-header::before {
  content: '';
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
}

/* ===== Note Cards ===== */
.notes-list {
  padding-bottom: 48px;
}

.note-card {
  padding: 20px 0;
  border-bottom: 1px solid var(--border-light);
  transition: all 0.2s ease;
}

.note-card:hover {
  background: var(--bg-hover);
  margin: 0 -16px;
  padding: 20px 16px;
  border-radius: 8px;
}

.note-card:last-child {
  border-bottom: none;
}

.note-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
  cursor: pointer;
  font-family: 'Noto Serif SC', serif;
}

.note-title a {
  color: var(--text-primary);
}

.note-title a:hover {
  color: var(--accent);
}

.note-excerpt {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 10px;
}

.note-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.note-date {
  font-weight: 500;
}

.note-tags {
  display: flex;
  gap: 6px;
}

.tag {
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 9999px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.tag.teal { background: rgba(42,157,153,0.12); color: var(--tag-teal); }
.tag.green { background: rgba(26,174,57,0.12); color: var(--tag-green); }
.tag.orange { background: rgba(221,91,0,0.12); color: var(--tag-orange); }
.tag.pink { background: rgba(255,100,200,0.12); color: var(--tag-pink); }
.tag.purple { background: rgba(107,76,154,0.12); color: var(--tag-purple); }
.tag.blue { background: var(--accent-light); color: var(--tag-blue); }

/* ===== Single Note Page ===== */
.note-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

.note-page-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.note-page-title {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 16px;
  letter-spacing: -0.03em;
}

.note-page-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.note-page-body {
  font-size: 1rem;
  line-height: 1.75;
}

.note-page-body h2 {
  font-size: 1.5rem;
  margin: 32px 0 12px;
}

.note-page-title .term-en,
.note-page-body h2 .term-en {
  font-size: 0.55em;
  font-weight: 400;
  color: var(--text-muted);
  vertical-align: baseline;
}

.note-page-body h3 {
  font-size: 1.25rem;
  margin: 24px 0 8px;
}

.note-page-body p {
  margin-bottom: 16px;
}

.note-page-body ul, .note-page-body ol {
  margin: 12px 0;
  padding-left: 24px;
}

.note-page-body li {
  margin-bottom: 6px;
}

.note-page-body code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.note-page-body pre {
  background: var(--bg-secondary);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
}

.note-page-body pre code {
  background: none;
  padding: 0;
}

/* ===== KaTeX Formula Styling ===== */
.note-page-body .formula,
.note-page-body .math-block {
  margin: 16px 0;
  font-size: 1.1em;
}

.note-page-body .formula {
  display: inline;
  padding: 0 2px;
}

.note-page-body .math-block {
  display: block;
  text-align: center;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
  overflow-x: auto;
}

.note-page-body .formula-label {
  display: block;
  font-size: 0.85em;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
  font-style: italic;
}

/* Dark mode KaTeX adjustments */
:root.dark .katex { color: var(--text-primary); }
:root.dark .katex .mfrac .line { stroke: var(--text-primary); }
:root.dark .katex .sqrt-symbol { color: var(--text-primary); }

.note-page-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  color: var(--text-secondary);
  margin: 16px 0;
}

/* ===== Graph Page ===== */
.graph-page {
  height: calc(100vh - 56px);
  position: relative;
  background: var(--bg-secondary);
}

.graph-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.graph-canvas {
  width: 100%;
  height: 100%;
}

.graph-toolbar {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.graph-toolbar-btn {
  width: 36px;
  height: 36px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-secondary);
  transition: all 0.15s ease;
  box-shadow: var(--shadow-card);
}

.graph-toolbar-btn:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.graph-sidebar {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 280px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  padding: 20px;
  transform: translateX(320px);
  transition: transform 0.2s ease;
}

.graph-sidebar.visible {
  transform: translateX(0);
}

.graph-sidebar h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.graph-sidebar p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.graph-sidebar .tags {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ===== Footer ===== */
.footer {
  padding: 32px 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
}

/* ===== Sidebar toggle buttons & overlay ===== */
.sidebar-toggle-mobile { display: none; }
.sidebar-open-btn { display: none; }
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 499;
}
.sidebar-overlay.visible { display: block; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  /* Break sidebar out of flex flow */
  .app-layout {
    display: block !important;
  }

  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 280px !important;
    height: 100vh !important;
    transform: translateX(-100%) !important;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15) !important;
    z-index: 500 !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }

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

  .sidebar-toggle-mobile {
    display: flex !important;
  }

  .sidebar-open-btn {
    display: flex !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .page-title h1 {
    font-size: 1.75rem;
  }

  .page-title p {
    font-size: 1rem;
  }

  .note-page-title {
    font-size: 1.75rem;
  }

  .note-page {
    padding: 24px 16px 48px;
  }

  .note-page-body h2 {
    font-size: 1.25rem;
    margin: 24px 0 10px;
  }

  .note-page-body p {
    margin-bottom: 12px;
  }

  .note-page-body ul, .note-page-body ol {
    margin: 8px 0;
    padding-left: 20px;
  }

  .note-page-body li {
    margin-bottom: 4px;
  }

  .note-page-body .math-block {
    padding: 8px 12px;
    margin: 12px 0;
  }

  .main-header {
    height: 48px;
    padding: 0 16px;
  }

  .content-area {
    padding: 0 16px;
  }

  .page-title {
    padding: 32px 0 24px;
  }
}

@media (max-width: 600px) {
  .page-title h1 {
    font-size: 1.5rem;
  }

  .note-title {
    font-size: 1.125rem;
  }
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.note-card {
  animation: fadeIn 0.3s ease forwards;
}

.note-card:nth-child(2) { animation-delay: 0.05s; }
.note-card:nth-child(3) { animation-delay: 0.1s; }
.note-card:nth-child(4) { animation-delay: 0.15s; }
.note-card:nth-child(5) { animation-delay: 0.2s; }

/* ===== D3 Graph Styles ===== */
.link {
  stroke-opacity: 0.6;
}

.node-label {
  font-family: 'Noto Sans SC', 'Inter', sans-serif;
  font-size: 11px;
  fill: var(--text-primary);
  pointer-events: none;
}

.node-note {
  fill: #0075de;
  stroke: #ffffff;
  stroke-width: 2px;
}

.node-concept {
  fill: #2a9d99;
  stroke: #ffffff;
  stroke-width: 2px;
}

.node-tag {
  fill: #6b4c9a;
  stroke: #ffffff;
  stroke-width: 2px;
}

/* Graph filter buttons */
.graph-filter-bar {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 8px;
  padding: 4px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-card);
}

.graph-filter-btn {
  padding: 6px 16px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  min-height: 32px;
}

.graph-filter-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.graph-filter-btn.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
}


/* Fix Header in Dark Mode */
:root.dark .main-header {
    background: rgba(30, 30, 30, 0.95) !important;
    border-bottom-color: rgba(255,255,255,0.1) !important;
}
:root.dark .main-nav-link { color: var(--text-secondary) !important; }
:root.dark .main-nav-link:hover { color: var(--text-primary) !important; }
:root.dark .main-nav-link.active { background: rgba(255,255,255,0.1) !important; color: var(--text-primary) !important; }
:root.dark .sidebar-open-btn { color: var(--text-secondary) !important; }
:root.dark .dark-mode-toggle { color: var(--text-secondary) !important; }

/* ===== Note Footer ===== */
.note-footer {
  margin-top: 13px;
  padding-bottom: 10px;
}

.note-footer-divider {
  border-top: 1px solid var(--border);
  margin-bottom: 24px;
}

.note-footer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.note-footer-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.note-footer-back:hover {
  color: var(--text-primary);
}

.note-footer-back svg {
  flex-shrink: 0;
}

.note-footer-link {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.note-footer-link:hover {
  color: var(--text-secondary);
}

.note-footer-credit {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.02em;
  width: 100%;
  display: block;
}

.note-footer-credit span {
  display: inline-block;
}

.note-footer-dot {
  margin: 0 6px;
  opacity: 0.6;
}
