/* TeqStudy Notes — dark theme matching dashboard */

:root {
  --bg: #0b0f1a;
  --bg-elevated: #121826;
  --bg-card: #161e2e;
  --bg-card-hover: #1c2638;
  --border: #243044;
  --border-soft: #1e2a3d;
  --text: #e8eef7;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --primary: #38bdf8;
  --primary-soft: rgba(56, 189, 248, 0.14);
  --accent: #fbbf24;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --success: #34d399;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 90% 55% at 50% -20%, rgba(56, 189, 248, 0.10), transparent),
    radial-gradient(ellipse 50% 40% at 85% 30%, rgba(251, 191, 36, 0.05), transparent);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* Sidebar — match dashboard */
.sidebar {
  background: rgba(11, 15, 26, 0.9);
  border-right: 1px solid var(--border-soft);
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(14px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 28px;
}
.logo-mark {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 16px; color: #0b0f1a;
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.4);
}
.logo-name { font-weight: 700; font-size: 17px; letter-spacing: -0.3px; }
.logo-tag { font-size: 10.5px; color: var(--text-muted); margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--text-secondary); font-size: 13.5px; font-weight: 500;
  transition: all 0.18s ease;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.18), rgba(56, 189, 248, 0.05));
  color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary);
}
.nav-item svg { flex-shrink: 0; opacity: 0.9; }

.user-card {
  margin-top: auto; padding: 11px 12px;
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 11px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  display: grid; place-items: center;
  font-weight: 600; font-size: 13px; color: #0b0f1a; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-status { font-size: 11px; color: var(--success); margin-top: 1px; }

/* Main notes layout */
.main {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.notes-sidebar {
  border-right: 1px solid var(--border-soft);
  background: rgba(18, 24, 38, 0.5);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.notes-sidebar-header {
  padding: 20px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.notes-sidebar-header h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.btn-new {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: var(--primary);
  color: #0b0f1a;
  font-size: 12.5px; font-weight: 600;
  border-radius: 8px;
  transition: background 0.15s;
}
.btn-new:hover { background: #0ea5e9; }

.search-wrap {
  padding: 0 12px 12px;
}
.search-input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.search-input:focus { border-color: var(--primary); }
.search-input::placeholder { color: var(--text-muted); }

.notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 16px;
}

.note-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 4px;
  transition: background 0.12s;
  border: 1px solid transparent;
}
.note-item:hover { background: rgba(255,255,255,0.03); }
.note-item.active {
  background: var(--primary-soft);
  border-color: rgba(56, 189, 248, 0.25);
}
.note-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-item-preview {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-item-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  opacity: 0.8;
}

.notes-empty-list {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Editor */
.editor-pane {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: transparent;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-soft);
}
.mode-toggle {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.mode-btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
}
.mode-btn:hover { color: var(--text); }
.mode-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.editor-actions { display: flex; gap: 8px; align-items: center; }
.btn-ghost {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border-soft);
  transition: all 0.15s;
}
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.btn-danger {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--danger);
  border: 1px solid transparent;
  background: var(--danger-soft);
}
.btn-danger:hover { border-color: rgba(248, 113, 113, 0.3); }
.save-status {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 70px;
}
.save-status.saved { color: var(--success); }

.editor-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 28px 40px;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
}

.note-title-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
  margin-bottom: 8px;
  padding: 0;
}
.note-title-input::placeholder { color: var(--text-muted); }

.note-content-input {
  width: 100%;
  flex: 1;
  min-height: 360px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
  font-size: 14px;
}
.note-content-input::placeholder { color: var(--text-muted); font-family: 'Inter', system-ui, sans-serif; }

/* Markdown preview */
.note-preview {
  flex: 1;
  min-height: 360px;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
  padding-bottom: 24px;
}
.note-preview h1,
.note-preview h2,
.note-preview h3,
.note-preview h4 {
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 1.2em 0 0.45em;
  line-height: 1.3;
}
.note-preview h1 { font-size: 1.55rem; }
.note-preview h2 { font-size: 1.3rem; }
.note-preview h3 { font-size: 1.1rem; }
.note-preview h4 { font-size: 1rem; }
.note-preview p { margin: 0 0 0.85em; }
.note-preview a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.note-preview strong { color: var(--text); font-weight: 600; }
.note-preview em { font-style: italic; }
.note-preview code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.88em;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  padding: 1px 6px;
  border-radius: 5px;
  color: var(--primary);
}
.note-preview pre {
  background: #0d1420;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 1em;
}
.note-preview pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}
.note-preview ul,
.note-preview ol {
  margin: 0 0 1em;
  padding-left: 1.4em;
}
.note-preview li { margin-bottom: 0.35em; }
.note-preview blockquote {
  margin: 0 0 1em;
  padding: 8px 14px;
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  color: var(--text-secondary);
  border-radius: 0 8px 8px 0;
}
.note-preview hr {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: 1.4em 0;
}
.note-preview img {
  max-width: 100%;
  border-radius: 8px;
  margin: 0.5em 0;
}
.note-preview table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1em;
  font-size: 14px;
}
.note-preview th,
.note-preview td {
  border: 1px solid var(--border-soft);
  padding: 8px 10px;
  text-align: left;
}
.note-preview th {
  background: var(--bg-card);
  color: var(--text);
  font-weight: 600;
}

.editor-placeholder {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}
.editor-placeholder h2 {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.editor-placeholder p { font-size: 14px; max-width: 320px; margin: 0 auto 16px; }

.hidden { display: none !important; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { grid-template-columns: 1fr; }
  .notes-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
    max-height: 40vh;
    min-height: auto;
  }
}
