/* Night Mode Theme - Altus Plateau / Vintage Dark Brown Aesthetic */
.night-mode {
  --bg-main: #241f1a;      /* Dark Brown Paper */
  --bg-workspace: #1c1814; /* Deepened workspace */
  --bg-secondary: #2e2821; /* Lighter bark/paper for headers */
  --text-primary: #a18a5e; /* Burnished Elden Gold */
  --border-thick: 2px solid #3d342b;
}

body.night-mode {
  background: #14110e;     /* Frame background - dark and moody */
}

body.night-mode #app {
  border-color: #4a3e34;
  background: var(--bg-main);
}

body.night-mode #top-bar {
  border-bottom-color: #4a3e34;
  background: #241f1a;
}

body.night-mode .sidebar-header,
body.night-mode .sidebar-search {
  background: #2a241e;
  border-bottom: 2px solid #4a3e34;
}

body.night-mode .sidebar-search input {
  border-color: #5a4b3a;
  color: #a18a5e;
  background: #1c1814;
}

body.night-mode .sidebar-search input::placeholder {
  color: #7d6b4a;
}

body.night-mode .note-item.active {
  background: #a18a5e;
  color: #1c1814;
}

body.night-mode .note-item:hover:not(.active) {
  background: #2e2821;
}

body.night-mode #editor-wrapper {
  background: var(--bg-workspace);
}

body.night-mode #line-numbers {
  background: rgba(0, 0, 0, 0.2);
  color: #a18a5e; /* Light coffee gold */
  opacity: 0.8;
  border-right: 1px dashed #a18a5e;
}

body.night-mode #editor {
  color: #a18a5e; /* Light coffee gold text */
  background: transparent;
  caret-color: #a18a5e;
}

body.night-mode #editor-highlights mark {
  background-color: rgba(255, 230, 0, 0.15) !important; /* Faint yellow glow for matches */
}

body.night-mode #editor-highlights mark.current {
  background-color: rgba(255, 120, 0, 0.25) !important; /* High contrast orange for current */
  border-bottom: 2px solid #ff7800 !important;
}

body.night-mode #preview {
  background: #241f1a;
  color: #a18a5e;
}

/* Elden Ring Style Links */
body.night-mode #preview a {
  background: #2e2821;
  color: #d4af37;
  padding: 2px 8px;
  border: 1px solid #5a4b3a;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.8em;
  display: inline-block;
  margin: 0 2px;
  box-shadow: 2px 2px 0px #000;
  transition: all 0.1s;
}

body.night-mode #preview a::after {
  content: ' _';
  animation: blink 1s steps(1) infinite;
  color: #d4af37;
}

body.night-mode #preview a:hover {
  background: #d4af37;
  color: #1a1612;
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0px #000;
}

body.night-mode button, 
body.night-mode .button {
  background: #241f1a;
  color: #a18a5e;
  border-color: #5a4b3a;
}

body.night-mode button:hover, 
body.night-mode .button:hover {
  background: #a18a5e;
  color: #241f1a;
}

body.night-mode #preview h2 {
  border-bottom-color: #5a4b3a;
  color: #bdab84;
}

body.night-mode #preview blockquote {
  border-left-color: #d4af37;
  background: #2a241e;
  color: #bdab84;
  box-shadow: inset -2px 2px 8px rgba(0, 0, 0, 0.25);
}

body.night-mode #preview img {
  border-color: #5a4b3a;
  filter: sepia(0.2) brightness(0.9);
}

body.night-mode #status-bar {
  background: #1c1814;
  color: #7d6b4a; /* Lower contrast gold */
  border-top: 1px solid #3d342b;
}

body.night-mode .indicator {
  background: #d4af37; /* Golden indicator */
  box-shadow: 0 0 5px #d4af37;
}

body.night-mode .note-status input,
body.night-mode .note-status span {
  color: #a18a5e;
}

body.night-mode #note-folder,
body.night-mode #note-title {
  color: #a18a5e;
  opacity: 1 !important;
}

body.night-mode #note-folder::placeholder,
body.night-mode #note-title::placeholder {
  color: #7d6b4a; /* Lighter than before for better visibility */
}

body.night-mode .sidebar-folder-label {
  background: #2e2821;
  color: #bdab84;
  border-bottom: 1px solid #4a3e34;
}

body.night-mode .dot {
  background: #a18a5e;
}

/* UI interactions - comprehensive selection blocking */
.brand, .top-nav, .sidebar-folder-label, .sidebar-label, .button, button, footer, .note-item, .note-status span {
  user-select: none;
  -webkit-user-select: none;
}

body.night-mode .sidebar-folder-label::after {
  color: #a18a5e;
}

body.night-mode #preview hr {
  border: none;
  border-top: 2px solid #5a4b3a;
  margin: 24px 0;
}

body.night-mode #preview pre {
  background: #000;
  color: #eab308;
  border: 1px solid #3d342b;
  box-shadow: inset 4px 4px 10px rgba(0,0,0,1);
}

body.night-mode #preview code {
  background: #000;
  border: none;
  color: #eab308;
}

body.night-mode input[type="checkbox"], body.night-mode #preview input[type="checkbox"] {
  border-color: #a18a5e;
  background: #000;
}

body.night-mode input[type="checkbox"]:checked, body.night-mode #preview input[type="checkbox"]:checked {
  background: #a18a5e;
}

body.night-mode input[type="checkbox"]:checked::after, body.night-mode #preview input[type="checkbox"]:checked::after {
  color: #1c1814;
}

/* Night Mode Scrollbars */
body.night-mode ::-webkit-scrollbar-track {
  background: #1c1814;
}

body.night-mode ::-webkit-scrollbar-thumb {
  background: #a18a5e;
}

body.night-mode ::-webkit-scrollbar-thumb:hover {
  background: #d4af37;
}

/* Night Mode Overlays */
body.night-mode #graph-menu .overlay-full {
  background: rgba(12, 10, 8, 0.95); /* Deep Espresso Vibe */
  backdrop-filter: blur(12px);
}

body.night-mode .graph-header {
  border-bottom-color: rgba(212, 175, 55, 0.1);
  background: rgba(10, 8, 5, 0.7);
  color: #a18a5e; /* Match main text color */
}

body.night-mode .graph-header .close-overlay {
  color: #a18a5e;
  background: #2a241e;
  border: none !important;
}

body.night-mode .graph-header .close-overlay:hover {
  color: #14110e;
  background: #a18a5e;
}

body.night-mode #graph-water {
  color: #a18a5e; /* Muted bubbles */
  opacity: 0.4;
}

body.night-mode .overlay-content {
  background: #1c1814;
  border-color: #a18a5e;
  color: #a18a5e;
  box-shadow: 10px 10px 0px #000;
}

body.night-mode .overlay-content h3 {
  border-bottom-color: #a18a5e;
}

body.night-mode button.btn-danger {
  background: #d4af37 !important;
  color: #1c1814 !important;
  border-color: #a18a5e !important;
}

body.night-mode button.btn-danger:hover {
  background: #bd9a2d !important;
}

body.night-mode .top-nav span.active {
  border-bottom-color: #a18a5e;
}
body.night-mode .zoom-btn.active {
  background: #a18a5e;
  color: #1c1814;
}

body.night-mode .db-stats {
  border-bottom-color: rgba(161, 138, 94, 0.4);
}

body.night-mode #canvas-lite-root {
  background: #14110e;
}

body.night-mode .lazy-vault-img {
  background: rgba(255,255,255,0.05) !important;
}

body.night-mode .danger-zone {
  border-color: #cc0000;
}

/* Night Mode Backlinks  */
body.night-mode .backlinks-section {
  border-top-color: #3d342b;
}

body.night-mode .backlinks-section h4 {
  color: #7d6b4a;
}

body.night-mode .backlink-item {
  background: #241f1a !important;
  border-color: #3d342b !important;
  color: #a18a5e !important;
  box-shadow: 4px 4px 0px #000 !important;
}

body.night-mode .backlink-item:hover {
  background: #a18a5e !important;
  color: #1c1814 !important;
  border-color: #a18a5e !important;
  box-shadow: 6px 6px 0px #000 !important;
}

body.night-mode #preview a.wikilink {
  background: #2e2821 !important;
  color: #d4af37 !important;
  border-color: #5a4b3a !important;
}

body.night-mode #preview a.wikilink:hover {
  background: #d4af37 !important;
  color: #1a1612 !important;
}

