/* Help Center Frontend Styling */

/* Sticky Sidebar */
.sticky-sidebar {
  transition: all 0.3s ease;
}

/* Sidebar Navigation */
.side-control {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 20px;
}

.side-control .accordion-item {
  border: none;
  background: transparent;
}

.side-control .accordion-button {
  background: transparent;
  border: none;
  padding: 15px 10px;
  font-weight: 600;
  color: #323232;
  transition: all 0.3s;
}

.side-control .accordion-button:not(.collapsed) {
  background: #fff5f5;
  color: #e00000;
  border-radius: 8px;
}

.side-control .accordion-button:hover {
  background: #f9f9f9;
  border-radius: 8px;
}

.side-control .accordion-button .icon-side {
  margin-right: 12px;
  display: flex;
  align-items: center;
  width: 48px;
  height: 48px;
  background: linear-gradient(
      0deg,
      rgba(199, 199, 199, 0.08),
      rgba(199, 199, 199, 0.08)
    ),
    #fdfdfd;
  border-radius: 52px;
  justify-content: center;
  transition: all 0.3s ease;
}

/* ================================================
   WHITE FILTER FOR ACTIVE ICON - WORKING VERSION
   ================================================ */

/* Change icon-side background to red when active */
.side-control .accordion-button:not(.collapsed) .icon-side {
  background: rgb(var(--color-red)) !important;
  box-shadow: 0 4px 12px rgba(224, 0, 0, 0.3);
}

/* Make the icon image white using filter */
.side-control .accordion-button:not(.collapsed) .icon-side img {
  filter: brightness(0) invert(1);
  -webkit-filter: brightness(0) invert(1);
}

/* Also handle SVG if icon is SVG */
.side-control .accordion-button:not(.collapsed) .icon-side svg {
  fill: #ffffff !important;
}

/* Smooth transition for filter */
.side-control .icon-side img,
.side-control .icon-side svg {
  transition: filter 0.3s ease, fill 0.3s ease;
}

/* ================================================ */

.side-control .accordion-button::after {
  margin-left: auto;
}

.side-control .link-body {
  display: block;
  padding: 10px 15px;
  margin: 5px 0;
  color: #666;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.3s;
}

.side-control .link-body:hover {
  background: #f0f0f0;
  color: #e00000;
  padding-left: 20px;
}

.side-control .link-body.active {
  background: #e00000;
  color: #fff;
  font-weight: 600;
}

.side-control .submenu-link.active {
  background: #e00000;
  color: #fff;
}

/* Content Area */
#help-category-content {
  min-height: 400px;
}

/* Breadcrumbs */
.breadcrumb {
  background: transparent;
  padding: 0;
  margin-bottom: 20px;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "›";
  color: #999;
  padding: 0 8px;
}

.breadcrumb-item a {
  color: #666;
  text-decoration: none;
}

.breadcrumb-item a:hover {
  color: #e00000;
  text-decoration: underline;
}

.breadcrumb-item.active {
  color: #323232;
  font-weight: 600;
}

/* Author Info */
.info-bd {
  flex: 1;
}

.logo-red img {
  border-radius: 50%;
  border: 2px solid #e00000;
}

/* Help Item Links */
.help-item-link {
  position: relative;
  padding-left: 20px;
  transition: all 0.3s;
}

.help-item-link::before {
  content: "→";
  position: absolute;
  left: 0;
  opacity: 0;
  transition: all 0.3s;
}

.help-item-link:hover {
  padding-left: 25px;
  text-decoration: underline;
}

.help-item-link:hover::before {
  opacity: 1;
}

/* Content Sections */
.content-section h4 {
  position: relative;
  padding-bottom: 10px;
}

.content-section h4::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50px;
  height: 3px;
  background: #e00000;
}

/* Search Dropdown (for future implementation) */
.search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: none;
}

.search-results-dropdown.show {
  display: block;
}

.search-result-item {
  padding: 15px 20px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: all 0.3s;
}

.search-result-item:hover {
  background: #f9f9f9;
}

.search-result-type {
  display: inline-block;
  padding: 2px 8px;
  background: #e00000;
  color: #fff;
  font-size: 11px;
  border-radius: 3px;
  margin-right: 8px;
}

/* Loading State */
.spinner-border {
  width: 3rem;
  height: 3rem;
}

/* Featured Image */
.article-featured-image {
  overflow: hidden;
  border-radius: 12px;
  margin-bottom: 30px;
}

.article-featured-image img {
  width: 100%;
  height: auto;
}

/* Content Typography */
.faq-content,
.article-content {
  font-size: 16px;
  line-height: 1.8;
  color: #323232;
}

.faq-content h2,
.faq-content h3,
.faq-content h4,
.article-content h2,
.article-content h3,
.article-content h4 {
  margin-top: 30px;
  margin-bottom: 15px;
  color: #1a1a1a;
}

.faq-content ul,
.faq-content ol,
.article-content ul,
.article-content ol {
  margin-left: 25px;
  margin-bottom: 20px;
}

.faq-content li,
.article-content li {
  margin-bottom: 10px;
}

.faq-content img,
.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 20px 0;
}

/* Responsive */
@media (max-width: 991px) {
  .sticky-sidebar {
    position: relative !important;
    top: 0 !important;
    margin-bottom: 30px;
  }

  .side-control {
    margin-bottom: 30px;
  }
}

@media (max-width: 768px) {
  .info-bd {
    margin-left: 0;
    margin-top: 10px;
  }

  .d-flex.gap-3.align-items-center.my-4 {
    flex-direction: column;
    align-items: flex-start !important;
  }
}

/* ========================================
   CONTENT STYLING FIXES - HIGHER SPECIFICITY
   ======================================== */

/* Fix UL bullet points - FORCE DISPLAY */
#help-category-content .faq-content ul,
#help-category-content .article-content ul,
#help-category-content .category-description ul,
div.faq-content ul,
div.article-content ul,
div.category-description ul {
  list-style-type: disc !important;
  list-style-position: outside !important;
  padding-left: 40px !important;
  margin-left: 0 !important;
  display: block !important;
}

#help-category-content .faq-content ul li,
#help-category-content .article-content ul li,
#help-category-content .category-description ul li,
div.faq-content ul li,
div.article-content ul li,
div.category-description ul li {
  list-style-type: disc !important;
  display: list-item !important;
  margin-bottom: 10px;
  line-height: 1.8;
}

/* Nested UL styles */
#help-category-content .faq-content ul ul,
#help-category-content .article-content ul ul,
#help-category-content .category-description ul ul,
div.faq-content ul ul,
div.article-content ul ul,
div.category-description ul ul {
  list-style-type: circle !important;
  padding-left: 30px !important;
}

#help-category-content .faq-content ul ul ul,
#help-category-content .article-content ul ul ul,
#help-category-content .category-description ul ul ul,
div.faq-content ul ul ul,
div.article-content ul ul ul,
div.category-description ul ul ul {
  list-style-type: square !important;
}

/* OL stays correct */
#help-category-content .faq-content ol,
#help-category-content .article-content ol,
#help-category-content .category-description ol,
div.faq-content ol,
div.article-content ol,
div.category-description ol {
  list-style-type: decimal !important;
  list-style-position: outside !important;
  padding-left: 40px !important;
  margin-left: 0 !important;
}

#help-category-content .faq-content ol li,
#help-category-content .article-content ol li,
#help-category-content .category-description ol li,
div.faq-content ol li,
div.article-content ol li,
div.category-description ol li {
  display: list-item !important;
  margin-bottom: 10px;
  line-height: 1.8;
}

/* ========================================
   LINK STYLING - RED COLOR (HIGHER SPECIFICITY)
   ======================================== */

/* All links in content areas - FORCE RED */
#help-category-content .faq-content a,
#help-category-content .article-content a,
#help-category-content .category-description a,
div.faq-content a,
div.article-content a,
div.category-description a,
.faq-content a[href],
.article-content a[href],
.category-description a[href] {
  color: #e00000 !important;
  text-decoration: underline !important;
  font-weight: 500 !important;
  transition: all 0.2s ease !important;
}

#help-category-content .faq-content a:hover,
#help-category-content .article-content a:hover,
#help-category-content .category-description a:hover,
div.faq-content a:hover,
div.article-content a:hover,
div.category-description a:hover,
.faq-content a[href]:hover,
.article-content a[href]:hover,
.category-description a[href]:hover {
  color: #bf0d0d !important;
  text-decoration: none !important;
}

/* Visited links */
#help-category-content .faq-content a:visited,
#help-category-content .article-content a:visited,
#help-category-content .category-description a:visited,
div.faq-content a:visited,
div.article-content a:visited,
div.category-description a:visited {
  color: #c00000 !important;
}

/* External link icon */
#help-category-content .faq-content a[target="_blank"]::after,
#help-category-content .article-content a[target="_blank"]::after,
#help-category-content .category-description a[target="_blank"]::after,
div.faq-content a[target="_blank"]::after,
div.article-content a[target="_blank"]::after,
div.category-description a[target="_blank"]::after {
  content: " ↗";
  font-size: 0.85em;
  opacity: 0.7;
}

/* ========================================
   Z-INDEX HIERARCHY FIX - GLOBAL
   ======================================== */

/* Ensure hero section can show dropdown properly */
.hero {
  z-index: 100 !important;
}

.hero .container {
  position: relative;
  z-index: inherit;
}

/* Section below hero must have lower z-index */
.section {
  z-index: 10 !important;
}

/* Search wrapper - highest priority */
#help-center-search-wrapper {
  z-index: 150 !important;
}

/* Dropdown - maximum z-index */
.help-search-dropdown {
  z-index: 200 !important;
  isolation: isolate;
}

/* Prevent any other elements from interfering */
.sticky-sidebar {
  z-index: 5 !important;
}

.side-control {
  z-index: 1;
}

/* ========================================
   LANDING PAGE CARD FIX
   Fix shadow clipping on category cards
   ======================================== */

/* Ensure section has proper spacing */
.section {
  padding: 80px 0;
  overflow: visible !important; /* ✅ CRITICAL: Allow shadows to show */
  position: relative;
  z-index: 10;
}

/* Add padding to container to prevent shadow clipping */
.section .container {
  padding-left: 20px;
  padding-right: 20px;
}

/* Ensure grid has proper spacing */
#help-categories-grid {
  padding: 20px 0; /* ✅ Add vertical padding */
  margin: 0 -10px; /* Negative margin for column spacing */
}

#help-categories-grid > [class*="col-"] {
  padding: 0 10px; /* Add horizontal padding to each column */
  margin-bottom: 40px; /* Space between rows */
}

/* Enhanced card styling with proper shadow handling */
.box-content {
  padding: 24px;
  background: #ffffff;
  box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.1), 0px 2px 6px 2px rgba(0, 0, 0, 0.1);
  border-radius: 24px;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;

  /* ✅ CRITICAL: Ensure shadow is not clipped */
  margin: 10px; /* Add margin to prevent shadow clipping */
}

.box-content:hover {
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.15),
    0px 6px 12px 4px rgba(0, 0, 0, 0.15);
  transform: translateY(-4px);
}

/* Fix hero section overlap issue */
.hero {
  background-size: cover;
  position: relative;
  height: 320px !important; /* From previous fix */
  display: flex;
  padding-top: 0px !important;
  align-items: center;
  z-index: 100 !important; /* Higher z-index for hero */
  overflow: visible !important; /* ✅ Allow overflow */
}

/* Ensure hero decorative element doesn't overlap cards */
.hero::after {
  content: "";
  position: absolute;
  width: 101%;
  height: 100px;
  background: #ffffff;
  transform: rotate(-3deg);
  bottom: -60px;
  left: 0;
  z-index: -1; /* ✅ Behind hero content */
  pointer-events: none; /* Don't block clicks */
}

/* ✅ CRITICAL FIX: Ensure section below hero has proper spacing */
.hero + .section {
  margin-top: 0; /* Remove any negative margin */
  padding-top: 100px; /* Add more top padding */
}

/* Alternative: If hero::after overlaps, adjust section position */
.section:first-of-type {
  margin-top: 20px; /* Push down slightly */
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 991px) {
  .section {
    padding: 60px 0;
  }

  .hero + .section {
    padding-top: 80px;
  }

  #help-categories-grid {
    padding: 15px 0;
  }

  .box-content {
    margin: 8px;
  }
}

@media (max-width: 768px) {
  .section {
    padding: 40px 0;
  }

  .hero + .section {
    padding-top: 60px;
  }

  #help-categories-grid {
    padding: 10px 0;
    margin: 0 -8px;
  }

  #help-categories-grid > [class*="col-"] {
    padding: 0 8px;
    margin-bottom: 20px;
  }

  .box-content {
    margin: 5px;
  }
}

/* ========================================
   GRID LAYOUT FIX (Bootstrap Override)
   ======================================== */

/* Ensure proper row spacing */
.row {
  margin-left: -15px;
  margin-right: -15px;
}

.row > [class*="col-"] {
  padding-left: 15px;
  padding-right: 15px;
}

/* For gap utility if Bootstrap 5 is used */
.g-4 {
  --bs-gutter-x: 1.5rem;
  --bs-gutter-y: 1.5rem;
}

.g-lg-5 {
  --bs-gutter-x: 3rem;
  --bs-gutter-y: 3rem;
}

@media (min-width: 992px) {
  .g-lg-5 {
    margin-top: calc(-1 * var(--bs-gutter-y));
    margin-left: calc(-0.5 * var(--bs-gutter-x));
    margin-right: calc(-0.5 * var(--bs-gutter-x));
  }

  .g-lg-5 > * {
    margin-top: var(--bs-gutter-y);
    padding-left: calc(var(--bs-gutter-x) * 0.5);
    padding-right: calc(var(--bs-gutter-x) * 0.5);
  }
}

/* ========================================
   CARD INNER CONTENT ALIGNMENT
   ======================================== */

.inner-card {
  min-height: 350px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 0;
}

/* Ensure card content doesn't touch edges */
.box-content .mb-3 {
  margin-bottom: 1rem !important;
}

.box-content .card-title {
  margin-bottom: 1rem;
  word-wrap: break-word;
}

/* ========================================
   DEBUG HELPER (Remove in production)
   ======================================== */

/* Show card boundaries for admin when debugging */
body.logged-in.debug-mode .box-content {
  outline: 2px dashed red;
  outline-offset: -2px;
}

body.logged-in.debug-mode .box-content::before {
  content: "Card boundary";
  position: absolute;
  top: 0;
  left: 0;
  font-size: 10px;
  color: red;
  background: yellow;
  padding: 2px 5px;
  z-index: 999;
}
