/* =========================================
   GLOBAL RESET & ROOT VARIABLES
========================================= */

:root {
  --bg-color: #f5f7fb;
  --surface-color: #ffffff;
  --surface-2: #f9fafb;

  --text-main: #111827;
  --text-muted: #6b7280;

  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;

  --border-color: #e5e7eb;

  --success-color: #10b981;
  --danger-color: #ef4444;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.08);

  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 24px;

  --transition: all 0.25s ease;
}

[data-theme="dark"] {
  --bg-color: #0d1117;
  --surface-color: #161b22;
  --surface-2: #1c2128;

  --text-main: #f0f6fc;
  --text-muted: #8b949e;

  --primary-color: #58a6ff;
  --primary-hover: #79c0ff;

  --border-color: #30363d;

  --shadow-sm: none;
  --shadow-md: none;
}

/* =========================================
   RESET
========================================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-color);
  color: var(--text-main);

  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;

  line-height: 1.7;
  overflow-x: hidden;

  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  transition: var(--transition);
}

img {
  max-width: 100%;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

.container {
  width: 100%;
  max-width: 1240px;
  margin: auto;
  padding: 0 20px;
}

/* =========================================
   NAVBAR
========================================= */

.main-header {
  position: sticky;
  top: 0;
  z-index: 999;

  backdrop-filter: blur(16px);

  background: rgba(255, 255, 255, 0.8);

  border-bottom: 1px solid var(--border-color);

  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 18px 24px;
}

[data-theme="dark"] .main-header {
  background: rgba(13, 17, 23, 0.8);
}

.logo a {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -1px;

  color: var(--text-main);
}

.desktop-nav ul {
  display: flex;
  list-style: none;
  gap: 30px;
}

.desktop-nav a {
  color: var(--text-muted);
  font-weight: 600;
  position: relative;
}

.desktop-nav a::after {
  content: "";

  position: absolute;
  left: 0;
  bottom: -6px;

  width: 0%;
  height: 2px;

  background: var(--primary-color);

  transition: var(--transition);
}

.desktop-nav a:hover {
  color: var(--primary-color);
}

.desktop-nav a:hover::after {
  width: 100%;
}

#theme-toggle {
  border: none;
  background: transparent;

  color: var(--text-main);

  font-size: 1.2rem;

  cursor: pointer;
}

/* =========================================
   HERO SECTION
========================================= */

.blog-intro {
  text-align: center;
  padding: 80px 20px 60px;
}

.blog-intro h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);

  line-height: 1.1;

  font-weight: 900;

  letter-spacing: -2px;

  margin-bottom: 20px;
}

.blog-intro p {
  max-width: 720px;
  margin: auto;

  color: var(--text-muted);

  font-size: 1.1rem;
}

/* =========================================
   BLOG LAYOUT
========================================= */

.blog-container {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;

  margin-bottom: 80px;
}

.blog-main {
  min-width: 0;
}

/* =========================================
   BLOG CARD
========================================= */

.blog-post-card {
  background: var(--surface-color);

  border: 1px solid var(--border-color);

  border-radius: var(--radius-md);

  overflow: hidden;

  margin-bottom: 30px;

  transition: var(--transition);

  box-shadow: var(--shadow-sm);
}

.blog-post-card:hover {
  transform: translateY(-6px);

  box-shadow: var(--shadow-md);

  border-color: var(--primary-color);
}

.blog-feed-img {
  width: 100%;
  height: 320px;
  object-fit: cover;
}

.blog-post-content {
  padding: 30px;
}

.blog-category-badge {
  display: inline-flex;

  align-items: center;

  background: rgba(37, 99, 235, 0.1);

  color: var(--primary-color);

  padding: 7px 14px;

  border-radius: 999px;

  font-size: 0.8rem;

  font-weight: 700;

  margin-bottom: 18px;
}

.blog-feed-title {
  font-size: clamp(1.6rem, 3vw, 2rem);

  line-height: 1.25;

  font-weight: 800;

  margin-bottom: 18px;
}

.blog-feed-title a:hover {
  color: var(--primary-color);
}

.blog-feed-excerpt {
  color: var(--text-muted);

  margin-bottom: 25px;

  font-size: 1rem;
}

.blog-feed-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;

  border-top: 1px solid var(--border-color);

  padding-top: 18px;

  color: var(--text-muted);

  font-size: 0.9rem;
}

/* =========================================
   SIDEBAR
========================================= */

.blog-sidebar {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.sidebar-widget {
  background: var(--surface-color);

  border: 1px solid var(--border-color);

  border-radius: var(--radius-md);

  padding: 24px;

  box-shadow: var(--shadow-sm);
}

.widget-title {
  font-size: 1.1rem;

  margin-bottom: 20px;

  font-weight: 800;
}

.trending-list {
  list-style: none;
}

.trending-list li {
  padding-bottom: 18px;
  margin-bottom: 18px;

  border-bottom: 1px solid var(--border-color);
}

.trending-list li:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.trending-list a {
  display: block;

  line-height: 1.5;

  font-weight: 600;
}

.trending-list a:hover {
  color: var(--primary-color);
}

.view-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.topic-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  background: var(--surface-2);

  border: 1px solid var(--border-color);

  padding: 8px 14px;

  border-radius: 999px;

  font-size: 0.85rem;

  transition: var(--transition);
}

.tag:hover {
  background: var(--primary-color);

  color: #fff;
}

/* =========================================
   ARTICLE PAGE
========================================= */

.blog-post-detail {
  max-width: 860px;

  margin: auto;

  padding: 50px 20px 80px;
}

.breadcrumb {
  margin-bottom: 30px;

  color: var(--text-muted);

  font-size: 0.95rem;
}

.article-header {
  text-align: center;

  margin-bottom: 50px;
}

.article-title {
  font-size: clamp(2.4rem, 5vw, 4rem);

  line-height: 1.1;

  letter-spacing: -2px;

  font-weight: 900;

  margin: 20px 0;
}

.article-meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;

  color: var(--text-muted);

  font-size: 0.95rem;
}

.article-featured-img {
  width: 100%;

  border-radius: var(--radius-lg);

  margin-bottom: 50px;

  box-shadow: var(--shadow-md);
}

.article-body {
  font-size: 1.12rem;
}

.article-body p {
  margin-bottom: 24px;
}

.article-body h2 {
  font-size: 2rem;

  margin: 50px 0 20px;

  line-height: 1.2;

  font-weight: 800;
}

.article-body h3 {
  font-size: 1.5rem;

  margin: 35px 0 16px;
}

.article-body ul,
.article-body ol {
  margin: 20px 0 25px 20px;
}

.article-body li {
  margin-bottom: 10px;
}

.article-body blockquote {
  background: var(--surface-color);

  border-left: 5px solid var(--primary-color);

  padding: 25px;

  margin: 40px 0;

  border-radius: var(--radius-sm);

  color: var(--text-muted);

  font-style: italic;
}

.article-body pre {
  position: relative;
  background: #0f172a;
  color: #e2e8f0;
  padding: 24px;
  border-radius: 18px;
  overflow-x: auto;
  margin: 35px 0;
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* Remove weird blue inline backgrounds */
.article-body pre code,
.article-body pre code span {
  background: transparent !important;
  color: inherit !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* Inline code only */
.article-body p code,
.article-body li code {
  background: rgba(37, 99, 235, 0.12);
  color: #60a5fa;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.9em;
}

.article-body code {
  background: rgba(37, 99, 235, 0.1);

  color: var(--primary-color);

  padding: 3px 7px;

  border-radius: 6px;
}

/* =========================================
   FOOTER
========================================= */

footer {
  text-align: center;

  padding: 40px 20px;

  border-top: 1px solid var(--border-color);

  background: var(--surface-color);

  color: var(--text-muted);
}

/* =========================================
   BUTTONS
========================================= */

.btn-paginate,
.btn-back,
button,
.btn {
  display: inline-flex;

  align-items: center;
  justify-content: center;

  gap: 10px;

  padding: 12px 22px;

  border-radius: 12px;

  border: none;

  background: var(--primary-color);

  color: white;

  font-weight: 700;

  cursor: pointer;

  transition: var(--transition);
}

.btn-paginate:hover,
.btn-back:hover,
button:hover,
.btn:hover {
  transform: translateY(-2px);

  background: var(--primary-hover);
}

/* =========================================
   PAGINATION
========================================= */

.blog-pagination {
  display: flex;
  justify-content: space-between;
  gap: 20px;

  margin-top: 50px;
}

/* =========================================
   ADMIN PANEL
========================================= */

.admin-container {
  background: var(--surface-color);

  border: 1px solid var(--border-color);

  border-radius: var(--radius-lg);

  padding: 40px;

  margin: 40px auto;

  box-shadow: var(--shadow-sm);
}

.admin-container h1,
.admin-container h2 {
  margin-bottom: 30px;

  font-weight: 800;
}

.admin-container input,
.admin-container textarea,
.admin-container select {
  width: 100%;

  padding: 14px 16px;

  background: var(--surface-2);

  border: 1px solid var(--border-color);

  border-radius: 12px;

  color: var(--text-main);

  font-size: 1rem;

  margin-top: 8px;

  transition: var(--transition);
}

.admin-container textarea {
  min-height: 120px;
  resize: vertical;
}

.admin-container input:focus,
.admin-container textarea:focus,
.admin-container select:focus {
  outline: none;

  border-color: var(--primary-color);

  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.stats-grid {
  display: grid !important;

  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));

  gap: 20px;
}

.stat-card {
  background: linear-gradient(135deg, var(--surface-color), var(--surface-2));

  border: 1px solid var(--border-color);

  border-radius: var(--radius-md);

  padding: 28px;
}

.stat-card h3 {
  color: var(--text-muted);

  margin-bottom: 12px;
}

.stat-card p {
  font-size: 2rem;

  font-weight: 900;
}

/* =========================================
   TABLE
========================================= */

table {
  width: 100%;
  overflow-x: auto;

  border-collapse: collapse;

  background: var(--surface-color);

  border-radius: var(--radius-md);

  overflow: hidden;
}

th,
td {
  padding: 16px;

  border-bottom: 1px solid var(--border-color);

  text-align: left;
}

th {
  background: var(--surface-2);

  color: var(--text-muted);

  font-size: 0.9rem;
}

tr:hover {
  background: rgba(37, 99, 235, 0.04);
}

/* =========================================
   MOBILE RESPONSIVE
========================================= */

@media (max-width: 1024px) {
  .blog-container {
    grid-template-columns: 1fr;
  }

  .blog-sidebar {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .desktop-nav {
    display: none;
  }

  .main-header {
    padding: 16px;
  }

  .blog-feed-img {
    height: 240px;
  }

  .blog-post-content {
    padding: 22px;
  }

  .article-title {
    font-size: 2.3rem;
  }

  .article-body {
    font-size: 1.02rem;
  }

  .admin-container {
    padding: 24px;
  }

  .blog-pagination {
    flex-direction: column;
  }

  .article-meta {
    flex-direction: column;
    gap: 10px;
  }
}

@media (max-width: 520px) {
  .container {
    padding: 0 14px;
  }

  .blog-intro {
    padding-top: 50px;
  }

  .blog-intro h1 {
    font-size: 2rem;
  }

  .blog-feed-img {
    height: 210px;
  }

  .article-title {
    font-size: 1.9rem;
  }

  .article-body h2 {
    font-size: 1.6rem;
  }

  .admin-container {
    padding: 18px;
  }

  .btn,
  button,
  .btn-back,
  .btn-paginate {
    width: 100%;
  }
}

/* =========================================
   COPY BUTTON
========================================= */

.copy-code-btn {
  position: absolute;

  top: 14px;
  right: 14px;

  background: rgba(255, 255, 255, 0.08);

  border: 1px solid rgba(255, 255, 255, 0.1);

  color: #ffffff;

  padding: 8px 14px;

  border-radius: 10px;

  cursor: pointer;

  font-size: 0.85rem;

  font-weight: 600;

  backdrop-filter: blur(10px);

  transition: all 0.2s ease;
}

.copy-code-btn:hover {
  background: var(--primary-color);

  transform: translateY(-2px);
}
