/* ===== Single Dark Theme (Catppuccin Mocha) ===== */
:root {
  --bg:             #1e1e2e;   /* main content background          */
  --surface:        #181825;   /* elevated surface: code, blockquote */
  --sidebar-bg:     #11111b;   /* sidebar — darkest layer           */
  --sidebar-text:   #cdd6f4;
  --sidebar-muted:  #6c7086;
  --sidebar-hover:  #1e1e2e;
  --sidebar-active: #313244;
  --accent:         #89b4fa;   /* blue accent / links               */
  --text:           #cdd6f4;   /* primary text — always light       */
  --text-muted:     #a6adc8;
  --meta:           #a6adc8;   /* alias used in login page          */
  --border:         #313244;
  --badge-free:     #a6e3a1;
  --badge-paid:     #f38ba8;
  --badge-text:     #11111b;   /* dark text on coloured badges      */
  --search-bg:      #181825;
  --search-text:    #cdd6f4;
  --search-border:  #45475a;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.25s, color 0.25s;
  min-height: 100vh;
}

/* ===== Layout ===== */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 300px;
  min-width: 260px;
  max-width: 340px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  border-right: 1px solid #313244;
  transition: transform 0.3s ease;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 12px;
  border-bottom: 1px solid #313244;
  flex-shrink: 0;
}

.site-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.03em;
}


.logout-btn {
  background: transparent;
  border: none;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  margin-left: 4px;
}
.logout-btn:hover { background: rgba(255, 80, 80, 0.15); }

/* Search */
.search-wrap {
  padding: 10px 12px;
  flex-shrink: 0;
}
.search-wrap input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--search-border);
  background: var(--search-bg);
  color: var(--search-text);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
}
.search-wrap input::placeholder { color: var(--sidebar-muted); }
.search-wrap input:focus { border-color: var(--accent); }

/* Blog List */
.blog-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #45475a transparent;
}
.blog-list::-webkit-scrollbar { width: 4px; }
.blog-list::-webkit-scrollbar-thumb { background: #45475a; border-radius: 4px; }

.blog-item {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 16px;
  cursor: pointer;
  border-bottom: 1px solid #2a2a3d;
  transition: background 0.15s;
}
.blog-item:hover { background: var(--sidebar-hover); }
.blog-item.active { background: var(--sidebar-active); border-left: 3px solid var(--accent); }

.blog-item-row {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 28px;
  padding-top: 2px;
  flex-shrink: 0;
  opacity: 0.75;
}

.blog-item-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.blog-item-title {
  font-size: 0.88rem;
  color: var(--sidebar-text);
  line-height: 1.35;
  font-weight: 500;
}
.blog-item.active .blog-item-title { color: #fff; }

.blog-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--sidebar-muted);
}

.badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  color: var(--badge-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-free { background: var(--badge-free); }
.badge-paid { background: var(--badge-paid); }

.loading-msg {
  color: var(--sidebar-muted);
  padding: 20px 16px;
  font-size: 0.88rem;
}

.no-results {
  color: var(--sidebar-muted);
  padding: 16px;
  font-size: 0.85rem;
  text-align: center;
}

/* ===== Mobile sidebar toggle button ===== */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  font-size: 1.3rem;
  cursor: pointer;
  color: #1e1e2e;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ===== Main Content ===== */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 40px 48px;
  background: var(--bg);
  transition: background 0.25s;
}

/* Welcome screen */
.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 70vh;
  gap: 12px;
  color: var(--text-muted);
  text-align: center;
}
.welcome-icon { font-size: 3.5rem; }
.welcome h2 { font-size: 1.5rem; color: var(--text); }
.welcome p { font-size: 1rem; }

/* Post */
.post { max-width: 740px; }
.post.hidden { display: none; }

.post-header {
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.post-title {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 10px;
}

.post-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

/* Post body HTML content */
.post-body {
  font-size: 1.02rem;
  line-height: 1.8;
  color: var(--text);
}

.post-body h1 { font-size: 1.5rem; margin: 24px 0 12px; color: var(--text); }
.post-body h2 { font-size: 1.3rem; margin: 22px 0 10px; color: var(--text); }
.post-body h3 { font-size: 1.1rem; margin: 18px 0 8px; color: var(--text); }
.post-body p  { margin: 0 0 1em; }
.post-body ul, .post-body ol { margin: 0 0 1em 1.5em; }
.post-body li { margin-bottom: 4px; }
.post-body strong { font-weight: 700; }
.post-body em { font-style: italic; }
.post-body blockquote {
  border-left: 4px solid var(--accent);
  padding: 8px 16px;
  margin: 16px 0;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: 0 8px 8px 0;
}
.post-body img {
  max-width: 100%;
  border-radius: 8px;
  margin: 12px 0;
}
.post-body a { color: var(--accent); text-decoration: underline; }
.post-body code {
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.9em;
}
.post-body pre {
  background: var(--surface);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
}

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .sidebar-toggle { display: flex; align-items: center; justify-content: center; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; height: 100%;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }

  .content { padding: 56px 20px 24px; }
  .post-title { font-size: 1.3rem; }
}
