/* =========================================
   GLOBAL VARIABLES
========================================= */
:root {
  --max: 900px;
  --accent: #0077ff;

  /* Light Mode */
  --header-bg: #ffffff;
  --body-bg: #f5f5f5;
  --footer-bg: #fafafa;
  --text-color: #111;
  --card-bg: #ffffff;
  --border-color: #e5e5e5;
}

/* Dark Mode */
body.dark-theme {
  --header-bg: #1e1e1e;
  --body-bg: #121212;
  --footer-bg: #1e1e1e;
  --text-color: #f1f1f1;
  --card-bg: #1f1f1f;
  --border-color: #333;
}

/* =========================================
   BASE STYLES
========================================= */
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  line-height: 1.5;
  margin: 0;
  color: var(--text-color);
  background: var(--body-bg);
  overflow-x: hidden;
  transition: background-color 0.4s ease, color 0.4s ease;
  text-align: justify;
}

body > header:not(.site-header) {
    padding-top: 30px;
    margin-top: 0;
}

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem;
}

/* =========================================
   HEADER
========================================= */
.site-header {
  background: var(--header-bg);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  z-index: 100;
  transition: background-color 0.4s ease, color 0.4s ease;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1rem;
}

.profile-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
}

h1 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

h1 a {
  text-decoration: none;
  color: inherit;
}

/* NAVIGATION */
.site-header nav {
  display: flex;
  gap: 1rem;
}

.site-header nav a {
  text-decoration: none;
  color: var(--text-color);
  transition: color 0.3s ease;
}

.site-header nav a:hover {
  color: var(--accent);
}

/* =========================================
   FOOTER
========================================= */
.site-footer {
  background: var(--footer-bg);
  padding: 1rem 0;
  border-top: 1px solid var(--border-color);
  margin-top: 2rem;
  text-align: center;
  transition: background-color 0.4s ease, color 0.4s ease;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.social-icons {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
  gap: 15px;
}

.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #e0e0e0;
  color: #555;
  font-size: 1.2rem;
  text-decoration: none;
  transition: all 0.3s ease;
}

.social-icon:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.linkedin:hover {
  background-color: #0077b5;
  color: white;
}

.github:hover {
  background-color: #333;
  color: white;
}

.researchgate:hover {
  background-color: #00ccbb;
  color: white;
}

.copyright {
  font-size: 0.9rem;
  color: #666;
}

/* =========================================
   HAMBURGER MENU (Responsive)
========================================= */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: 10px;
  z-index: 101;
}

.menu-toggle span {
  display: block;
  height: 3px;
  width: 100%;
  background: var(--text-color);
  border-radius: 2px;
  transition: transform 0.28s ease, opacity 0.2s ease;
}

/* Mobile */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
  }

  .mobile-header-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
  }

  .menu-toggle {
    display: flex;
    order: 0;
  }

  .site-title {
    order: 1;
  }

  .nav-links {
    position: fixed;
    top: 0;
    left: -100%;
    width: 70%;
    max-width: 300px;
    height: 100vh;
    background: var(--header-bg);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    padding: 80px 20px 20px;
    transition: left 0.3s ease;
    z-index: 99;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .nav-links.active { left: 0; }

  .nav-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 98;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .nav-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  .nav-links a {
    display: block;
    padding: 12px 0;
    text-decoration: none;
    color: var(--text-color);
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border-color);
  }

  .profile-img {
    width: 32px;
    height: 32px;
  }
}

/* Hamburger Animation */
.menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translateY(7px); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translateY(-7px); }

/* =========================================
   BLOG HOMEPAGE STYLES
========================================= */
.filter-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.5rem 2rem;
  max-width: 1000px;
  margin: 0 auto;
}

.filter-bar input,
.filter-bar select {
  padding: 0.6rem 1rem;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-color);
  outline: none;
  transition: border 0.3s ease;
}

.filter-bar input:focus,
.filter-bar select:focus {
  border-color: var(--accent);
}

.blog-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  padding: 2rem;
  max-width: 1200px;
  margin: auto;
}

.blog-card {
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, background 0.3s ease;
}

.blog-card:hover {
  transform: translateY(-6px);
}

.blog-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.blog-content {
  padding: 1rem;
}

.blog-content h3 {
  margin: 0;
  font-size: 1.2rem;
}

.blog-content .date {
  color: gray;
  font-size: 0.9rem;
  margin: 0.4rem 0;
}

.blog-content p {
  font-size: 0.95rem;
  line-height: 1.5;
}

.tags {
  margin-top: 0.5rem;
}

.tags span {
  background: none;
  color: inherit;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  margin-right: 0.3rem;
}

.read-more {
  display: inline-block;
  margin-top: 0.8rem;
  color: #dc2626; /* Red for light theme */
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

/* Dark theme version */
body.dark-theme .read-more {
  color: #ef4444; /* Brighter red for dark theme */
}

.read-more:hover {
  color: #b91c1c;
  text-decoration: underline;
}

body.dark-theme .read-more:hover {
  color: #f87171; /* Lighter red for dark theme hover */
}

/* PAGINATION */
.pagination {
  text-align: center;
  padding: 2rem 0;
}

.pagination a {
  margin: 0 0.4rem;
  padding: 0.5rem 0.9rem;
  border-style: solid;
  border-width: 2px;
  border-color: inherit;
  border-radius: 50%;
  text-decoration: none;
  color: inherit;
  transition: 0.3s;
}

.pagination a.active,
.pagination a:hover {
  background: none;
  color: inherit;
}

/* =========================================
   THEME TOGGLE (Moon/Sun)
========================================= */
.theme-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--header-bg);
  border: none;
  border-radius: 50%;
  padding: 0.8rem;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text-color);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
  transition: background 0.3s ease, transform 0.3s ease, color 0.3s ease;
  z-index: 999;
}

.theme-toggle:hover {
  transform: scale(1.1);
}

/* ===== SEARCH INPUT WITH ICON ===== */
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 400px;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: #666;
  z-index: 1;
  font-size: 1rem;
}

.filter-bar input {
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-color);
  outline: none;
  transition: border 0.3s ease;
  width: 100%;
}

.filter-bar input:focus {
  border-color: var(--accent);
}

/* Dark theme support */
body.dark-theme .search-icon {
  color: #aaa;
}

.filter-bar input:focus + .search-icon {
  color: var(--accent);
}