/* DevVault — Design System */
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,400&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,400&display=swap');

:root {
  --bg:        #0d0d0f;
  --bg2:       #141417;
  --bg3:       #1a1a1f;
  --surface:   #1f1f26;
  --surface2:  #26262f;
  --border:    #2e2e3a;
  --border2:   #3d3d4e;
  --text:      #e8e8f0;
  --text2:     #9898b0;
  --text3:     #5c5c72;
  --accent:    #7c6ff7;
  --accent2:   #9d96f9;
  --accentbg:  #7c6ff71a;
  --green:     #3ecf8e;
  --greenbg:   #3ecf8e18;
  --red:       #f87171;
  --redbg:     #f8717118;
  --amber:     #fbbf24;
  --radius:    10px;
  --radius-lg: 16px;
  --font:      'DM Sans', sans-serif;
  --mono:      'DM Mono', monospace;
  --shadow:    0 1px 3px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.25);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ── */
h1, h2, h3, h4 { font-weight: 500; letter-spacing: -0.02em; line-height: 1.25; }
h1 { font-size: 2.25rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.125rem; }
p  { color: var(--text2); line-height: 1.7; }
a  { color: var(--accent2); text-decoration: none; }
a:hover { color: var(--text); }
code, .mono { font-family: var(--mono); font-size: 0.875em; }

/* ── Layout ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 480px; margin: 0 auto; padding: 0 24px; }

/* ── Nav ── */
nav {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(10px);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
  max-width: 1100px; margin: 0 auto; padding: 0 24px;
}
.nav-logo {
  font-family: var(--mono);
  font-size: 1rem; font-weight: 500;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.nav-logo .logo-bracket { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 8px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: var(--font); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; border: none; transition: all 0.15s ease;
  text-decoration: none; white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent2); color: #fff; transform: translateY(-1px); }
.btn-ghost {
  background: transparent; color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface); color: var(--text); border-color: var(--border2); }
.btn-danger { background: var(--redbg); color: var(--red); border: 1px solid transparent; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.8125rem; }
.btn-icon { padding: 8px; border-radius: var(--radius); background: var(--surface); color: var(--text2); border: 1px solid var(--border); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all 0.15s; }
.btn-icon:hover { background: var(--surface2); color: var(--text); }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.8125rem; font-weight: 500; color: var(--text2); }
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font); font-size: 0.9375rem;
  transition: border-color 0.15s;
  outline: none;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--accent);
  background: var(--surface2);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text3); }
.form-select { appearance: none; cursor: pointer; }
.form-textarea { resize: vertical; min-height: 120px; font-family: var(--mono); font-size: 0.875rem; line-height: 1.6; }
.form-error { font-size: 0.8125rem; color: var(--red); }
.form-hint  { font-size: 0.8125rem; color: var(--text3); }

/* ── Cards ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.card-hover {
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
.card-hover:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* ── Snippet Card ── */
.snippet-card { display: flex; flex-direction: column; gap: 12px; }
.snippet-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.snippet-card-title { font-size: 0.9375rem; font-weight: 500; color: var(--text); line-height: 1.4; }
.snippet-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.snippet-card-preview {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: var(--mono); font-size: 0.8125rem;
  color: var(--text2); line-height: 1.6;
  overflow: hidden;
  max-height: 80px;
  position: relative;
}
.snippet-card-preview::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 32px;
  background: linear-gradient(transparent, var(--bg3));
}
.snippet-card-actions { display: flex; gap: 6px; opacity: 0; transition: opacity 0.15s; }
.card-hover:hover .snippet-card-actions { opacity: 1; }

/* ── Tags / Badges ── */
.tag {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem; font-weight: 500;
  font-family: var(--mono);
  background: var(--accentbg);
  color: var(--accent2);
  border: 1px solid var(--accent)28;
  white-space: nowrap;
}
.tag-js     { background: #fbbf2418; color: #fbbf24; border-color: #fbbf2428; }
.tag-ts     { background: #3b82f618; color: #60a5fa; border-color: #3b82f628; }
.tag-py     { background: #3ecf8e18; color: #3ecf8e; border-color: #3ecf8e28; }
.tag-sql    { background: #f97316; color: #fff; background: #f9731618; color: #fb923c; border-color: #f9731628; }
.tag-html   { background: #ef444418; color: #f87171; border-color: #ef444428; }
.tag-css    { background: #8b5cf618; color: #a78bfa; border-color: #8b5cf628; }
.tag-other  { background: var(--surface); color: var(--text2); border-color: var(--border); }

/* ── Alert / Toast ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-error   { background: var(--redbg);   color: var(--red);   border: 1px solid var(--red)30; }
.alert-success { background: var(--greenbg); color: var(--green); border: 1px solid var(--green)30; }
.alert-info    { background: var(--accentbg); color: var(--accent2); border: 1px solid var(--accent)30; }

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 24px 0; }
.divider-text {
  display: flex; align-items: center; gap: 12px;
  color: var(--text3); font-size: 0.8125rem;
}
.divider-text::before, .divider-text::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── Auth pages ── */
.auth-page {
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.auth-main {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 48px 24px;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
}
.auth-card h2 { margin-bottom: 6px; }
.auth-card > p { margin-bottom: 28px; font-size: 0.9375rem; }
.auth-form { display: flex; flex-direction: column; gap: 20px; }

/* ── Dashboard ── */
.dash-layout { display: flex; min-height: calc(100vh - 60px); }
.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  position: sticky; top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}
.sidebar-section { margin-bottom: 28px; }
.sidebar-label { font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text3); padding: 0 8px; margin-bottom: 6px; }
.sidebar-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.875rem; color: var(--text2);
  cursor: pointer; transition: all 0.1s;
  text-decoration: none;
}
.sidebar-item:hover { background: var(--surface); color: var(--text); }
.sidebar-item.active { background: var(--accentbg); color: var(--accent2); }
.sidebar-item .count {
  margin-left: auto;
  font-size: 0.75rem; color: var(--text3);
  font-family: var(--mono);
}
.dash-main { flex: 1; padding: 32px; min-width: 0; }
.dash-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.dash-header h2 { font-size: 1.25rem; }

/* ── Search bar ── */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 14px;
  transition: border-color 0.15s;
}
.search-bar:focus-within { border-color: var(--accent); }
.search-bar input {
  flex: 1; background: none; border: none; outline: none;
  font-family: var(--font); font-size: 0.9375rem;
  color: var(--text); padding: 10px 0;
}
.search-bar input::placeholder { color: var(--text3); }
.search-icon { color: var(--text3); font-size: 1rem; }

/* ── Snippets grid ── */
.snippets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.snippets-empty {
  text-align: center; padding: 80px 24px;
  color: var(--text3);
}
.snippets-empty .empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.snippets-empty h3 { color: var(--text2); margin-bottom: 6px; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); padding: 32px;
  width: 100%; max-width: 600px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(12px); transition: transform 0.2s;
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-form { display: flex; flex-direction: column; gap: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ── Snippet detail ── */
.snippet-detail { max-width: 860px; }
.snippet-detail-header { margin-bottom: 24px; }
.snippet-detail-header h1 { font-size: 1.5rem; margin-bottom: 10px; }
.code-block {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.code-block-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.code-block-lang { font-family: var(--mono); font-size: 0.8125rem; color: var(--text2); }
.code-block pre {
  padding: 20px; overflow-x: auto;
  font-family: var(--mono); font-size: 0.875rem;
  line-height: 1.7; color: var(--text);
}

/* ── Landing ── */
.hero {
  padding: 100px 24px 80px;
  text-align: center;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accentbg); color: var(--accent2);
  border: 1px solid var(--accent)30;
  border-radius: 20px; padding: 5px 14px;
  font-size: 0.8125rem; font-weight: 500;
  margin-bottom: 28px;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); max-width: 700px; margin: 0 auto 20px; }
.hero h1 span { color: var(--accent); }
.hero p { font-size: 1.125rem; max-width: 540px; margin: 0 auto 36px; }
.hero-cta { display: flex; align-items: center; gap: 12px; justify-content: center; flex-wrap: wrap; }
.features { padding: 60px 24px 100px; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.feature-card { padding: 28px; }
.feature-icon { font-size: 1.5rem; margin-bottom: 12px; }
.feature-card h3 { margin-bottom: 8px; }

/* ── Utility ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-4 { margin-top: 20px; }
.w-full { width: 100%; }
.text-sm { font-size: 0.875rem; }
.text-muted { color: var(--text2); }
.text-xs { font-size: 0.75rem; }
.hidden { display: none !important; }
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .dash-main { padding: 20px 16px; }
  .snippets-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
  .modal { padding: 24px 16px; }
}