/* ============================================================
   Code & Poetry Blog - Complete Stylesheet
   ============================================================ */

/* ==================== CSS Variables & Themes ==================== */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
  --shadow-xl: 0 16px 60px rgba(0,0,0,0.15);

  --transition: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme (default) */
[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fc;
  --bg-tertiary: #f0f2f8;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-code: #1e1e2e;
  --bg-modal: rgba(0,0,0,0.5);
  --bg-sidebar: #f8f9fc;

  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-tertiary: #8888a0;
  --text-inverse: #ffffff;
  --text-link: #6366f1;

  --border-color: #e2e4f0;
  --border-light: #f0f2f8;

  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #eef2ff;
  --accent-glow: rgba(99,102,241,0.3);

  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --error: #ef4444;
  --error-light: #fee2e2;
  --info: #3b82f6;
  --info-light: #dbeafe;

  --gradient-1: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  --gradient-2: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
  --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Dark Theme */
[data-theme="dark"] {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #252540;
  --bg-card: #1a1a2e;
  --bg-input: #252540;
  --bg-code: #111122;
  --bg-modal: rgba(0,0,0,0.7);
  --bg-sidebar: #13132a;

  --text-primary: #e4e4f0;
  --text-secondary: #a0a0c0;
  --text-tertiary: #6a6a8a;
  --text-inverse: #ffffff;
  --text-link: #818cf8;

  --border-color: #2a2a45;
  --border-light: #1e1e38;

  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-light: #1e1e3a;
  --accent-glow: rgba(129,140,248,0.25);

  --success: #34d399;
  --success-light: #064e3b;
  --warning: #fbbf24;
  --warning-light: #78350f;
  --error: #f87171;
  --error-light: #7f1d1d;
  --info: #60a5fa;
  --info-light: #1e3a5f;

  --gradient-1: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #c084fc 100%);
  --gradient-2: linear-gradient(135deg, #fb923c 0%, #f87171 100%);
  --gradient-hero: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--accent-hover); }

img {
  max-width: 100%;
  height: auto;
  display: block;
}

code, pre {
  font-family: var(--font-mono);
}

::selection {
  background: var(--accent);
  color: var(--text-inverse);
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ==================== CONTAINER ==================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==================== NAVIGATION ==================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: transparent;
  transition: background var(--transition), box-shadow var(--transition), backdrop-filter var(--transition);
  padding: 0;
}
.navbar.scrolled {
  background: var(--bg-primary);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}
[data-theme="light"] .navbar.scrolled {
  background: rgba(255,255,255,0.92);
}
[data-theme="dark"] .navbar.scrolled {
  background: rgba(15,15,26,0.92);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}
.nav-logo:hover { color: var(--accent); }
.nav-logo svg { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 0;
  position: relative;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width var(--transition);
}
.nav-link:hover { color: var(--text-primary); }
.nav-link:hover::after { width: 100%; }
.nav-link.active { color: var(--accent); }
.nav-link.active::after { width: 100%; }

/* Theme Toggle */
.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.theme-toggle:hover {
  background: var(--accent-light);
  color: var(--accent);
}
.theme-toggle-fixed {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1100;
}

[data-theme="light"] .sun-icon { display: block; }
[data-theme="light"] .moon-icon { display: none; }
[data-theme="dark"] .sun-icon { display: none; }
[data-theme="dark"] .moon-icon { display: block; }

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.mobile-menu-btn span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--transition);
}

/* ==================== HERO ==================== */
.hero {
  position: relative;
  padding: 140px 24px 80px;
  text-align: center;
  overflow: hidden;
  background: var(--bg-secondary);
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -20%;
  width: 140%;
  height: 200%;
  background: var(--gradient-hero);
  opacity: 0.05;
  border-radius: 50%;
  animation: heroFloat 20s ease-in-out infinite;
}
@keyframes heroFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(20px, -30px) rotate(5deg); }
  66% { transform: translate(-10px, 20px) rotate(-3deg); }
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin: 0 auto;
}

.hero-title {
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
  letter-spacing: -1px;
}

.gradient-text {
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.hero-search {
  display: flex;
  max-width: 440px;
  margin: 0 auto 32px;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.search-input {
  flex: 1;
  padding: 14px 20px;
  border: 2px solid var(--border-color);
  border-right: none;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--accent); }
.search-btn {
  padding: 14px 20px;
  background: var(--accent);
  border: none;
  color: var(--text-inverse);
  cursor: pointer;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  transition: background var(--transition);
  display: flex;
  align-items: center;
}
.search-btn:hover { background: var(--accent-hover); }

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
}
.stat { text-align: center; }
.stat-number {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Hero Background Shapes */
.hero-bg-shapes { position: absolute; inset: 0; pointer-events: none; }
.shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.06;
}
.shape1 {
  width: 400px; height: 400px;
  background: var(--accent);
  top: -150px; right: -100px;
  animation: shapeFloat 15s ease-in-out infinite;
}
.shape2 {
  width: 250px; height: 250px;
  background: #8b5cf6;
  bottom: -80px; left: -80px;
  animation: shapeFloat 12s ease-in-out infinite reverse;
}
.shape3 {
  width: 150px; height: 150px;
  background: var(--accent);
  top: 50%; left: 10%;
  animation: shapeFloat 18s ease-in-out infinite;
}
@keyframes shapeFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -20px) scale(1.1); }
}

/* ==================== CATEGORY FILTERS ==================== */
.categories-section {
  padding: 24px 0;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-primary);
  position: sticky;
  top: 73px;
  z-index: 900;
  backdrop-filter: blur(12px);
}
.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.category-btn {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: 50px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: var(--font-sans);
}
.category-btn:hover { border-color: var(--accent); color: var(--accent); }
.category-btn.active {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
}

/* ==================== POSTS GRID ==================== */
.posts-section {
  padding: 48px 0 80px;
  min-height: 400px;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 28px;
}

/* Post Card */
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-slow);
  display: flex;
  flex-direction: column;
}
.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}
.post-card-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: var(--bg-tertiary);
}
.post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}
.post-card:hover .post-card-image img { transform: scale(1.05); }
.post-card-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: var(--gradient-1);
  opacity: 0.3;
}

.post-card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card-category {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.post-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
}
.post-card-title a {
  color: var(--text-primary);
}
.post-card-title a:hover { color: var(--accent); }

.post-card-excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 12px;
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.post-card-tag {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 50px;
}

.post-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-tertiary);
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

/* ==================== SINGLE POST ==================== */
.single-post {
  padding-top: 90px;
}
.post-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.post-header {
  margin-bottom: 32px;
  text-align: center;
}
.post-header .post-category {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.post-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.5px;
}
.post-meta-info {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 0.9rem;
  color: var(--text-tertiary);
  margin-top: 12px;
}

.post-featured-image {
  width: 100%;
  border-radius: var(--radius-lg);
  margin-bottom: 32px;
  max-height: 500px;
  object-fit: cover;
}

.post-body {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-primary);
}
.post-body h1 { font-size: 2rem; font-weight: 700; margin: 32px 0 16px; }
.post-body h2 { font-size: 1.6rem; font-weight: 700; margin: 28px 0 12px; }
.post-body h3 { font-size: 1.3rem; font-weight: 600; margin: 24px 0 10px; }
.post-body p { margin-bottom: 16px; }
.post-body img {
  border-radius: var(--radius-md);
  margin: 24px auto;
}
.post-body blockquote {
  border-left: 4px solid var(--accent);
  padding: 12px 20px;
  margin: 20px 0;
  background: var(--bg-tertiary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--text-secondary);
}
.post-body ul, .post-body ol {
  margin: 16px 0;
  padding-left: 24px;
}
.post-body li { margin-bottom: 6px; }
.post-body hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 32px 0;
}
.post-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.post-body pre {
  background: var(--bg-code);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 20px 0;
  font-size: 0.88rem;
  position: relative;
}
.post-body pre code {
  display: block;
  padding: 20px;
  color: #e4e4f0;
  line-height: 1.6;
}

.code-block-wrapper {
  position: relative;
  margin: 20px 0;
}
.code-block-wrapper pre {
  margin: 0;
  border-radius: var(--radius-md);
}
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255,255,255,0.12);
  border: none;
  color: #e4e4f0;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background var(--transition);
  font-family: var(--font-sans);
  opacity: 0;
}
.code-block-wrapper:hover .copy-btn,
.code-block-wrapper pre:hover + .copy-btn { opacity: 1; }
.copy-btn:hover { background: rgba(255,255,255,0.22); }

.post-body code:not(pre code) {
  background: var(--bg-tertiary);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.9em;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}
.post-tag {
  font-size: 0.82rem;
  color: var(--accent);
  background: var(--accent-light);
  padding: 4px 12px;
  border-radius: 50px;
  font-weight: 500;
}

/* ==================== PAGINATION ==================== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
}
.pagination-btn {
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--transition);
  font-family: var(--font-sans);
}
.pagination-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pagination-btn.active {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
}
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ==================== LOADING & EMPTY ==================== */
.loading-spinner {
  display: flex;
  justify-content: center;
  padding: 60px 0;
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}
.no-results h3 { margin-top: 16px; font-size: 1.2rem; color: var(--text-secondary); }

/* ==================== NEWSLETTER ==================== */
.newsletter-section {
  padding: 60px 24px;
  background: var(--bg-secondary);
}
.newsletter-card {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
  padding: 48px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}
.newsletter-card h2 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}
.newsletter-card p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}
.newsletter-form {
  display: flex;
  gap: 8px;
  max-width: 420px;
  margin: 0 auto;
}
.newsletter-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-sans);
}

/* ==================== ABOUT ==================== */
.about-section {
  padding: 80px 24px;
  text-align: center;
}
.about-content h2 {
  font-size: 1.8rem;
  margin-bottom: 16px;
}
.about-content p {
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* ==================== FOOTER ==================== */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-light);
  padding: 60px 24px 24px;
}
.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 40px;
}
.footer-brand h3 { font-size: 1.2rem; margin-bottom: 8px; }
.footer-brand p { color: var(--text-tertiary); font-size: 0.9rem; }
.footer-links h4, .footer-social h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}
.footer-links a {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.footer-links a:hover { color: var(--accent); }
.social-icons { display: flex; gap: 12px; }
.social-icons a {
  color: var(--text-tertiary);
  transition: color var(--transition);
}
.social-icons a:hover { color: var(--accent); }
.footer-bottom {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  font-size: 0.82rem;
  color: var(--text-tertiary);
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: var(--font-sans);
  white-space: nowrap;
}
.btn svg { flex-shrink: 0; }
.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 15px var(--accent-glow); }
.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.btn-danger {
  background: var(--error);
  color: var(--text-inverse);
}
.btn-danger:hover { background: #dc2626; }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 0.82rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==================== TOAST ==================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}
.toast {
  padding: 14px 24px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-inverse);
  animation: toastIn 0.3s ease forwards;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--error); }
.toast-info { background: var(--info); }
.toast-warning { background: var(--warning); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== LOGIN PAGE ==================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
}
.login-container {
  width: 100%;
  max-width: 420px;
  padding: 24px;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}
.login-header {
  text-align: center;
  margin-bottom: 32px;
}
.login-header svg { color: var(--accent); margin-bottom: 12px; }
.login-header h1 { font-size: 1.6rem; margin-bottom: 4px; }
.login-header p { color: var(--text-tertiary); font-size: 0.9rem; }
.login-error {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--error-light);
  color: var(--error);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 0.88rem;
}

/* ==================== FORMS ==================== */
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-input-lg {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input-lg:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  resize: vertical;
  line-height: 1.6;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-textarea-lg {
  font-family: var(--font-mono);
  font-size: 0.88rem;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
.form-row-2col {
  grid-template-columns: 1fr 1fr;
}
select.form-input-lg {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238888a0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* Password Toggle */
.password-wrapper {
  position: relative;
}
.password-wrapper .form-input-lg { padding-right: 50px; }
.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}
.password-toggle:hover { color: var(--text-primary); }

.back-home {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  font-size: 0.88rem;
  color: var(--text-tertiary);
}
.back-home:hover { color: var(--accent); }

/* ==================== DASHBOARD LAYOUT ==================== */
.dashboard-page {
  background: var(--bg-secondary);
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition);
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px;
  font-size: 1.1rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border-light);
  color: var(--accent);
}
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-sans);
}
.sidebar-link:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.sidebar-link.active {
  background: var(--accent-light);
  color: var(--accent);
}
.sidebar-footer {
  padding: 16px 8px;
  border-top: 1px solid var(--border-light);
}

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1100;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px;
  cursor: pointer;
  color: var(--text-primary);
}

/* Admin Main */
.admin-main {
  margin-left: 260px;
  min-height: 100vh;
  padding-bottom: 40px;
}
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
}
.admin-header-left h1 {
  font-size: 1.4rem;
  font-weight: 700;
}
.admin-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.badge {
  font-size: 0.82rem;
  padding: 4px 12px;
  border-radius: 50px;
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

/* Admin Sections */
.admin-content { padding: 32px; }
.admin-section { display: none; }
.admin-section.active { display: block; }

/* Admin Table */
.admin-table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.admin-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}
.admin-table-header h2 { font-size: 1.1rem; font-weight: 700; }

.admin-table {
  overflow-x: auto;
}
.table-row {
  display: grid;
  grid-template-columns: 1fr 140px 140px 120px;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-light);
  gap: 12px;
  font-size: 0.9rem;
}
.table-row:last-child { border-bottom: none; }
.table-row-header {
  font-weight: 700;
  color: var(--text-tertiary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-tertiary);
}
.table-cell-title a {
  color: var(--text-primary);
  font-weight: 500;
}
.table-cell-title a:hover { color: var(--accent); }
.table-cell-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.action-btn {
  padding: 6px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
}
.action-btn:hover { border-color: var(--accent); color: var(--accent); }
.delete-btn:hover { border-color: var(--error); color: var(--error); }

/* Post Editor */
.post-editor-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
}

/* Markdown Toolbar */
.markdown-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  flex-wrap: wrap;
}
.toolbar-btn {
  padding: 6px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.82rem;
  transition: all var(--transition);
  font-family: var(--font-sans);
  font-weight: 500;
}
.toolbar-btn:hover { background: var(--accent-light); color: var(--accent); }
.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border-color);
  margin: 0 4px;
}
.markdown-toolbar + .form-textarea {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* Image Input */
.image-input-group { position: relative; }
.image-preview {
  display: inline-block;
  position: relative;
  margin-top: 8px;
  border-radius: var(--radius-md);
  overflow: hidden;
  max-width: 200px;
}
.image-preview img { width: 100%; border-radius: var(--radius-md); }
.image-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  margin-top: 24px;
}

/* Categories List */
.categories-list { padding: 16px 24px; }
.category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  margin-bottom: 8px;
}
.category-item-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}
.category-color {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.category-item-count {
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

.settings-group {
  margin-top: 24px;
  padding: 24px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}
.settings-group h3 { font-size: 1rem; margin-bottom: 16px; }

/* ==================== MODALS ==================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg-modal);
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalIn 0.25s ease;
}
.modal-sm { max-width: 440px; }
.modal-lg { max-width: 800px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}
.modal-header h2 { font-size: 1.1rem; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
}
.text-tertiary { color: var(--text-tertiary); font-size: 0.88rem; }

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

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0;
  }
  .sidebar-toggle {
    display: flex;
  }
  .admin-header {
    padding-left: 64px;
  }
  .footer-content {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .hero-title { font-size: 2.2rem; }
  .hero-subtitle { font-size: 1rem; }
  .hero-stats { gap: 32px; }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    flex-direction: column;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
  }
  .nav-links.open { display: flex; }
  .mobile-menu-btn { display: flex; }

  .posts-grid {
    grid-template-columns: 1fr;
  }

  .newsletter-form {
    flex-direction: column;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .table-row {
    grid-template-columns: 1fr 100px 80px;
    font-size: 0.82rem;
  }
  .table-cell-date { display: none; }
  .table-row-header .table-cell-date { display: block; }

  .form-row-2col {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
    gap: 12px;
  }

  .post-editor-card {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .login-card { padding: 24px; }
  .hero { padding: 120px 16px 60px; }
  .category-filters { gap: 6px; }
  .category-btn { padding: 6px 12px; font-size: 0.78rem; }
  .admin-content { padding: 16px; }
}