/* =========================================================
   MyGrowPal — Help Center styles
   Extends styles.css with sidebar, content, search and mobile layouts
   ========================================================= */

/* Hero area */
.help-hero {
  position: relative;
  padding: 48px 0 36px;
  overflow: hidden;
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(149, 213, 178, 0.35), transparent 58%),
    radial-gradient(700px 360px at 5% 30%, rgba(244, 162, 97, 0.15), transparent 55%),
    linear-gradient(180deg, #f3f8f3 0%, var(--cream) 100%);
  border-bottom: 1px solid var(--line);
}
.help-hero-inner {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}
.help-hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.2em;
}
.help-hero h1 em {
  font-style: normal;
  color: var(--forest);
}
.help-hero-sub {
  font-size: 1.12rem;
  color: var(--muted);
  max-width: 54ch;
  margin: 0 auto 28px;
}

/* Breadcrumbs */
.breadcrumbs {
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.breadcrumbs a {
  color: var(--muted);
  transition: color 0.15s ease;
}
.breadcrumbs a:hover {
  color: var(--forest);
  text-decoration: none;
}
.breadcrumbs .current {
  color: var(--soil);
  font-weight: 600;
}

/* Search bar */
.search-container {
  position: relative;
  max-width: 580px;
  margin: 0 auto;
  box-shadow: var(--shadow-sm);
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--line);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.search-container:focus-within {
  box-shadow: var(--shadow);
  border-color: var(--sage);
}
.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  opacity: 0.6;
  pointer-events: none;
}
#helpSearch {
  width: 100%;
  padding: 16px 50px 16px 50px;
  font-size: 1rem;
  border: none;
  background: transparent;
  outline: none;
  color: var(--ink);
  font-family: var(--font-body);
}
#helpSearch::placeholder {
  color: var(--muted);
  opacity: 0.75;
}
#clearSearch {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: rgba(27, 58, 47, 0.08);
  color: var(--soil);
  font-size: 1.2rem;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s ease;
}
#clearSearch:hover {
  background: rgba(27, 58, 47, 0.16);
}

/* Layout columns */
.help-section {
  padding: 48px 0 88px;
  background: var(--cream);
}
.help-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 48px;
  align-items: start;
}

/* Sticky sidebar */
.help-sidebar {
  position: sticky;
  top: 100px; /* offset to avoid sticky header */
  max-height: calc(100vh - 140px);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px 20px;
}
.sidebar-scroller {
  max-height: calc(100vh - 190px);
  overflow-y: auto;
  padding-right: 4px;
}
/* Custom scrollbar for sidebar */
.sidebar-scroller::-webkit-scrollbar {
  width: 5px;
}
.sidebar-scroller::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-scroller::-webkit-scrollbar-thumb {
  background-color: var(--line);
  border-radius: 10px;
}

.sidebar-category {
  margin-bottom: 24px;
}
.sidebar-category:last-child {
  margin-bottom: 0;
}
.category-title {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.category-icon {
  font-size: 1rem;
}
.category-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.category-list li {
  margin-bottom: 6px;
}
.category-list li:last-child {
  margin-bottom: 0;
}
.sidebar-link {
  display: block;
  font-size: 0.94rem;
  line-height: 1.4;
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
  text-decoration: none;
}
.sidebar-link:hover {
  background: rgba(116, 198, 157, 0.1);
  color: var(--forest);
  text-decoration: none;
  padding-left: 14px;
}
.sidebar-link.active {
  background: rgba(45, 106, 79, 0.08);
  color: var(--forest);
  font-weight: 600;
  border-left-color: var(--forest);
  padding-left: 14px;
}
/* Subdued items when search active */
.sidebar-link.filtered-out {
  display: none;
}
.sidebar-category.filtered-out {
  display: none;
}

/* Mobile category selector (hidden on desktop) */
.mobile-topics-bar {
  display: none;
  margin-bottom: 24px;
}
#mobileSidebarToggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--soil);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
#mobileSidebarToggle .btn-icon {
  margin-right: 8px;
}
#mobileSidebarToggle .btn-arrow {
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}
#mobileSidebarToggle.active .btn-arrow {
  transform: rotate(180deg);
}

/* Content details section */
.help-content {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 44px 48px;
  min-height: 480px;
  position: relative;
}

/* Hide articles by default */
.help-article {
  display: none;
  animation: fadeIn 0.3s ease;
}
.help-article.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.article-category-tag {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--moss);
  background: rgba(116, 198, 157, 0.16);
  padding: 4px 12px;
  border-radius: 99px;
  margin-bottom: 16px;
}

.help-article h1 {
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  color: var(--soil);
  margin-bottom: 0.6em;
  line-height: 1.2;
}
.help-article h2 {
  font-size: 1.35rem;
  margin-top: 1.8em;
  margin-bottom: 0.6em;
  color: var(--soil);
}
.help-article h3 {
  font-size: 1.1rem;
  font-family: var(--font-body);
  font-weight: 700;
  margin-top: 1.4em;
  margin-bottom: 0.4em;
  color: var(--soil);
}
.help-article p,
.help-article li {
  font-size: 1.02rem;
  color: #36473e;
  line-height: 1.7;
}
.help-article p {
  margin-bottom: 1.2em;
}
.help-article ul,
.help-article ol {
  padding-left: 24px;
  margin: 0 0 1.4em;
}
.help-article li {
  margin-bottom: 0.5em;
}
.help-article a {
  color: var(--moss);
  font-weight: 600;
  text-decoration: underline;
}
.help-article a:hover {
  color: var(--forest);
}

/* Callouts in articles */
.callout {
  border-radius: 12px;
  padding: 20px 24px;
  margin: 24px 0;
  border-left: 4px solid;
}
.callout-info {
  background: rgba(168, 218, 220, 0.15);
  border-left-color: var(--sky);
}
.callout-info h3 {
  margin-top: 0;
  color: #2b5759;
}
.callout-warning {
  background: rgba(244, 162, 97, 0.14);
  border-left-color: var(--sun);
}
.callout-warning h3 {
  margin-top: 0;
  color: #6a4425;
}

/* Tables inside help content */
.help-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.96rem;
}
.help-table th,
.help-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.help-table th {
  background: rgba(243, 248, 243, 0.6);
  color: var(--soil);
  font-weight: 700;
  border-top: 1px solid var(--line);
}
.help-table tr:hover td {
  background: rgba(243, 248, 243, 0.4);
}

/* Search state overlays */
.search-results-banner {
  background: rgba(116, 198, 157, 0.15);
  border: 1px solid rgba(116, 198, 157, 0.3);
  color: var(--forest);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.94rem;
  font-weight: 500;
  margin-bottom: 24px;
}
.no-results {
  text-align: center;
  padding: 48px 24px;
}
.no-results-icon {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 16px;
}
.no-results h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}
.no-results p {
  color: var(--muted);
  margin-bottom: 24px;
}

/* Responsive breakpoint styling */
@media (max-width: 980px) {
  .help-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  .mobile-topics-bar {
    display: block;
  }
  
  /* Sidebar transforms into absolute overlay drawer */
  .help-sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100vh;
    max-height: 100vh;
    z-index: 1000;
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-left: none;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(27, 58, 47, 0.15);
  }
  .help-sidebar.open {
    left: 0;
  }
  .sidebar-scroller {
    max-height: calc(100vh - 60px);
    margin-top: 20px;
  }

  /* Overlay backdrop */
  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(27, 58, 47, 0.35);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }
  
  .help-content {
    padding: 32px 24px;
  }
}

@media (max-width: 520px) {
  .help-hero {
    padding: 36px 0 28px;
  }
  .help-hero h1 {
    font-size: 2.2rem;
  }
  .help-content {
    padding: 24px 16px;
    border-radius: 12px;
  }
  .help-table {
    display: block;
    overflow-x: auto;
  }
}
