/* Material Design 3 - Knowledge Garden Stylesheet */
/* ENHANCED: Comprehensive interaction support with systematic visual improvements */
/* Periwinkle/Lavender Color Palette - PRESERVED */

@import url('https://fonts.googleapis.com/css2?family=Roboto+Flex:wght@300;400;500;600;700&display=swap');

:root {
  /* Primary Colors - Periwinkle - PRESERVED */
  --md-sys-color-primary: #7C4DFF;
  --md-sys-color-on-primary: #FFFFFF;
  --md-sys-color-primary-container: #E8DEFF;
  --md-sys-color-on-primary-container: #260062;
  
  /* Secondary Colors - Lavender - PRESERVED */
  --md-sys-color-secondary: #B388FF;
  --md-sys-color-on-secondary: #000000;
  --md-sys-color-secondary-container: #E1BEE7;
  --md-sys-color-on-secondary-container: #311B92;
  
  /* Tertiary Colors - PRESERVED */
  --md-sys-color-tertiary: #9575CD;
  --md-sys-color-on-tertiary: #FFFFFF;
  --md-sys-color-tertiary-container: #EDE7F6;
  --md-sys-color-on-tertiary-container: #4527A0;
  
  /* Surface & Background - PRESERVED */
  --md-sys-color-surface: #FDFBFF;
  --md-sys-color-on-surface: #1C1B1E;
  --md-sys-color-surface-variant: #E7E0EC;
  --md-sys-color-on-surface-variant: #49454E;
  --md-sys-color-surface-container-lowest: #FFFFFF;
  --md-sys-color-surface-container-low: #F7F2FA;
  --md-sys-color-surface-container: #F3EDF7;
  --md-sys-color-surface-container-high: #ECE6F0;
  --md-sys-color-surface-container-highest: #E6E0E9;
  
  /* Outline - PRESERVED */
  --md-sys-color-outline: #79747E;
  --md-sys-color-outline-variant: #C9C5D0;
  
  /* Error - PRESERVED */
  --md-sys-color-error: #BA1A1A;
  --md-sys-color-on-error: #FFFFFF;
  --md-sys-color-error-container: #FFDAD6;
  --md-sys-color-on-error-container: #410002;
  
  /* Elevation Shadows - PRESERVED */
  --md-sys-elevation-0: none;
  --md-sys-elevation-1: 0px 1px 2px rgba(0, 0, 0, 0.3), 0px 1px 3px 1px rgba(0, 0, 0, 0.15);
  --md-sys-elevation-2: 0px 1px 2px rgba(0, 0, 0, 0.3), 0px 2px 6px 2px rgba(0, 0, 0, 0.15);
  --md-sys-elevation-3: 0px 4px 8px 3px rgba(0, 0, 0, 0.15), 0px 1px 3px rgba(0, 0, 0, 0.3);
  --md-sys-elevation-4: 0px 6px 10px 4px rgba(0, 0, 0, 0.15), 0px 2px 3px rgba(0, 0, 0, 0.3);
  --md-sys-elevation-5: 0px 8px 12px 6px rgba(0, 0, 0, 0.15), 0px 4px 4px rgba(0, 0, 0, 0.3);
  
  /* Shape Corners - PRESERVED */
  --md-sys-shape-corner-none: 0px;
  --md-sys-shape-corner-extra-small: 4px;
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-extra-large: 28px;
  
  /* Typography Scale - PRESERVED */
  --md-sys-typescale-display-large: 400 57px/64px 'Roboto Flex', sans-serif;
  --md-sys-typescale-display-medium: 400 45px/52px 'Roboto Flex', sans-serif;
  --md-sys-typescale-display-small: 400 36px/44px 'Roboto Flex', sans-serif;
  
  --md-sys-typescale-headline-large: 400 32px/40px 'Roboto Flex', sans-serif;
  --md-sys-typescale-headline-medium: 400 28px/36px 'Roboto Flex', sans-serif;
  --md-sys-typescale-headline-small: 400 24px/32px 'Roboto Flex', sans-serif;
  
  --md-sys-typescale-title-large: 400 22px/28px 'Roboto Flex', sans-serif;
  --md-sys-typescale-title-medium: 500 16px/24px 'Roboto Flex', sans-serif;
  --md-sys-typescale-title-small: 500 14px/20px 'Roboto Flex', sans-serif;
  
  --md-sys-typescale-body-large: 400 16px/24px 'Roboto Flex', sans-serif;
  --md-sys-typescale-body-medium: 400 14px/20px 'Roboto Flex', sans-serif;
  --md-sys-typescale-body-small: 400 12px/16px 'Roboto Flex', sans-serif;
  
  --md-sys-typescale-label-large: 500 14px/20px 'Roboto Flex', sans-serif;
  --md-sys-typescale-label-medium: 500 12px/16px 'Roboto Flex', sans-serif;
  --md-sys-typescale-label-small: 500 11px/16px 'Roboto Flex', sans-serif;
}

/* Dark Theme - PRESERVED */
[data-theme="dark"] {
  --md-sys-color-primary: #D0BCFF;
  --md-sys-color-on-primary: #381E72;
  --md-sys-color-primary-container: #4F378A;
  --md-sys-color-on-primary-container: #E8DEFF;
  
  --md-sys-color-secondary: #CCC2DC;
  --md-sys-color-on-secondary: #332D41;
  --md-sys-color-secondary-container: #4A4458;
  --md-sys-color-on-secondary-container: #E8DEF8;
  
  --md-sys-color-surface: #1C1B1E;
  --md-sys-color-on-surface: #E6E1E6;
  --md-sys-color-surface-variant: #49454E;
  --md-sys-color-on-surface-variant: #CAC4CF;
  --md-sys-color-surface-container-lowest: #0F0D13;
  --md-sys-color-surface-container-low: #1D1B20;
  --md-sys-color-surface-container: #211F26;
  --md-sys-color-surface-container-high: #2B2930;
  --md-sys-color-surface-container-highest: #36343B;
  
  --md-sys-color-outline: #948F99;
  --md-sys-color-outline-variant: #49454E;
}

/* Base Styles - PRESERVED */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font: var(--md-sys-typescale-body-medium);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  min-height: 100vh;
  transition: background-color 0.3s ease;
}

/* ALL EXISTING STYLES PRESERVED - Top App Bar through Note Content */
/* Top App Bar - PRESERVED */
.top-app-bar {
  position: fixed;
  top: 0;
  left: 80px;
  right: 0;
  height: 64px;
  background: var(--md-sys-color-surface);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 90;
  box-shadow: var(--md-sys-elevation-2);
  transition: left 0.3s ease;
}

.top-app-bar-title {
  font: var(--md-sys-typescale-title-large);
  color: var(--md-sys-color-on-surface);
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.breadcrumb-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  font: var(--md-sys-typescale-label-large);
  color: var(--md-sys-color-on-surface-variant);
}

.breadcrumb-link {
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--md-sys-shape-corner-small);
  transition: background-color 0.2s;
  cursor: pointer;
}

.breadcrumb-link:hover {
  background: var(--md-sys-color-surface-variant);
}

.breadcrumb-separator {
  color: var(--md-sys-color-outline);
}

/* Action Buttons - PRESERVED */
.top-app-bar-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  transition: background-color 0.2s;
}

.icon-button:hover {
  background: var(--md-sys-color-surface-variant);
}

.filled-tonal-button {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border: none;
  padding: 10px 24px;
  border-radius: 20px;
  font: var(--md-sys-typescale-label-large);
  cursor: pointer;
  transition: box-shadow 0.2s, background-color 0.2s;
}

.filled-tonal-button:hover {
  box-shadow: var(--md-sys-elevation-1);
  background: color-mix(in srgb, var(--md-sys-color-secondary-container) 92%, var(--md-sys-color-on-secondary-container));
}

/* Navigation Rail - PRESERVED */
.navigation-rail {
  position: fixed;
  left: 0;
  top: 0;
  width: 80px;
  height: 100vh;
  background: var(--md-sys-color-surface-container);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  z-index: 100;
  box-shadow: var(--md-sys-elevation-0);
  border-right: 1px solid var(--md-sys-color-outline-variant);
}

.nav-fab {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px 0 16px;
  font-size: 24px;
  cursor: pointer;
  transition: box-shadow 0.2s;
  border: none;
}

.nav-fab:hover {
  box-shadow: var(--md-sys-elevation-1);
}

.nav-destination {
  width: 56px;
  height: 32px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0;
  cursor: pointer;
  color: var(--md-sys-color-on-surface-variant);
  transition: background-color 0.2s;
  position: relative;
}

.nav-destination:hover {
  background: var(--md-sys-color-surface-variant);
}

.nav-destination.active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.nav-destination.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 32px;
  background: var(--md-sys-color-primary);
  border-radius: 0 3px 3px 0;
}

/* Navigation Drawer - PRESERVED */
.navigation-drawer {
  position: fixed;
  left: -360px;
  top: 64px;
  width: 360px;
  height: calc(100vh - 64px);
  background: var(--md-sys-color-surface-container-low);
  z-index: 85;
  overflow-y: auto;
  transition: left 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
  box-shadow: var(--md-sys-elevation-0);
}

.navigation-drawer.open {
  left: 80px;
  box-shadow: var(--md-sys-elevation-1);
}

.drawer-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.drawer-header h2 {
  font: var(--md-sys-typescale-title-small);
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 4px;
}

.folder-list {
  list-style: none;
  padding: 8px 0;
}

.folder-group {
  margin: 4px 0;
}

.folder-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  cursor: pointer;
  color: var(--md-sys-color-on-surface);
  font: var(--md-sys-typescale-label-large);
  transition: background-color 0.2s;
  user-select: none;
}

.folder-header:hover {
  background: var(--md-sys-color-surface-variant);
}

.folder-icon {
  font-size: 20px;
  transition: transform 0.2s;
}

.folder-group.expanded .folder-icon {
  transform: rotate(90deg);
}

.notes-list {
  list-style: none;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.folder-group.expanded .notes-list {
  max-height: 1000px;
}

.note-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 24px 8px 56px;
  cursor: pointer;
  color: var(--md-sys-color-on-surface-variant);
  font: var(--md-sys-typescale-body-medium);
  transition: background-color 0.2s;
}

.note-item:hover {
  background: var(--md-sys-color-surface-variant);
}

.note-item.active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

/* Main Content Area - PRESERVED */
.content-area {
  margin-left: 80px;
  margin-top: 64px;
  padding: 24px;
  min-height: calc(100vh - 64px);
  transition: margin-left 0.3s ease;
}

.content-area.drawer-open {
  margin-left: 440px;
}

/* Note Container - PRESERVED */
.note-container {
  max-width: 840px;
  margin: 0 auto;
}

.note-card {
  background: var(--md-sys-color-surface-container-lowest);
  border-radius: var(--md-sys-shape-corner-extra-large);
  padding: 32px;
  box-shadow: var(--md-sys-elevation-0);
  border: 1px solid var(--md-sys-color-outline-variant);
}

/* Typography in Notes - PRESERVED */
.note-content h1 {
  font: var(--md-sys-typescale-display-small);
  color: var(--md-sys-color-on-surface);
  margin: 0 0 24px 0;
  line-height: 1.2;
}

.note-content h2 {
  font: var(--md-sys-typescale-headline-medium);
  color: var(--md-sys-color-on-surface);
  margin: 32px 0 16px 0;
}

.note-content h3 {
  font: var(--md-sys-typescale-title-large);
  color: var(--md-sys-color-on-surface);
  margin: 24px 0 12px 0;
}

.note-content p {
  font: var(--md-sys-typescale-body-large);
  color: var(--md-sys-color-on-surface);
  line-height: 1.6;
  margin: 16px 0;
}

.note-content ul, .note-content ol {
  margin: 16px 0;
  padding-left: 24px;
}

.note-content li {
  font: var(--md-sys-typescale-body-large);
  color: var(--md-sys-color-on-surface);
  margin: 8px 0;
  line-height: 1.6;
}

.note-content code {
  background: var(--md-sys-color-surface-variant);
  color: var(--md-sys-color-on-surface-variant);
  padding: 2px 6px;
  border-radius: var(--md-sys-shape-corner-extra-small);
  font-family: 'Roboto Mono', monospace;
  font-size: 0.9em;
}

.note-content pre {
  background: var(--md-sys-color-surface-container-highest);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--md-sys-color-outline-variant);
}

.note-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: var(--md-sys-color-on-surface);
}

.note-content blockquote {
  border-left: 4px solid var(--md-sys-color-primary);
  padding-left: 16px;
  margin: 16px 0;
  font-style: italic;
  color: var(--md-sys-color-on-surface-variant);
}

.note-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  overflow: hidden;
}

.note-content th {
  background: var(--md-sys-color-surface-container-high);
  padding: 12px 16px;
  text-align: left;
  font: var(--md-sys-typescale-title-small);
  color: var(--md-sys-color-on-surface);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.note-content td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  font: var(--md-sys-typescale-body-medium);
}

.note-content tr:last-child td {
  border-bottom: none;
}

/* Note Links - PRESERVED */
.note-link {
  color: var(--md-sys-color-primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
  cursor: pointer;
}

.note-link:hover {
  border-bottom-color: var(--md-sys-color-primary);
}

/* Note Tags - PRESERVED */
.note-tag {
  display: inline-block;
  color: var(--md-sys-color-primary);
  background: var(--md-sys-color-primary-container);
  padding: 2px 8px;
  border-radius: 12px;
  font: var(--md-sys-typescale-label-small);
  margin: 0 4px;
  text-decoration: none;
  transition: background-color 0.2s;
}

.note-tag:hover {
  background: color-mix(in srgb, var(--md-sys-color-primary-container) 85%, var(--md-sys-color-on-primary-container));
}

/* Loading Spinner - PRESERVED */
.loading-spinner {
  display: none;
  width: 48px;
  height: 48px;
  border: 4px solid var(--md-sys-color-surface-variant);
  border-top: 4px solid var(--md-sys-color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ENHANCED CORNER KNOWLEDGE GRAPH WIDGET - SYSTEMATIC IMPROVEMENTS */
.corner-graph-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 320px;
  height: 220px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(15px);
  border-radius: var(--md-sys-shape-corner-extra-large);
  box-shadow: var(--md-sys-elevation-4);
  border: 1px solid var(--md-sys-color-outline-variant);
  z-index: 150;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  /* ENHANCED: Improved cursor management */
  cursor: default;
}

.corner-graph-widget.expanded {
  width: 480px;
  height: 360px;
  bottom: 80px;
  right: 80px;
}

.corner-graph-widget.maximized {
  top: 80px;
  left: 104px;
  right: 24px;
  bottom: 24px;
  width: auto;
  height: auto;
}

.corner-graph-widget.mini {
  width: 80px;
  height: 80px;
  border-radius: 50%;
}

.corner-graph-widget.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}

[data-theme="dark"] .corner-graph-widget {
  background: rgba(28, 27, 30, 0.95);
}

/* ENHANCED Widget Header - SYSTEMATIC DRAG AREA DEFINITION */
.corner-graph-header {
  height: 56px;
  background: linear-gradient(135deg, var(--md-sys-color-primary), var(--md-sys-color-secondary));
  color: var(--md-sys-color-on-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  /* ENHANCED: Precise cursor management for drag areas */
  cursor: grab;
  user-select: none;
  position: relative;
}

.corner-graph-header:active {
  cursor: grabbing;
}

.corner-graph-header.dragging {
  cursor: grabbing;
}

.mini .corner-graph-header {
  height: 100%;
  border-radius: 50%;
  justify-content: center;
  padding: 0;
}

.graph-title {
  font: var(--md-sys-typescale-title-small);
  display: flex;
  align-items: center;
  gap: 8px;
  /* ENHANCED: Prevent interference with controls */
  pointer-events: none;
}

.connection-count {
  font: var(--md-sys-typescale-label-medium);
  color: rgba(255, 255, 255, 0.8);
  display: none;
  /* ENHANCED: Prevent interference with controls */
  pointer-events: none;
}

.corner-graph-widget.expanded .connection-count,
.corner-graph-widget.maximized .connection-count {
  display: block;
}

.graph-controls {
  display: flex;
  gap: 4px;
  /* ENHANCED: Ensure controls receive events */
  position: relative;
  z-index: 10;
}

.mini .graph-controls {
  display: none;
}

/* ENHANCED Graph Container - SYSTEMATIC INTERACTION OPTIMIZATION */
.corner-graph-container {
  position: relative;
  width: 100%;
  height: calc(100% - 56px);
  overflow: hidden;
  background: var(--md-sys-color-surface-container-lowest);
  /* ENHANCED: Precise cursor management for graph area */
  cursor: default;
}

.mini .corner-graph-container {
  display: none;
}

.corner-graph-container svg {
  width: 100%;
  height: 100%;
  display: block;
  background: transparent;
  /* ENHANCED: Graph-specific cursor behavior */
  cursor: grab;
}

.corner-graph-container svg:active {
  cursor: grabbing;
}

.corner-graph-container svg.panning {
  cursor: grabbing;
}

/* ENHANCED Graph Controls - SYSTEMATIC CONTRAST OPTIMIZATION */
.graph-controls .icon-button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* ENHANCED: Improved contrast and depth */
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: rgba(255, 255, 255, 0.98);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 16px;
  backdrop-filter: blur(6px);
  /* ENHANCED: Prevent widget drag interference */
  position: relative;
  z-index: 20;
}

.graph-controls .icon-button:hover {
  background: rgba(255, 255, 255, 0.4);
  border-color: rgba(255, 255, 255, 0.7);
  color: rgba(255, 255, 255, 1);
  transform: scale(1.08);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}

.graph-controls .icon-button:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.5);
}

.graph-controls .icon-button:focus {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 2px;
}

/* ENHANCED D3 Graph Styles - SYSTEMATIC INTERACTION FEEDBACK */
.graph-node {
  cursor: pointer;
  stroke: #fff;
  stroke-width: 1;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  /* ENHANCED: Improved filter effects */
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.2));
}

.graph-node.folder {
  fill: var(--md-sys-color-primary);
}

.graph-node.note {
  fill: var(--md-sys-color-secondary);
}

.graph-node.hovered {
  stroke-width: 2;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3)) brightness(1.15);
  transform: scale(1.05);
}

.graph-node.connected {
  fill: var(--md-sys-color-tertiary);
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.25));
}

.graph-node.dimmed {
  opacity: 0.25;
  filter: grayscale(0.3);
}

.graph-node.dragging {
  stroke-width: 2;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4)) brightness(1.1);
  cursor: grabbing !important;
  transform: scale(1.1);
}

/* ENHANCED Graph Links - SYSTEMATIC VISUAL HIERARCHY */
.graph-link {
  stroke: var(--md-sys-color-outline);
  stroke-opacity: 0.25;
  stroke-width: 1;
  fill: none;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.graph-link.highlighted {
  stroke: var(--md-sys-color-primary);
  stroke-width: 2;
  stroke-opacity: 0.8;
  filter: drop-shadow(0 1px 2px rgba(124, 77, 255, 0.3));
}

/* ENHANCED Node Labels - SYSTEMATIC READABILITY OPTIMIZATION */
.node-label {
  font-family: 'Roboto Flex', sans-serif;
  font-size: 10px;
  fill: var(--md-sys-color-on-surface-variant);
  text-anchor: middle;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  /* ENHANCED: Improved text contrast */
  text-shadow: 
    1px 1px 2px rgba(0, 0, 0, 0.4), 
    -1px -1px 2px rgba(255, 255, 255, 0.15),
    0 0 4px rgba(0, 0, 0, 0.2);
  font-weight: 500;
}

.node-label.visible {
  opacity: 1;
}

/* ENHANCED Graph Status and Feedback Systems */
.graph-status-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--md-sys-color-primary);
  border-radius: 50%;
  animation: pulse 2s infinite;
  /* ENHANCED: Prevent interaction interference */
  pointer-events: none;
}

@keyframes pulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

/* ENHANCED Graph Tooltip - SYSTEMATIC INFORMATION PRESENTATION */
.graph-tooltip {
  position: absolute;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  padding: 10px 14px;
  border-radius: var(--md-sys-shape-corner-medium);
  font: var(--md-sys-typescale-body-small);
  pointer-events: none;
  z-index: 1000;
  box-shadow: var(--md-sys-elevation-3);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  /* ENHANCED: Improved visual separation */
  border: 1px solid var(--md-sys-color-outline-variant);
  backdrop-filter: blur(8px);
}

.graph-tooltip.visible {
  opacity: 1;
}

/* ENHANCED Interactive State Management */
.corner-graph-widget.widget-dragging {
  cursor: grabbing;
  transform: scale(1.02);
  box-shadow: var(--md-sys-elevation-5);
}

.corner-graph-widget.widget-dragging .corner-graph-header {
  cursor: grabbing;
}

.corner-graph-widget.widget-dragging .corner-graph-container svg {
  pointer-events: none;
}

/* ENHANCED Loading and Transition States */
.corner-graph-widget.loading {
  opacity: 0.7;
  pointer-events: none;
}

.corner-graph-widget.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 2px solid var(--md-sys-color-outline-variant);
  border-top: 2px solid var(--md-sys-color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 1000;
}

/* ENHANCED Responsive Design - SYSTEMATIC BREAKPOINT OPTIMIZATION */
@media (max-width: 839px) {
  .corner-graph-widget {
    width: 280px;
    height: 180px;
    bottom: 16px;
    right: 16px;
  }
  
  .corner-graph-widget.maximized {
    left: 16px;
    top: 80px;
  }
  
  .graph-controls .icon-button {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }
}

@media (max-width: 599px) {
  .corner-graph-widget {
    width: 260px;
    height: 160px;
    bottom: 12px;
    right: 12px;
  }
  
  .corner-graph-widget.expanded {
    width: calc(100vw - 24px);
    height: 280px;
    bottom: 60px;
    right: 12px;
  }
  
  .graph-controls .icon-button {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }
}

/* ENHANCED Responsive Design for Navigation - PRESERVED */
@media (max-width: 839px) {
  .navigation-rail {
    width: 0;
    overflow: hidden;
  }
  
  .top-app-bar {
    left: 0;
  }
  
  .content-area {
    margin-left: 0;
  }
  
  .navigation-drawer {
    left: -360px;
  }
  
  .navigation-drawer.open {
    left: 0;
  }
  
  .content-area.drawer-open {
    margin-left: 0;
  }
}

@media (max-width: 599px) {
  .top-app-bar {
    padding: 0 16px;
  }
  
  .content-area {
    padding: 16px;
  }
  
  .note-card {
    padding: 24px 16px;
  }
  
  .note-content h1 {
    font: var(--md-sys-typescale-display-small);
  }
}

/* ENHANCED Theme Transition System - PRESERVED */
body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

body * {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ENHANCED Accessibility - SYSTEMATIC IMPROVEMENTS */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .corner-graph-widget,
  .graph-node,
  .graph-link,
  .node-label {
    transition: none !important;
  }
}

@media (prefers-contrast: high) {
  .corner-graph-widget {
    border: 2px solid var(--md-sys-color-outline);
    background: var(--md-sys-color-surface);
  }
  
  .graph-controls .icon-button {
    border: 2px solid rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.4);
  }
  
  .graph-node {
    stroke-width: 2;
  }
  
  .graph-link {
    stroke-opacity: 0.6;
    stroke-width: 1.5;
  }
}

/* ENHANCED Focus Management - SYSTEMATIC KEYBOARD NAVIGATION */
*:focus-visible {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

.corner-graph-widget:focus-within {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 4px;
}

/* ENHANCED Performance Optimizations */
.corner-graph-widget * {
  will-change: auto;
}

.corner-graph-widget.widget-dragging {
  will-change: transform;
}

.graph-node.dragging {
  will-change: transform;
}

.graph-node.hovered {
  will-change: transform, filter;
}

/* ENHANCED Print Styles - SYSTEMATIC MEDIA QUERIES */
@media print {
  .corner-graph-widget {
    display: none;
  }
}

/* ENHANCED Animation Definitions */
@keyframes expandWidget {
  from {
    height: 40px;
    opacity: 0.8;
  }
  to {
    height: 200px;
    opacity: 1;
  }
}

@keyframes collapseWidget {
  from {
    height: 200px;
    opacity: 1;
  }
  to {
    height: 40px;
    opacity: 0.8;
  }
}

.corner-graph-widget.expanding {
  animation: expandWidget 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.corner-graph-widget.collapsing {
  animation: collapseWidget 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ENHANCED Integration Compatibility - SYSTEMATIC STACKING CONTEXT */
.corner-graph-widget {
  isolation: isolate;
  contain: layout style paint;
}

/* ENHANCED Theme Integration - PRESERVED COMPLETE COMPATIBILITY */
.corner-graph-widget .graph-title,
.corner-graph-widget .connection-count {
  font-family: inherit;
  letter-spacing: 0.025em;
}
