/* =========================================================
   BLOG DETAILS (blog-details.css)
   ---------------------------------------------------------
   Purpose:
   - Styles ONLY the blog-details.html layout (articles + sidebar + share + tags)
   - Includes chat widget styling (scoped so it won't affect global buttons)
   ---------------------------------------------------------
   IMPORTANT:
   - This file DOES NOT override your global button system in style.css
   - Keep using your main CTA buttons like:
     <a class="btn btn-main hero-btn">Request a Free Quote</a>
   - If you want a different btn-main size ONLY on blog page, do it like:
     .blog-container .btn.btn-main { ... }
   ========================================================= */


/* =========================================================
   1) BASE STYLES
   (page background, typography, container)
   =========================================================
   Notes:
   - Creates a clean white reading area on a light gray background.
   - Keeps paragraph sizing readable for long-form blog content.
   ========================================================= */
body {
  line-height: 1.5;
  margin: 0;
  padding: 0;
  background-color: #f7f7f7;
}

.blog-container {
  max-width: 1500px;
  margin: auto;
  padding: 30px;
  background: #fff;
}

/* Blog paragraphs only */
.blog-container p {
  font-size: 1.3rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  color: #444;
}

/* Lead paragraph */
.blog-container .lead {
  font-size: 1.7rem;
  line-height: 1.4;
  margin-bottom: 1.25rem;
  color: #777;
}


/* =========================================================
   2) PRELOADER
   (non-blocking overlay)
   =========================================================
   Notes:
   - pointer-events: none prevents overlay from blocking clicks.
   - .hidden is added by JS on window load.
   ========================================================= */
.preloader {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;

  /* Prevents preloader from blocking clicks if it doesn't hide */
  pointer-events: none;
}

.preloader.hidden {
  display: none !important;
}


/* =========================================================
   3) FEATURED IMAGE
   (blog header images)
   =========================================================
   Notes:
   - Centers images with max-width for readability.
   - Removes unwanted masks/filters/shadows from other styles.
   ========================================================= */
.blog-featured-image {
  margin-bottom: 25px;
  border-radius: 0;
  overflow: visible;
  box-shadow: none !important;
  background: transparent;
  position: relative;
}

.blog-featured-image img {
  width: 100%;
  max-width: 900px;
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
  transition: transform 0.35s ease;

  box-shadow: none !important;
  filter: none !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;

  border-radius: 10px;
}

/* Subtle radial overlay (optional polish) */
.blog-featured-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle,
    rgba(236, 233, 233, 0) 70%,
    rgba(255, 255, 255, 0.3)
  );
  pointer-events: none;
  box-shadow: none !important;
}

.blog-featured-image img:hover {
  transform: scale(1.02);
}

/* Optional glow effect ONLY inside blog main images */
.blog-main .img-fluid {
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.6);
  transition: all 0.3s ease-in-out;
}


/* =========================================================
   4) BACK LINK
   (Back to Blog)
   =========================================================
   Notes:
   - Lightweight, accessible link styling.
   ========================================================= */
.back-link {
  margin-bottom: 20px;
  font-size: 1.1rem;
}

.back-link a {
  color: #3f77f0;
  text-decoration: none;
  font-weight: 500;
}

.back-link a:hover {
  text-decoration: underline;
}


/* =========================================================
   5) BLOG MAIN
   (article layout + headings)
   =========================================================
   Notes:
   - scroll-margin-top aligns anchor jumps with sticky navbar.
   - Keep this on .blog-main (article wrapper) so section links land nicely.
   ========================================================= */
.blog-main {
  padding-right: 0;
  background: none;
  border: none;
  box-shadow: none;

  /* Anchor offset for sticky navbar */
  scroll-margin-top: 110px;
}

.blog-title {
  font-size: 2.2em;
  margin-bottom: 10px;
  color: #3e5774;
  font-weight: 500;
}

.blog-meta {
  color: #646464;
  font-size: 1.2rem;
  margin-bottom: 20px;
}

/* Blog content headings */
.blog-body h2,
.blog-body h3 {
  margin-top: 20px;
  color: #333;
  font-size: 1.4rem;
  font-weight: 500;
}

/* Lists in blog body */
.blog-body ul {
  padding-left: 20px;
  font-size: 1.1rem;
}

/* Tip heading helper (your HTML uses .tip-heading) */
.tip-heading {
  margin-top: 20px;
  color: #333;
  font-size: 1.4rem;
  font-weight: 600;
}


/* =========================================================
   6) SECTION DIVIDER
   (between articles)
   =========================================================
   Notes:
   - Orange bar line + centered label.
   ========================================================= */
.section-divider {
  text-align: center;
  margin: 60px 0;
  position: relative;
}

.section-divider::before {
  content: "";
  display: block;
  height: 3px;
  background: #f9a743;
  width: 100%;
  position: absolute;
  top: 50%;
  z-index: 0;
}

/* Supports both: span and .section-divider-text */
.section-divider span,
.section-divider .section-divider-text {
  background: #fff;
  padding: 0 20px;
  color: #333;
  font-weight: 600;
  position: relative;
  z-index: 1;
  font-size: 20px;
}


/* =========================================================
   7) TAGS
   (post tags list)
   =========================================================
   Notes:
   - Uses flex-wrap so tags never overflow.
   - Your HTML uses: <ul class="content"> ... </ul>
   ========================================================= */
.blog-tags {
  margin-top: 30px;
  border-top: 1px solid #ddd;
  padding-top: 10px;
  font-size: 1.3rem;
}

/* Works for both .content and normal UL */
.blog-tags ul,
.blog-tags ul.content {
  list-style: none;
  padding: 0;
  margin: 0;

  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.blog-tags a {
  text-decoration: none;
  color: #007bff;
  background-color: #e7f1ff;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 0.9em;
  display: inline-block;
}

.blog-tags a:hover {
  background-color: #d0e5ff;
}


/* =========================================================
   8) BLOG-ONLY BUTTON (legacy)
   =========================================================
   IMPORTANT:
   - This does NOT affect your global buttons (.btn / .btn-main / .hero-btn).
   - Prefer using: <a class="btn btn-main hero-btn"> ... </a>
   - Keep .blog-btn only if older blog CTAs still exist.
   ========================================================= */
.blog-btn {
  color: #fff;
  border-radius: 30px;
  font-size: 15px;
  font-weight: 600;
  padding: 10px 20px;
  display: inline-block;
  background-color: #f9a743;
  box-shadow: 0 15px 40px rgba(249, 167, 68, 0.5);
}


/* =========================================================
   9) SIDEBAR
   (sticky section navigation + cards)
   =========================================================
   Notes:
   - Sticky on desktop, normal flow on mobile.
   ========================================================= */
.blog-sidebar {
  position: sticky;
  top: 100px;
  padding-left: 0;
}

.sidebar-card {
  background: #fff;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.04);
  margin-bottom: 18px;
}

.sidebar-title {
  font-weight: 700;
  margin-bottom: 12px;
  font-size: 1.05rem;
  color: #1f2a37;
}

.sidebar-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-links li + li {
  margin-top: 10px;
}

.sidebar-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #1f2a37;
  padding: 8px 10px;
  border-radius: 10px;
  transition: 0.2s ease;
}

.sidebar-links a:hover {
  background: rgba(13, 110, 253, 0.08);
  color: #0d6efd;
}

.sidebar-links i {
  color: #6c757d;
}

.sidebar-links a:hover i {
  color: #0d6efd;
}

.sidebar-cta p {
  color: #6c757d;
}

/* Sidebar responsive */
@media (max-width: 991px) {
  .blog-sidebar {
    position: static;
    top: auto;
    margin-top: 2rem;
  }
}

/* Optional: subtle border between columns (SCOPED to blog only) */
@media (min-width: 992px) {
  .blog-container .col-lg-8 {
    border-right: 1px solid #e0e0e0;
  }
}


/* =========================================================
   10) SMOOTH ANCHOR SCROLL
   =========================================================
   Notes:
   - Smooth scrolling for "On This Page" anchors.
   ========================================================= */
html {
  scroll-behavior: smooth;
}


/* =========================================================
   11) CHAT POPUP (scoped - will NOT affect site buttons)
   =========================================================
   Notes:
   - Everything is scoped to #chat-popup and #chatToggle.
   - This prevents overriding global .btn styles.
   ========================================================= */

/* Toggle button */
#chatToggle.chat-toggle {
  position: fixed;
  right: 18px;
  bottom: 200px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;

  border: none;
  cursor: pointer;

  z-index: 99999;
  pointer-events: auto;

  background: #28a745;
  color: #fff;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#chatToggle.chat-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.22);
}

#chatToggle.chat-toggle:focus-visible {
  outline: 3px solid rgba(40, 167, 69, 0.35);
  outline-offset: 4px;
}

/* Popup container */
#chat-popup.chat-popup {
  position: fixed;
  right: 18px;
  bottom: 90px;

  width: 340px;
  max-width: calc(100vw - 36px);
  height: 440px;

  background: #fff;
  border-radius: 16px;
  overflow: hidden;

  display: none;
  flex-direction: column;

  z-index: 100000;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

#chat-popup.chat-popup.open {
  display: flex;
}

/* Header */
#chat-popup .chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #2c3e50;
  color: #fff;
}

#chat-popup .agent-name {
  font-weight: 700;
  font-size: 0.95rem;
}

/* Close button */
#chat-popup .close-chat {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

/* Body */
#chat-popup .chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #f7f8fa;
}

/* Messages */
#chat-popup .bot-message,
#chat-popup .user-message {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 14px;
  margin: 8px 0;
  font-size: 0.95rem;
  line-height: 1.4;
}

#chat-popup .bot-message {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  color: #2f3b48;
  align-self: flex-start;
}

#chat-popup .user-message {
  background: rgba(40, 167, 69, 0.12);
  border: 1px solid rgba(40, 167, 69, 0.18);
  color: #1f2a20;
  align-self: flex-end;
  margin-left: auto;
}

/* Input area */
#chat-popup .chat-input {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

#chat-popup .chat-input input {
  flex: 1;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.95rem;
  outline: none;
}

#chat-popup .chat-input input:focus {
  border-color: rgba(40, 167, 69, 0.55);
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.18);
}

/* Send button (scoped to chat only) */
#chat-popup .chat-input button {
  border: none;
  background: #28a745;
  color: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

#chat-popup .chat-input button:hover {
  filter: brightness(0.95);
}

/* Small screens */
@media (max-width: 480px) {
  #chat-popup.chat-popup {
    width: calc(100vw - 36px);
    height: 420px;
  }

  /* Scroll To Top Button position adjustment (only if this page uses it) */
  #scrollToTopBtn {
    bottom: 110px;
    right: 14px;
  }
}
