/* Notewall - Dark Theme */

:root {
  --bg: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #252525;
  --text: #e5e5e5;
  --text-muted: #888;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --border: #2a2a2a;
  --danger: #ef4444;
  --radius: 8px;
  --font-size: 16px;
  --editor-font-size: 15px;
  --editor-height: 500px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-tertiary) var(--bg-secondary);
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

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

.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  overflow: hidden;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.nav {
  flex: 1;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
  min-height: 0;
}

.nav-link {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius);
  transition: all 0.15s ease;
}

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

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.sidebar-footer .btn-primary { flex: 1; }

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 1.1rem;
  transition: all 0.15s ease;
}

.btn-icon:hover { background: var(--border); }

.main {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: white;
  width: 100%;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--border); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

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

/* Home */
.home-header { margin-bottom: 2rem; }
.home-header h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.subtitle { color: var(--text-muted); }

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.note-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s ease;
}

.note-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.note-card h3 { font-size: 1rem; font-weight: 500; }
.note-card-arrow { color: var(--text-muted); }
.empty-state { color: var(--text-muted); text-align: center; padding: 3rem; }

/* Note */
.note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.note-header h1 { font-size: 2rem; }
.note-actions { display: flex; gap: 0.5rem; }

/* Prose */
.prose { font-size: var(--font-size); line-height: 1.75; }
.prose h1, .prose h2, .prose h3 { margin-top: 2rem; margin-bottom: 1rem; font-weight: 600; }
.prose h1 { font-size: 2rem; }
.prose h2 { font-size: 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.prose h3 { font-size: 1.25rem; }
.prose p { margin-bottom: 1rem; }
.prose ul, .prose ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.prose li { margin-bottom: 0.5rem; }

.prose code {
  background: var(--bg-tertiary);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'SF Mono', Monaco, monospace;
}

.prose pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.prose pre code { background: none; padding: 0; }

.prose blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--text-muted);
}

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

.prose table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 0.75rem; text-align: left; }
.prose th { background: var(--bg-tertiary); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* Editor */
.editor-header { margin-bottom: 1.5rem; }
.editor-header h1 { font-size: 1.5rem; }
.editor-form { display: flex; flex-direction: column; gap: 1.5rem; }
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group label { font-size: 0.875rem; font-weight: 500; color: var(--text-muted); }

.form-group input,
.form-group textarea {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  color: var(--text);
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group textarea {
  resize: vertical;
  min-height: var(--editor-height);
  max-height: var(--editor-height);
  font-family: 'SF Mono', Monaco, monospace;
  font-size: var(--editor-font-size);
  overflow-y: auto;
}

.form-actions { display: flex; gap: 1rem; justify-content: flex-end; }
.form-actions .btn { width: auto; }

/* Error Page */
.error-page { text-align: center; padding: 4rem; }
.error-page h1 { font-size: 6rem; color: var(--accent); line-height: 1; }
.error-page p { font-size: 1.25rem; color: var(--text-muted); margin: 1rem 0 2rem; }

/* Settings */
.settings-header { margin-bottom: 2rem; }
.settings-header h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }

.settings-form { display: flex; flex-direction: column; gap: 2rem; }

.settings-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.settings-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings-section .form-group { margin-bottom: 1rem; }
.settings-section .form-group:last-child { margin-bottom: 0; }

.color-input {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.color-input input[type="color"] {
  width: 50px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.color-input input[type="text"] {
  flex: 1;
  max-width: 120px;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text);
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

select {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 1rem;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
}

select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    width: 100%;
    height: auto;
    bottom: 0;
    top: auto;
    flex-direction: row;
    z-index: 100;
  }
  
  .sidebar-header { display: none; }
  
  .nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 0.5rem;
    flex: 1;
  }
  
  .nav-link { white-space: nowrap; padding: 0.5rem 0.75rem; }
  
  .sidebar-footer {
    border-top: none;
    border-left: 1px solid var(--border);
    padding: 0.5rem;
  }
  
  .sidebar-footer .btn { width: auto; padding: 0.5rem 1rem; }
  
  .main { margin-left: 0; margin-bottom: 60px; }
  .container { padding: 1rem; }
  
  .note-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
}

/* Note Layout & TOC */
.note-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.note-main {
  flex: 1;
  min-width: 0;
}

.note-sidebar {
  width: 250px;
  position: sticky;
  top: 2rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  background: var(--bg-secondary);
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.toc-wrapper h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.toc-wrapper .toc ul {
  list-style: none;
  padding-left: 0;
}

.toc-wrapper .toc ul ul {
  padding-left: 1rem;
  border-left: 1px solid var(--border);
  margin-left: 0.5rem;
}

.toc-wrapper .toc li {
  margin-bottom: 0.5rem;
  margin-top: 0.5rem;
}

.toc-wrapper .toc a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
  font-size: 0.9rem;
  display: block;
}

.toc-wrapper .toc a:hover {
  color: var(--text);
}

@media (max-width: 900px) {
  .note-layout {
    flex-direction: column;
  }
  .note-sidebar {
    width: 100%;
    position: static;
    margin-top: 2rem;
  }
}

.note-content.source pre {
  background: var(--bg-tertiary);
  padding: 1.5rem;
  border-radius: var(--radius);
  font-family: monospace;
  font-size: var(--editor-font-size);
  color: var(--text);
}
html { scroll-behavior: smooth; }



.note-main {
    max-width: calc(100% - 250px - 2rem);
}
.note-content {
    max-width: 100%;
    overflow-x: hidden;
}
.prose {
    word-break: break-word;
}


.note-main {
    max-width: 100%;
    min-width: 0;
}
.note-rendered pre, .prose pre {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}


.prose img {
    max-width: 100%;
    height: auto;
}

