/* ==========================================================================
   BLOG DESIGN TOKENS & BASE STYLES
   ========================================================================== */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #e0e7ff;
  --success: #10b981;
  --warning: #f59e0b;
  --bg-color: #f1f5f9;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --radius: 14px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.08), 0 4px 8px -2px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  padding: 2.5rem 1.5rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.blog-container {
  max-width: 1350px;
  margin: 0 auto;
}

/* ==========================================================================
   HEADER SECTION
   ========================================================================== */
.blog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 2rem 2.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
  border-left: 6px solid var(--primary);
  border: 1px solid var(--border-color);
  gap: 1.5rem;
}

.blog-header h2 {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
}

.blog-header p {
  color: var(--text-muted);
  font-size: 0.975rem;
  margin-top: 0.35rem;
}

.btn-secondary {
  background: var(--primary) !important;
  color: #ffffff !important;
  padding: 0.7rem 1.25rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.925rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none !important;
  white-space: nowrap !important;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-secondary:hover {
  background: var(--primary-dark) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(79, 70, 229, 0.3);
}

/* ==========================================================================
   CONTROL HUB (TABS & SEARCH)
   ========================================================================== */
.control-hub {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 1.15rem 1.75rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
  gap: 1.25rem;
  flex-wrap: wrap;
}

.category-tabs {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.tab-btn {
  background: #f8fafc;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 0.55rem 1.15rem;
  border-radius: 9px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
  border-color: #cbd5e1;
}

.tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 340px;
}

.search-box i {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.95rem;
}

.search-box input {
  width: 100%;
  padding: 0.7rem 1rem 0.7rem 2.75rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 0.925rem;
  outline: none;
  background-color: #fafafa;
  transition: all 0.25s ease;
}

.search-box input:focus {
  border-color: var(--primary);
  background-color: #fff;
  box-shadow: 0 0 0 4px var(--primary-light);
}

/* ==========================================================================
   BLOG GRID & CARDS (WORLD-CLASS TYPOGRAPHY & LAYOUT)
   ========================================================================== */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(390px, 1fr));
  gap: 2rem;
  margin-bottom: 2.5rem;
}

/* OVERRIDE GRID TO FULL WIDTH WHEN A CARD IS EXPANDED */
.blog-grid.single-expanded-view {
  display: block !important;
  width: 100% !important;
}

.blog-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.blog-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: #cbd5e1;
}

/* FULL PAGE EXPANDED CARD OVERRIDES */
.blog-card.expanded-card,
.blog-grid.single-expanded-view .blog-card {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  transform: none !important;
  box-shadow: var(--shadow-lg) !important;
  border-color: var(--primary) !important;
  background: #ffffff;
  border-width: 2px;
}

.blog-card-header {
  padding: 1.75rem 1.75rem 1rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.blog-badge {
  padding: 0.3rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 7px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-practical { background: #dbeafe; color: #1d4ed8; }
.badge-theory { background: #fef3c7; color: #b45309; }
.badge-datasets { background: #d1fae5; color: #047857; }
.badge-general { background: #f3e8ff; color: #7e22ce; }

.blog-date {
  font-size: 0.825rem;
  color: var(--text-muted);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.blog-card-body {
  padding: 0 1.75rem 1.75rem 1.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* WORLD-CLASS CARD TITLE DESIGN */
.blog-card-body h3 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary); /* Elite primary accent color */
  margin-bottom: 0.85rem;
  line-height: 1.35;
  letter-spacing: -0.03em;
  transition: color 0.2s ease;
}

.blog-card:hover .blog-card-body h3 {
  color: var(--primary-dark);
}

/* FULL-PAGE EXPANDED TITLE STYLE */
.blog-grid.single-expanded-view .blog-card h3 {
  font-size: 2.2rem !important;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 1.5rem;
  letter-spacing: -0.035em;
  color: var(--text-main);
  border-bottom: 3px solid var(--primary-light);
  padding-bottom: 1rem;
}

.blog-card-body p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  flex: 1;
  line-height: 1.65;
}

.blog-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.blog-author {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
}

.read-more-btn {
  background: transparent;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.read-more-btn:hover {
  color: var(--primary-dark);
  gap: 0.65rem; /* Subtle micro-interaction shift */
}

/* ==========================================================================
   PAGINATION FOOTER
   ========================================================================== */
.blog-pagination-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 1.35rem 2.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.btn-page {
  background: #f8fafc;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.65rem 1.35rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-page:hover:not(:disabled) {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.btn-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-indicator {
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--text-muted);
}

.no-posts {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3.5rem;
  color: var(--text-muted);
  font-size: 1.05rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 768px) {
  body {
    padding: 1rem 0.75rem;
  }
  .blog-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem;
  }
  .control-hub {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
  }
  .search-box {
    max-width: 100%;
  }
  .blog-grid {
    grid-template-columns: 1fr;
  }
  .blog-pagination-footer {
    padding: 1rem 1.25rem;
    flex-direction: column;
    gap: 1rem;
  }
}
