*{
  margin:0;
  padding:0;
  box-sizing:border-box;
}

body{
  font-family:'Poppins',sans-serif;
  background:#f3f6fb;
  color:#1f2937;
}

/* HEADER */
.blog-header{
  text-align:center;
  padding:60px 20px;
  background:linear-gradient(135deg,#2563eb,#1e3a8a);
  color:white;
}

.blog-header h1{
  font-size:32px;
  margin-bottom:10px;
}

/* SEARCH */
.search-box{
  max-width:500px;
  margin:30px auto 0;
  position:relative;
}

.search-box input{
  width:100%;
  padding:14px 20px;
  border-radius:50px;
  border:none;
  outline:none;
  font-size:14px;
}

.search-box input:focus{
  box-shadow:0 0 0 3px rgba(255,255,255,0.4);
}

/* LAYOUT */
.blog-container{
  max-width:1200px;
  margin:auto;
  padding:40px 20px;
  display:flex;
  gap:40px;
}

.blog-main{
  flex:3;
}

/* CARD */
.blog-card{
  background:white;
  padding:25px;
  margin-bottom:25px;
  border-radius:14px;
  box-shadow:0 8px 25px rgba(0,0,0,0.05);
  transition:0.4s;
  opacity:0;
  transform:translateY(40px);
}

.blog-card.show{
  opacity:1;
  transform:translateY(0);
}

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

.category{
  font-size:12px;
  background:#e0e7ff;
  color:#3730a3;
  padding:5px 12px;
  border-radius:20px;
}

.blog-card h2{
  margin:10px 0;
}

.blog-card a{
  text-decoration:none;
  color:#2563eb;
  font-weight:600;
}

/* SIDEBAR */
.blog-sidebar{
  flex:1;
}

.sidebar-box{
  background:white;
  padding:20px;
  margin-bottom:25px;
  border-radius:14px;
  box-shadow:0 8px 25px rgba(0,0,0,0.05);
}

.sidebar-box ul{
  list-style:none;
}

.sidebar-box ul li{
  margin-bottom:10px;
}

/* PAGINATION */
.pagination{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:30px;
}

.pagination a{
  padding:8px 14px;
  background:white;
  border-radius:8px;
  text-decoration:none;
  color:#1f2937;
  box-shadow:0 3px 10px rgba(0,0,0,0.05);
  transition:0.3s;
}

.pagination a.active,
.pagination a:hover{
  background:#2563eb;
  color:white;
}
.pagination{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:30px;
}

.pagination a{
  padding:8px 14px;
  background:#f3f4f6;
  color:#111827;
  text-decoration:none;
  border-radius:6px;
  transition:all .3s ease;
}

.pagination a:hover{
  background:#636ೀಲ1;
  color:#fff;
}

.pagination a.active{
  background:#6366f1;
  color:#fff;
  font-weight:bold;
}


/* FOOTER */
.footer{
  background:#111827;
  padding:40px 20px;
  text-align:center;
  color:white;
  margin-top:50px;
  font-size:14px;
}

/* RESPONSIVE */
@media(max-width:992px){
  .blog-container{
    flex-direction:column;
  }
}

// SCROLL REVEAL
const cards = document.querySelectorAll(".blog-card");

function reveal(){
  const trigger = window.innerHeight * 0.85;
  cards.forEach(card=>{
    const top = card.getBoundingClientRect().top;
    if(top < trigger){
      card.classList.add("show");
    }
  });
}

window.addEventListener("scroll", reveal);
window.addEventListener("load", reveal);

// SEARCH FILTER
const searchInput = document.getElementById("searchInput");

if(searchInput){
  searchInput.addEventListener("keyup", function(){
    let filter = searchInput.value.toLowerCase();
    cards.forEach(card=>{
      let text = card.innerText.toLowerCase();
      card.style.display = text.includes(filter) ? "block" : "none";
    });
  });
}

// FLOAT BUTTON SHOW ON SCROLL
const scrollBtn = document.getElementById("scrollTop");
const backHomeBtn = document.getElementById("backHome");

function toggleFloatButtons(){
  if(window.scrollY > 200){
    scrollBtn.classList.add("show");
    backHomeBtn.classList.add("show");
  } else {
    scrollBtn.classList.remove("show");
    backHomeBtn.classList.remove("show");
  }
}

window.addEventListener("scroll", toggleFloatButtons);

// SCROLL TO TOP
scrollBtn.addEventListener("click", ()=>{
  window.scrollTo({
    top:0,
    behavior:"smooth"
  });
});

/* FLOAT BUTTON CONTAINER */
.floating-actions{
  position:fixed;
  bottom:25px;
  right:25px;
  display:flex;
  flex-direction:column;
  gap:15px;
  z-index:999;
}

/* GLASS BUTTON */
.float-btn{
  width:55px;
  height:55px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  font-size:20px;
  backdrop-filter:blur(15px);
  background:rgba(255,255,255,0.15);
  border:1px solid rgba(255,255,255,0.3);
  color:#ffffff;
  box-shadow:0 8px 30px rgba(0,0,0,0.2);
  cursor:pointer;
  transition:0.4s;
  transform:translateX(120px);
  opacity:0;
}

/* SHOW STATE */
.float-btn.show{
  transform:translateX(0);
  opacity:1;
}

/* HOVER */
.float-btn:hover{
  background:rgba(37,99,235,0.8);
  transform:translateX(0) scale(1.1);
}

/* Responsive */
@media(max-width:768px){
  .floating-actions{
    bottom:20px;
    right:20px;
  }
}

