/* Docs engine styles — personal markdown notes editor */

:root {
  --notes-bg: #faf8f5;
  --notes-surface: #ffffff;
  --notes-text: #1a1a1a;
  --notes-text-muted: #6b7280;
  --notes-accent: #1d4ed8;
  --notes-accent-hover: #1e40af;
  --notes-border: #e5e2dd;
  --notes-radius: 6px;
  --notes-editor-min-height: 60vh;
}

.notes {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--notes-text);
  background: var(--notes-bg);
  min-height: 100vh;
}

/* ---- Header ---- */

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

.notes-header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0;
}

/* ---- Navigation ---- */

.notes-nav {
  margin-bottom: 1.5rem;
}

.notes-back-link {
  color: var(--notes-accent);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.notes-back-link:hover {
  color: var(--notes-accent-hover);
  text-decoration: underline;
}

/* ---- Buttons ---- */

.notes-btn {
  display: inline-block;
  padding: 0.4375rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--notes-radius);
  border: 1px solid var(--notes-border);
  background: var(--notes-surface);
  color: var(--notes-text);
  cursor: pointer;
  text-decoration: none;
  line-height: 1.5;
}

.notes-btn:hover {
  background: #f5f3f0;
}

.notes-btn-primary {
  background: var(--notes-accent);
  border-color: var(--notes-accent);
  color: #ffffff;
}

.notes-btn-primary:hover {
  background: var(--notes-accent-hover);
  border-color: var(--notes-accent-hover);
  color: #ffffff;
}

/* ---- Empty state ---- */

.notes-empty {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--notes-text-muted);
}

.notes-empty p {
  margin: 0.5rem 0;
}

.notes-empty-hint {
  font-size: 0.875rem;
}

.notes-empty-hint a {
  color: var(--notes-accent);
}

/* ---- Document list ---- */

.notes-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.notes-list-item {
  border-bottom: 1px solid var(--notes-border);
}

.notes-list-item:first-child {
  border-top: 1px solid var(--notes-border);
}

.notes-list-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  text-decoration: none;
  color: inherit;
}

.notes-list-link:hover .notes-list-title {
  color: var(--notes-accent);
}

.notes-list-title {
  font-size: 1rem;
  font-weight: 500;
}

.notes-list-date {
  font-size: 0.8125rem;
  color: var(--notes-text-muted);
  white-space: nowrap;
  margin-left: 1rem;
}

/* ---- Form (new) ---- */

.notes-form {
  max-width: 720px;
}

.notes-field {
  margin-bottom: 1.25rem;
}

.notes-field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: var(--notes-text-muted);
}

.notes-input,
.notes-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--notes-border);
  border-radius: var(--notes-radius);
  font-size: 0.9375rem;
  font-family: inherit;
  background: var(--notes-surface);
  color: var(--notes-text);
  box-sizing: border-box;
}

.notes-input:focus,
.notes-textarea:focus {
  outline: 2px solid var(--notes-accent);
  outline-offset: -1px;
  border-color: var(--notes-accent);
}

.notes-textarea {
  resize: vertical;
  font-family: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, monospace;
  font-size: 0.875rem;
  line-height: 1.6;
}

.notes-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.notes-errors {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--notes-radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  color: #991b1b;
  font-size: 0.875rem;
}

.notes-errors p {
  margin: 0;
}

/* ---- Editor (two-column) ---- */

.notes-editor-page {
  max-width: 100%;
  padding: 1.25rem 1.5rem;
}

.notes-editor-form {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 6rem);
}

.notes-editor-title-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.notes-title-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  border: 1px solid var(--notes-border);
  border-radius: var(--notes-radius);
  background: var(--notes-surface);
  color: var(--notes-text);
  font-family: inherit;
}

.notes-title-input:focus {
  outline: 2px solid var(--notes-accent);
  outline-offset: -1px;
  border-color: var(--notes-accent);
}

.notes-editor-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

.notes-editor-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--notes-border);
  border-radius: var(--notes-radius);
  background: var(--notes-surface);
}

.notes-editor-textarea {
  flex: 1;
  resize: none;
  border: none;
  border-radius: 0;
  padding: 1rem;
  min-height: var(--notes-editor-min-height);
  overflow-y: auto;
}

.notes-editor-textarea:focus {
  outline: none;
  border: none;
}

.notes-editor-source:focus-within {
  outline: 2px solid var(--notes-accent);
  outline-offset: -1px;
}

.notes-preview {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--notes-text);
}

/* ---- Preview rendered markdown styles ---- */

.notes-preview h1,
.notes-preview h2,
.notes-preview h3,
.notes-preview h4,
.notes-preview h5,
.notes-preview h6 {
  margin: 1.25rem 0 0.5rem;
  font-weight: 600;
  line-height: 1.3;
}

.notes-preview h1 { font-size: 1.625rem; }
.notes-preview h2 { font-size: 1.375rem; }
.notes-preview h3 { font-size: 1.125rem; }

.notes-preview p {
  margin: 0 0 0.875rem;
}

.notes-preview ul,
.notes-preview ol {
  margin: 0 0 0.875rem;
  padding-left: 1.5rem;
}

.notes-preview li {
  margin-bottom: 0.25rem;
}

.notes-preview code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.875em;
  background: #f3f4f6;
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.notes-preview pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 1rem;
  border-radius: var(--notes-radius);
  overflow-x: auto;
  margin: 0 0 0.875rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.notes-preview pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.notes-preview blockquote {
  margin: 0 0 0.875rem;
  padding: 0.5rem 0 0.5rem 1rem;
  border-left: 3px solid var(--notes-border);
  color: var(--notes-text-muted);
}

.notes-preview hr {
  border: none;
  border-top: 1px solid var(--notes-border);
  margin: 1.25rem 0;
}

.notes-preview a {
  color: var(--notes-accent);
}

.notes-preview table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 0.875rem;
  font-size: 0.9rem;
}

.notes-preview th,
.notes-preview td {
  border: 1px solid var(--notes-border);
  padding: 0.4rem 0.75rem;
  text-align: left;
}

.notes-preview th {
  background: #f9fafb;
  font-weight: 600;
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
  .notes-editor-columns {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }

  .notes-editor-form {
    height: auto;
  }

  .notes-editor-pane {
    min-height: 40vh;
  }
}
