@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg:        #0b1120;
  --surface:   #131f35;
  --surface2:  #1a2844;
  --border:    #243352;
  --primary:   #6366f1;
  --primary-h: #4f46e5;
  --danger:    #ef4444;
  --danger-h:  #dc2626;
  --success:   #22c55e;
  --text-1:    #f0f4ff;
  --text-2:    #a8b8d8;
  --text-3:    #5a7099;
  --accent:    #818cf8;
}

body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Navbar ─────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 100;
}

.nav-logo {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-1);
  text-decoration: none;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: opacity 0.18s;
}
.nav-logo:hover { opacity: 0.8; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 6px 13px;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: all 0.18s;
  border: none;
  background: transparent;
  cursor: pointer;
}

.nav-link:hover { background: var(--surface2); color: var(--text-1); }
.nav-link.active { background: var(--surface2); color: var(--text-1); }

.nav-user {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  padding: 0 8px;
}

.nav-user-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent) !important;
  padding: 6px 13px;
  border-radius: 7px;
  text-decoration: none;
  transition: all 0.18s;
}
.nav-user-link:hover { background: var(--surface2); color: var(--text-1) !important; }

.nav-logout {
  color: #f87171;
  font-weight: 500;
}
.nav-logout:hover { background: rgba(239,68,68,0.12); color: #fca5a5; }

/* ── Footer ─────────────────────────────────────── */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 42px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-2);
}

.footer-home {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8rem;
  transition: color 0.18s;
}
.footer-home:hover { color: var(--text-1); }

/* ── App Layout ─────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 260px 300px 1fr;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  gap: 16px;
}

.sidebar-header { display: flex; flex-direction: column; gap: 10px; }

.user-greeting {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.01em;
}

.search-box input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-1);
  font-size: 0.84rem;
  font-family: inherit;
  outline: none;
  transition: border 0.18s;
}
.search-box input::placeholder { color: var(--text-3); }
.search-box input:focus { border-color: var(--primary); }

.category-filter label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.category-filter select {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-1);
  font-size: 0.84rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.stats {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-3);
  margin-top: auto;
}

/* ── Notes List ─────────────────────────────────── */
.notes-list {
  background: #0e1929;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notes-list::-webkit-scrollbar { width: 4px; }
.notes-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 14px;
  cursor: pointer;
  transition: all 0.18s;
}
.note-card:hover  { border-color: var(--primary); background: var(--surface2); }
.note-card.active { border-color: var(--primary); background: var(--surface2); box-shadow: 0 0 0 1px var(--primary); }

.note-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.note-card-preview {
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--text-3);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 8px;
  line-height: 1.5;
}

.note-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  font-size: 0.66rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
  background: rgba(99,102,241,0.18);
  color: var(--accent);
  letter-spacing: 0.02em;
}

.note-date {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-3);
}

.empty-state {
  text-align: center;
  color: var(--text-3);
  margin: auto;
  line-height: 2;
  font-size: 0.88rem;
}
.empty-state strong { color: var(--text-2); }

/* ── Editor Panel ───────────────────────────────── */
.editor-panel {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding: 24px 30px;
  overflow-y: auto;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--surface2);
}

#editorTitle {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.editor-actions { display: flex; gap: 8px; }

.editor-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.editor-form input[type="text"] {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-1);
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  outline: none;
  transition: border 0.18s;
}
.editor-form input[type="text"]::placeholder { color: var(--text-3); font-weight: 400; }
.editor-form input[type="text"]:focus { border-color: var(--primary); }

.editor-form select {
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-1);
  font-size: 0.84rem;
  font-family: inherit;
  outline: none;
  width: fit-content;
  cursor: pointer;
}

.editor-form textarea {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-2);
  font-size: 0.92rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
  line-height: 1.75;
  flex: 1;
  transition: border 0.18s;
}
.editor-form textarea::placeholder { color: var(--text-3); }
.editor-form textarea:focus { border-color: var(--primary); }

.error {
  font-size: 0.76rem;
  font-weight: 500;
  color: #f87171;
  min-height: 16px;
}

/* ── Note View ──────────────────────────────────── */
.note-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.note-view-meta { display: flex; align-items: center; gap: 12px; }

#viewTitle {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-1);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

#viewContent {
  font-size: 0.93rem;
  font-weight: 400;
  color: var(--text-2);
  line-height: 1.85;
  white-space: pre-wrap;
  flex: 1;
}

.view-actions { margin-top: 16px; }

/* ── Buttons ────────────────────────────────────── */
.btn-primary {
  padding: 8px 18px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s;
}
.btn-primary:hover { background: var(--primary-h); }

.btn-danger {
  padding: 8px 18px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s;
}
.btn-danger:hover { background: var(--danger-h); }

.btn-ghost {
  padding: 8px 18px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
}
.btn-ghost:hover { background: var(--surface); color: var(--text-1); }

/* ── Toast ──────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 56px;
  right: 24px;
  background: var(--success);
  color: #fff;
  padding: 10px 20px;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s;
  pointer-events: none;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

/* ── Auth Pages ─────────────────────────────────── */
body.auth-body {
  overflow: auto;
  height: auto;
  min-height: 100vh;
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.4);
}

.auth-icon {
  font-size: 2.2rem;
  margin-bottom: 12px;
}

.auth-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--text-2);
  margin-bottom: 28px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.02em;
}

.form-group input {
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-1);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border 0.18s;
  width: 100%;
}
.form-group input::placeholder { color: var(--text-3); }
.form-group input:focus { border-color: var(--primary); }

.input-wrap { position: relative; }
.input-wrap input { padding-right: 44px; }

.eye-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-3);
  padding: 2px 4px;
  transition: color 0.18s;
}
.eye-btn:hover { color: var(--text-2); }

.field-error {
  font-size: 0.75rem;
  font-weight: 500;
  color: #f87171;
  min-height: 14px;
}

.form-error {
  font-size: 0.8rem;
  font-weight: 500;
  color: #f87171;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 7px;
  padding: 8px 12px;
  margin-bottom: 12px;
  display: none;
}
.form-error:not(:empty) { display: block; }

.pwd-rules {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}
.pwd-rules span {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-3);
  transition: color 0.2s;
}

.btn-auth {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s;
  margin-top: 4px;
}
.btn-auth:hover { background: var(--primary-h); }
.btn-auth:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 0.84rem;
  color: var(--text-2);
}
.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.auth-switch a:hover { color: var(--text-1); }

/* ── Responsive ─────────────────────────────────── */
.mobile-only { display: none; }

@media (max-width: 768px) {
  .mobile-only { display: inline-flex; }

  body { overflow: auto; height: auto; min-height: 100vh; }

  .app {
    display: flex;
    flex-direction: column;
    height: auto;
  }

  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-header { flex-direction: row; align-items: center; gap: 8px; width: 100%; }
  .user-greeting { flex: 1; }
  .search-box { flex: 1; min-width: 140px; }
  .category-filter { min-width: 120px; }
  .category-filter label { display: none; }
  .stats { display: none; }

  .notes-list {
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-y: visible;
  }
  .notes-list.hidden { display: none; }

  .editor-panel {
    padding: 16px;
  }
  .editor-panel.hidden { display: none; }

  .footer {
    height: 32px;
    padding: 0 14px;
    font-size: 0.7rem;
  }
  .footer-home { font-size: 0.7rem; }
}

@media (max-width: 480px) {
  .navbar { padding: 0 14px; }
  .nav-logo { font-size: 0.95rem; }
  .editor-actions { flex-wrap: wrap; gap: 6px; }
}

/* ── Landing Page ───────────────────────────────── */
body.landing-body {
  overflow: auto;
  height: auto;
  min-height: 100vh;
}

.landing-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px 60px;
}

/* Hero */
.hero {
  text-align: center;
  max-width: 680px;
  padding: 80px 0 60px;
}

.hero-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 20px;
  padding: 5px 14px;
  margin-bottom: 24px;
  letter-spacing: 0.04em;
}

.hero-title {
  font-size: 3rem;
  font-weight: 900;
  color: var(--text-1);
  line-height: 1.15;
  letter-spacing: -0.04em;
  margin-bottom: 20px;
}

.hero-gradient {
  background: linear-gradient(135deg, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 36px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-hero-primary {
  padding: 13px 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.18s, transform 0.15s;
  display: inline-block;
}
.btn-hero-primary:hover { background: var(--primary-h); transform: translateY(-1px); }

.btn-hero-ghost {
  padding: 13px 28px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: all 0.18s;
  display: inline-block;
}
.btn-hero-ghost:hover { background: var(--surface); color: var(--text-1); }

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 900px;
  width: 100%;
  margin-bottom: 60px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 20px;
  transition: border-color 0.18s, transform 0.18s;
}
.feature-card:hover { border-color: var(--primary); transform: translateY(-2px); }

.feature-icon {
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-2);
  line-height: 1.6;
}

/* CTA strip */
.cta-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  text-align: center;
  max-width: 560px;
  width: 100%;
}

.cta-strip h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.03em;
  margin-bottom: 10px;
}

.cta-strip p {
  font-size: 0.88rem;
  color: var(--text-2);
  margin-bottom: 24px;
}

/* Nav CTA button */
.nav-cta {
  background: var(--primary) !important;
  color: #fff !important;
  font-weight: 600 !important;
  padding: 6px 14px !important;
}
.nav-cta:hover { background: var(--primary-h) !important; }

/* Footer links */
.footer-links {
  display: flex;
  gap: 16px;
}

@media (max-width: 700px) {
  .hero-title { font-size: 2rem; }
  .features { grid-template-columns: 1fr 1fr; }
}
