/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Roboto', 'Segoe UI', sans-serif;
}

body {
  background-color: #f9fbfd;
  line-height: 1.6;
  color: #333;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: #2F586A;
  transition: color 0.3s ease;
}

a:hover {
  color: #1a3a49;
}

/* Improved Header Styles */
#header {
  background-color: #2F586A;
  background-image: linear-gradient(135deg, #2F586A, #1a3a49);
  padding: 3% 3%;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}

/* Logo and Company Name */
#header-logo-name {
  display: flex;
  align-items: center;
  transition: transform 0.3s ease;
}

#header-logo-name:hover {
  transform: translateY(-2px);
}

#logo {
  height: 50px;
  width: 50px;
  border-radius: 12px;
  object-fit: cover;
  /* box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2); */
}

#company-name {
  font-size: 1.5rem;
  color: white;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin: 0 1rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Search Section - Enhanced */
#header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

#search-post-div {
  position: relative;
  transition: width 0.3s ease;
}

#search-post {
  height: 40px;
  width: clamp(200px, 25vw, 300px);
  border: none;
  border-radius: 20px;
  padding: 0 1rem 0 2.8rem;
  background-image: url('../img/search_icon.png');
  background-size: 16px 16px;
  background-repeat: no-repeat;
  background-position: 15px center;
  font-size: 0.9rem;
  color: #2F586A;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#search-post:focus {
  outline: none;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  width: clamp(220px, 30vw, 350px);
}

#search-post::placeholder {
  color: #8aa5b1;
  font-size: 0.85rem;
}

/* FIXED: Search Results - Width matches search bar width */
#searchResultDiv {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  background-color: white;
  width: 100%; /* Match parent width */
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
  display: none; /* Change to display none/block for more reliable showing/hiding */
}

/* Show the search results when input is focused */
#search-post:focus ~ #searchResultDiv,
#searchResultDiv:hover {
  display: block;
}

.postSearchDiv {
  padding: 0.8rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
}

.postSearchDiv:hover {
  background-color: #f5f9fc;
}

.postSearchDiv:active {
  background-color: #e1ecf4;
}

/* Navigation Buttons */
#home-about-div {
  display: flex;
  gap: 0.8rem;
}

#home-btn, #about-btn {
  background-color: rgba(255, 255, 255, 0.12);
  color: white;
  border: none;
  padding: 0.5rem 1.2rem;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

#home-btn:hover, #about-btn:hover {
  background-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

#home-btn:after, #about-btn:after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: white;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

#home-btn:hover:after, #about-btn:hover:after {
  transform: scaleX(1);
}

/* Login/Signup Section - Enhanced */
#login-signup {
  display: flex;
  display: none;
  align-items: center;
  gap: 0.8rem;
}

.btn {
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#login-btn {
  background-color: transparent;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.7);
  position: relative;
  overflow: hidden;
}

#login-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  border-color: white;
}

#signup-btn {
  background-color: white;
  color: #2F586A;
  border: none;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
}

#signup-btn:hover {
  background-color: #f0f0f0;
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.2);
}

/* Main Content Area */
#belowHeader {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Post Content */
#full-post {
  flex: 1 1 70%;
  min-width: 300px;
  margin: 0 1rem 2rem 0;
  overflow-wrap: break-word;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  order: 1;
}

/* Related Posts and Sidebar */
#RelatedPost-Category-div {
  flex: 1 1 25%;
  min-width: 250px;
  margin: 0 0 2rem 1rem;
  order: 2;
}

#full-post:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

#post-full-heading-sub-div {
  display: flex;
  padding: 1.5rem;
  border-bottom: 1px solid #f0f0f0;
}

#post-full-heading-div {
  position: relative;
  flex: 1;
  padding: 1rem;
}

#categoryDate-div {
  position: absolute;
  right: 0;
  top: 0;
  display: flex;
  padding: 1rem;
}

.categoryDate-class {
  margin: 0 0.5rem;
  font-size: 0.85rem;
  color: #666;
}

#category-date-separator {
  border-left: 1.5px solid #ddd;
  margin: 0 0.5rem;
}

#post-heading-div {
  padding: 0 1.5rem;
}

#post-thumbnail {
  width: 175px;
  height: auto;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

#post-thumbnail:hover {
  transform: scale(1.03);
}

#post-heading {
  color: #2F586A;
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 0.5rem;
  line-height: 1.2;
  font-weight: 700;
}

#post-subheading {
  color: #5a7d8f;
  font-size: clamp(1rem, 2vw, 1.2rem);
  margin-bottom: 1rem;
  font-weight: 400;
}

#post-content-div {
  line-height: 1.8;
}

#post-content-div figure{
  display: block;
  object-fit: contain;
  margin: auto;
}

#post-content-div figure, figcaption, img{
  width: 50%;
  max-width: 100%;
  height: auto;
  display: block;
  text-align: center;
  margin: auto;
}

/* FAQ Section */
#faq-div-heading {
  font-weight: 700;
  color: #2F586A;
  font-size: 1.2rem;
  margin: 1.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #2F586A;
  width: fit-content;
}

#remaining-post-after-heading {
  padding: 0 1.5rem;
}

#faq-div {
  padding: 1rem 0;
}

.faqCards {
  border: 1px solid #e0e0e0;
  margin-top: 1rem;
  border-radius: 8px;
  padding: 1.2rem;
  transition: all 0.3s ease;
  background-color: #fafafa;
  cursor: pointer;
}

.faqCards:hover {
  border-color: #2F586A;
  box-shadow: 0 4px 12px rgba(47, 88, 106, 0.1);
  transform: translateY(-2px);
}

.cardTitle {
  font-weight: 600;
  color: #2F586A;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cardTitle::after {
  content: '+';
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}

.faqCards.active .cardTitle::after {
  transform: rotate(45deg);
}

.card {
  display: none;
  padding-top: 1rem;
  color: #555;
  line-height: 1.6;
}

.faqCards.active .card {
  display: block;
  animation: fadeIn 0.5s ease;
}

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

/* Category Display */
#category-display-heading {
  font-weight: 700;
  color: #2F586A;
  font-size: 1.2rem;
  margin: 1.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #2F586A;
  width: fit-content;
}

#category-display-contents {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.categoryCardsDiv {
  border: 1px solid #d9e2e7;
  padding: 0.6rem 1rem;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: #f5f9fc;
  font-size: 0.9rem;
}

.categoryCardsDiv:hover {
  background-color: #2F586A;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(47, 88, 106, 0.15);
}

/* Related Posts */
#Related-post-heading {
  font-weight: 700;
  color: #2F586A;
  font-size: 1.2rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #2F586A;
  width: fit-content;
}

.relatedPostCardsDiv {
  padding: 0;
  margin-bottom: 1.5rem;
}

.relatedPostCards {
  display: flex;
  background-color: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.relatedPostCards:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.relatedPostCardImages {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 0.5rem;
  margin: auto 0;
}

.relatedPostCardDetails {
  padding: 0.8rem;
  flex: 1;
}

.relatedPostCardTitle {
  font-weight: 600;
  font-size: 0.95rem;
  color: #2F586A;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.relatedPostCardCategory {
  font-size: 0.8rem;
  color: #666;
  background-color: #f5f9fc;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  display: inline-block;
}

.relatedPostDate {
  font-size: 0.75rem;
  color: #888;
  text-align: right;
  margin-top: 0.5rem;
}

.cardBottomBorder {
  border-bottom: 1px solid #eee;
  width: 100%;
  margin: 1rem 0;
}

/* Footer Styles */
#footer-div {
  background-color: #2F586A;
  background-image: linear-gradient(to right, #2F586A, #1a3a49);
  padding: 3rem 5%;
  color: white;
}

#footer-companyDetail-div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

#footer-companyDetail-sub-div1 {
  flex: 1 1 60%;
  min-width: 300px;
}

#footer-Cname-logo {
  display: flex;
  width: fit-content;
  align-items: center;
  margin-bottom: 1.5rem;
}

#footer-logo-img {
  height: 50px;
  width: 50px;
  border-radius: 15px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#footer-companyName-div {
  color: white;
  padding-left: 1rem;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

#company-description {
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.7;
  font-size: 0.95rem;
}

#footer-companyDetail-sub-div2 {
  flex: 1 1 30%;
  min-width: 200px;
}

#follow-us {
  color: white;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

#footer-connections {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

#facebook-logo,
#instagram-logo,
#twitter-logo,
#mail-logo {
  height: 40px;
  width: 40px;
  border-radius: 50%;
  transition: transform 0.3s ease;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 5px;
  object-fit: contain;
}

#facebook-logo:hover,
#instagram-logo:hover,
#twitter-logo:hover,
#mail-logo:hover {
  transform: translateY(-3px) scale(1.1);
  background-color: rgba(255, 255, 255, 0.2);
}

#company-copyrights-sub-div {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.terms-policy-disclaimer {
  color: rgba(255, 255, 255, 0.8);
  transition: color 0.2s ease;
}

.terms-policy-disclaimer:hover {
  color: white;
  text-decoration: underline;
}

#all-rights-reserved {
  color: white;
  text-align: center;
  font-weight: 500;
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* Responsive Design - Enhanced for Mobile */
@media (max-width: 900px) {
  #belowHeader {
    flex-direction: column;
  }
  
  #full-post {
    width: 100%;
    margin: 0 0 2rem 0;
    order: 1;
  }
  
  #RelatedPost-Category-div {
    width: 100%;
    margin: 0 0 2rem 0;
    order: 3;
  }
  
  #faq-mobile-container {
    width: 100%;
    margin: 0 0 2rem 0;
    order: 2;
    display: block;
  }
  
  #post-full-heading-sub-div {
    flex-direction: column;
  }
  
  #post-thumbnail {
    width: 100%;
    max-width: 300px;
    margin-bottom: 1rem;
  }
  
  #categoryDate-div {
    position: static;
    justify-content: flex-start;
    padding: 1rem 0;
  }
}

/* Tablet and Mobile - Small Devices */
@media (max-width: 768px) {
  #header {
    padding: 0 4%;
    height: 60px;
  }
  
  #logo {
    height: 45px;
    width: 45px;
  }
  
  #company-name {
    font-size: 1.1rem;
    margin-left: 0.6rem;
    display: none;
  }
  
  /* FIXED SEARCH FUNCTIONALITY FOR MOBILE */
  #search-post-div {
    position: static;
    margin-right: 5px;
  }
  
  #search-post {
    width: 40px;
    height: 40px;
    padding: 0;
    background-position: center;
    font-size: 0;
    border-radius: 50%;
  }
  
  /* When search is clicked, convert to bigger input */
  #search-post:focus {
    width: 200px;
    border-radius: 20px;
    font-size: 0.9rem;
    padding: 0 1rem 0 2.8rem;
    background-position: 15px center;
  }
  
  /* Search results on mobile - shown when search is active */
  #searchResultDiv {
    position: fixed;
    top: 60px; /* Header height */
    left: 0;
    width: 100%;
    max-width: 100%;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    border-radius: 0 0 10px 10px;
    max-height: 60vh; /* Limit height on mobile */
    z-index: 1005;
  }
  
  /* Focus will show the result div, not hover on mobile */
  #search-post:focus ~ #searchResultDiv {
    display: block;
  }
  
  /* Hide placeholder text when not focused */
  #search-post::placeholder {
    color: transparent;
  }
  
  /* Show placeholder when focused/expanded */
  #search-post:focus::placeholder {
    color: #8aa5b1;
  }
  
  #login-signup {
    display: none;
  }
  
  #home-about-div {
    gap: 0.5rem;
  }

  #home-btn, #about-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }

  #post-content-div figure, figcaption, img{
    width: 100%;
  }
  
  .nav-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }
  
  #footer-companyDetail-div {
    flex-direction: column;
  }
  
  #footer-companyDetail-sub-div1, 
  #footer-companyDetail-sub-div2 {
    width: 100%;
  }
}

/* Extra Small Devices */
@media (max-width: 480px) {
  #header {
    padding: 0 3%;
  }
  
  #header-right {
    gap: 0.3rem;
  }
  
  #home-about-div {
    gap: 0.3rem;
  }

  #home-btn, #about-btn {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
  }
  
  .nav-btn {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
  }
  
  #company-name {
    font-size: 0.9rem;
    display: none;
  }
  
  #search-post:focus {
    width: 160px; /* Smaller for very small screens */
  }
  
  /* Make sure items are properly spaced */
  #full-post, #RelatedPost-Category-div {
    margin: 0 0 1.5rem 0;
    padding: 0.5rem;
  }
  
  #post-full-heading-sub-div {
    padding: 1rem;
  }
  
  #post-heading {
    font-size: 1.3rem;
  }
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #2F586A;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #1a3a49;
}

/* JavaScript will add this class when a search item is clicked */
.search-item-clicked {
  display: block !important;
}
