﻿@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;600&family=Space+Grotesk:wght@400;600&display=swap');

:root {
  color-scheme: light;
  --bg-1: #f8f4ef;
  --bg-2: #eff5f2;
  --panel: #ffffff;
  --ink: #1c1c1c;
  --muted: #6b6b6b;
  --line: #e3e3e3;
  --accent: #0b7a6e;
  --accent-soft: #d3efe9;
  --danger: #c54545;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", "Space Grotesk", sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 600px at 20% 10%, #fff6e8 0%, transparent 60%),
    radial-gradient(900px 500px at 85% 0%, #e7f3f2 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  min-height: 100vh;
}

.page {
  max-width: 1200px;
  margin: 24px auto 40px;
  padding: 0 20px 20px;
  animation: fadeIn 0.6s ease;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: conic-gradient(from 220deg, #f2b66e, #0b7a6e, #f2b66e);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6);
}

.brand-title {
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
  font-weight: 600;
  letter-spacing: 0.5px;
  font-size: 20px;
}

.brand-sub {
  color: var(--muted);
  font-size: 13px;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  border: none;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 20px rgba(11, 122, 110, 0.25);
}

.btn.ghost {
  background: #ffffff;
  color: var(--accent);
  border: 1px solid var(--accent-soft);
}

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

.btn:hover {
  transform: translateY(-1px);
}

.status-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: #f1f1f1;
  color: var(--muted);
  font-size: 12px;
}

.status-pill.online {
  background: var(--accent-soft);
  color: var(--accent);
}

.user-chip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
}

.content {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
}

.sidebar,
.editor {
  background: var(--panel);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 18px;
  min-height: 70vh;
}

.search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

.note-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-card {
  border-radius: 14px;
  border: 1px solid transparent;
  padding: 12px;
  cursor: pointer;
  transition: border 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.note-card:hover {
  border-color: var(--accent-soft);
  background: #f7fbfa;
  transform: translateY(-1px);
}

.note-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.note-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.note-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  background: #fff4db;
  color: #b26b00;
}

.note-preview {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.editor-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

#titleInput {
  flex: 1;
  border: none;
  border-bottom: 1px solid var(--line);
  font-size: 20px;
  padding: 8px 6px;
  outline: none;
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
}

.meta {
  color: var(--muted);
  font-size: 12px;
}

.view-tabs {
  margin-top: 12px;
  display: inline-flex;
  gap: 8px;
  background: #f7f7f7;
  padding: 6px;
  border-radius: 999px;
}

.view-tabs .tab {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
}

.view-tabs .tab.active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.editor-body {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: 40vh;
}

#contentInput,
.preview-pane {
  width: 100%;
  min-height: 40vh;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  font-size: 15px;
  line-height: 1.6;
  outline: none;
  font-family: "Noto Sans SC", "Space Grotesk", sans-serif;
  background: #fafafa;
}

#contentInput {
  resize: vertical;
}

.preview-pane {
  background: #ffffff;
  overflow-y: auto;
}

.preview-pane h1,
.preview-pane h2,
.preview-pane h3 {
  margin-top: 1em;
}

.preview-pane code {
  background: #f2f2f2;
  padding: 2px 4px;
  border-radius: 6px;
  font-family: "Space Grotesk", monospace;
}

.preview-pane pre {
  background: #f2f2f2;
  padding: 12px;
  border-radius: 12px;
  overflow-x: auto;
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.status {
  color: var(--muted);
  font-size: 13px;
}

.auth-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 14, 14, 0.45);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 50;
}

.auth-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.auth-card {
  width: min(420px, 90vw);
  background: #ffffff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.auth-title {
  font-size: 22px;
  font-weight: 600;
}

.auth-sub {
  color: var(--muted);
  margin-top: 6px;
  font-size: 13px;
}

.auth-tabs {
  margin-top: 16px;
  display: flex;
  gap: 10px;
}

.auth-tabs .tab {
  flex: 1;
  border: 1px solid var(--line);
  background: #f7f7f7;
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
  font-weight: 600;
}

.auth-tabs .tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.auth-form {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.auth-form input {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}

.auth-hint {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 20;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1000px) {
  .content {
    grid-template-columns: 1fr;
  }

  .editor-body {
    grid-template-columns: 1fr;
  }

  body.preview-mode #contentInput {
    display: none;
  }

  body.preview-mode .preview-pane {
    display: block;
  }

  body:not(.preview-mode) .preview-pane {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(320px, 85vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    z-index: 30;
  }

  body.show-list .sidebar {
    transform: translateX(0);
  }

  body.show-list .backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 600px) {
  .page {
    margin: 10px auto 24px;
  }

  .actions {
    justify-content: flex-start;
  }

  .btn {
    padding: 8px 12px;
  }
}
