/* style-health.css - Premium Glassmorphic Health layout and widget styling */

/* 3-Column Layout */
.health-container {
  max-width: 1500px;
  width: 95%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 220px 1fr 320px;
  gap: 1.5rem;
  padding: 2rem 0;
}

/* Sidebars and main content styling */
.health-sidebar-left {
  display: flex;
  flex-direction: column;
}

.health-sidebar-right {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.health-main-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sticky-sidebar-wrapper {
  position: sticky;
  top: 6rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  z-index: 10;
}

/* Glassmorphic Cards & Widgets */
.glass-widget {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: var(--transition-smooth);
}

.glass-widget:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.glass-widget h3 {
  font-family: var(--font-headings);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Left Sidebar AdSense Placeholder */
.sticky-sponsor-block {
  min-height: 550px;
  background: rgba(255, 255, 255, 0.01);
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 1rem;
  transition: var(--transition-smooth);
  position: relative;
}

.sticky-sponsor-block:hover {
  border-color: var(--accent-green);
  background: rgba(46, 204, 113, 0.02);
}

.sticky-sponsor-block::before {
  content: "SPONSORED SHOWCASE";
  font-family: var(--font-headings);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
  margin-bottom: 0.5rem;
}

/* Article Body Typography */
.article-header {
  margin-bottom: 1.5rem;
}

.article-header h1 {
  font-family: var(--font-headings);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.25;
  background: linear-gradient(135deg, var(--text-main) 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.75rem;
}

.article-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.article-body h2 {
  font-family: var(--font-headings);
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 0.8rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.article-body p {
  font-size: 1.05rem;
  color: var(--text-main);
  opacity: 0.95;
  line-height: 1.65;
  margin-bottom: 1.5rem;
}

.article-body ul, .article-body ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.article-body li {
  font-size: 1.05rem;
  color: var(--text-main);
  opacity: 0.95;
}

/* Table of Contents */
.toc-widget {
  margin-bottom: 1.5rem;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toc-list a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  transition: var(--transition-smooth);
  display: block;
}

.toc-list a:hover {
  color: var(--accent-green);
  padding-left: 4px;
}

.toc-list a.active-toc {
  color: var(--accent-green) !important;
  font-weight: 700;
  border-left: 2px solid var(--accent-green);
  padding-left: 8px;
  margin-left: -10px;
}

/* Reading Progress Bar */
.progress-bar-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  z-index: 2000;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, var(--accent-red), var(--accent-green));
  box-shadow: 0 0 10px var(--accent-green-glow);
  transition: width 0.1s ease-out;
}

/* Interactive Controls (TTS, Bookmark, Font Size) */
.tts-btn, .bookmark-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-smooth);
}

.tts-btn:hover, .bookmark-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-green);
}

.tts-btn.playing {
  color: var(--accent-red);
  border-color: var(--accent-red);
  background: rgba(231, 76, 60, 0.08);
  animation: ttsPulse 1.5s infinite alternate ease-in-out;
}

@keyframes ttsPulse {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(1.03); opacity: 1; }
}

.bookmark-btn.active {
  color: var(--accent-gold);
  border-color: var(--accent-gold);
  background: rgba(241, 196, 15, 0.08);
}

.font-adjuster {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.font-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-headings);
  font-size: 0.8rem;
  font-weight: 700;
  width: 30px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.font-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-green);
}

/* Interactive Quiz Widget */
.quiz-container {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.quiz-progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-green);
  transition: width 0.3s ease;
}

.quiz-question {
  display: none;
}

.quiz-question.active {
  display: block;
  animation: widgetFade 0.4s ease-out;
}

.quiz-question h4 {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
  line-height: 1.4;
}

.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quiz-choice {
  width: 100%;
  padding: 0.6rem 0.8rem;
  text-align: left;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-main);
  cursor: pointer;
  font-size: 0.82rem;
  transition: var(--transition-smooth);
}

.quiz-choice:hover {
  border-color: var(--accent-green);
  background: rgba(46, 204, 113, 0.05);
  transform: translateX(2px);
}

.quiz-result {
  display: none;
  text-align: center;
  animation: widgetFade 0.4s ease-out;
}

.quiz-result.active {
  display: block;
}

.quiz-result h4 {
  font-size: 1.05rem;
  color: var(--accent-green);
  margin-bottom: 0.6rem;
}

.quiz-result p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.quiz-restart-btn {
  padding: 0.4rem 1rem;
  background: var(--accent-green);
  color: #000;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.78rem;
  transition: var(--transition-smooth);
}

.quiz-restart-btn:hover {
  box-shadow: 0 0 12px var(--accent-green-glow);
  transform: translateY(-1px);
}

/* Remedy Finder Widget */
.remedy-select-wrapper {
  position: relative;
}

.remedy-select {
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(9, 10, 15, 0.7);
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  appearance: none;
}

.remedy-select:focus {
  border-color: var(--accent-green);
}

.remedy-select-wrapper::after {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.75rem;
}

.remedy-result {
  display: none;
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px dashed var(--border-color);
  animation: widgetFade 0.3s ease-out;
}

@keyframes widgetFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.remedy-text {
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.remedy-link {
  color: var(--accent-green);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: underline;
}

/* Saved Articles Widget */
.saved-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.saved-list li {
  font-size: 0.85rem;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.saved-list li:last-child {
  border-bottom: none;
}

.saved-list a {
  color: var(--text-main);
  text-decoration: none;
  transition: var(--transition-smooth);
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-list a:hover {
  color: var(--accent-green);
}

.remove-saved {
  background: none;
  border: none;
  color: var(--accent-red);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 0.2rem;
  line-height: 1;
  transition: var(--transition-smooth);
}

.remove-saved:hover {
  color: #ff6b6b;
  transform: scale(1.2);
}

/* Site Links Widget */
.trending-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.trending-list li {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.trending-list li:last-child {
  border-bottom: none;
}

.trending-list a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  transition: var(--transition-smooth);
}

.trending-list a:hover {
  color: var(--text-main);
}

/* Bottom Right Floating Ad Panel */
.floating-ad-panel {
  position: fixed;
  bottom: 2rem;
  right: -340px; /* Hidden initially */
  width: 320px;
  background: rgba(13, 16, 23, 0.95);
  border: 1px solid var(--border-color);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  border-radius: 16px;
  z-index: 1000;
  transition: right 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 1rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.floating-ad-panel.show {
  right: 2rem; /* Slide in */
}

.floating-ad-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.4rem;
}

.floating-ad-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
}

.floating-ad-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  padding: 0 0.2rem;
  transition: var(--transition-smooth);
}

.floating-ad-close:hover {
  color: var(--accent-red);
  transform: scale(1.1);
}

.floating-ad-body {
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.01);
  border-radius: 8px;
  padding: 0.5rem;
  min-height: 250px;
}

/* Floating Utility Controls (Back to Top) */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-main);
  cursor: pointer;
  display: none; /* Controlled by JS scroll events */
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 999;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: var(--transition-smooth);
}

.back-to-top:hover {
  border-color: var(--accent-green);
  color: var(--accent-green);
  transform: translateY(-2px);
}

.back-to-top svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Next Up Section */
.next-up-section {
  margin-top: 3rem;
  border-top: 1px solid var(--border-color);
  padding-top: 2rem;
}

.next-up-title-label {
  font-family: var(--font-headings);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
  margin-bottom: 0.8rem;
}

.next-up-card {
  display: flex;
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  text-decoration: none;
  color: inherit;
  transition: var(--transition-smooth);
}

.next-up-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-green);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.next-up-img {
  width: 140px;
  min-width: 140px;
  background-size: cover;
  background-position: center;
  background-color: rgba(255, 255, 255, 0.02);
}

.next-up-info {
  padding: 1.2rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.next-up-info h3 {
  font-family: var(--font-headings);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.3rem;
  line-height: 1.3;
}

.next-up-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Glossary Term Tooltips */
.glossary-link {
  position: relative;
  border-bottom: 1.5px dotted var(--accent-green);
  cursor: help;
}

.glossary-link::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: 250px;
  background: rgba(13, 16, 23, 0.96);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  text-align: center;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.4;
  font-weight: 500;
  z-index: 3000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-smooth);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}

.glossary-link::before {
  content: "";
  position: absolute;
  bottom: 118%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  border-width: 6px;
  border-style: solid;
  border-color: rgba(13, 16, 23, 0.96) transparent transparent transparent;
  z-index: 3000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-smooth);
  pointer-events: none;
}

.glossary-link:hover::after, .glossary-link:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Responsive Styles */
@media (max-width: 1024px) {
  .health-container {
    grid-template-columns: 1fr 300px;
  }
  .health-sidebar-left {
    display: none; /* Hide left ad sidebar on tablet */
  }
}

@media (max-width: 768px) {
  .health-container {
    grid-template-columns: 1fr;
    width: 90%;
  }
  .health-sidebar-right {
    order: 2;
  }
  .health-main-content {
    order: 1;
  }
  .sticky-sidebar-wrapper {
    position: static;
  }
  .article-header h1 {
    font-size: 1.8rem;
  }
}

/* Top Floating Slide-in Ad Panel */
.top-ad-panel {
  position: fixed;
  top: -160px; /* Hidden initially */
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 800px;
  background: rgba(13, 16, 23, 0.95);
  border: 1px solid var(--border-color);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  border-radius: 0 0 16px 16px;
  z-index: 2000;
  transition: top 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0.8rem 1.5rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.top-ad-panel.show {
  top: 80px; /* Slide down below the sticky header navigation */
}

.top-ad-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

.top-ad-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--accent-gold);
  white-space: nowrap;
}

.top-ad-body {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.01);
  border-radius: 8px;
  min-height: 90px;
}

.top-ad-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  padding: 0 0.5rem;
  transition: var(--transition-smooth);
}

.top-ad-close:hover {
  color: var(--accent-red);
  transform: scale(1.15);
}

/* Floating Slide-In Ad Panel (Bottom Right) */
.floating-ad-panel {
  position: fixed;
  bottom: 80px; /* Positioned at bottom-right for clean desktop layout */
  right: -360px; /* Hidden initially */
  width: 320px;
  background: rgba(13, 16, 23, 0.95);
  border: 1px solid var(--border-color);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  border-radius: 16px;
  z-index: 9999;
  transition: right 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0.8rem 1.0rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.floating-ad-panel.show {
  right: 20px; /* Slide in */
}

.floating-ad-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.4rem;
}

.floating-ad-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--accent-gold);
}

.floating-ad-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  padding: 0 0.2rem;
  transition: var(--transition-smooth);
}

.floating-ad-close:hover {
  color: var(--accent-red);
  transform: scale(1.15);
}

.floating-ad-body {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.01);
  border-radius: 8px;
  overflow: hidden;
  min-height: 250px;
}

@media (max-width: 768px) {
  .top-ad-panel {
    max-width: 95%;
    padding: 0.5rem 1rem;
    top: -200px;
  }
  .top-ad-panel.show {
    top: 70px; /* Adjust for mobile sticky header height */
  }
  .top-ad-content {
    flex-direction: column;
    gap: 0.4rem;
  }
  .top-ad-close {
    position: absolute;
    right: 0.5rem;
    top: 0.5rem;
  }
  
  .floating-ad-panel {
    width: 290px;
    right: -310px;
    bottom: 90px; /* Sits above the PWA navigation or default footer widgets */
  }
  .floating-ad-panel.show {
    right: 15px;
  }
  .floating-ad-body {
    min-height: 220px;
  }
}

/* Premium Wisdom Quote Card styling */
.quote-card {
  position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 4px solid var(--accent-green);
  padding: 1.5rem;
  border-radius: 12px;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
}

.quote-card blockquote {
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--text-main);
  line-height: 1.6;
  margin: 0 0 0.8rem 0;
  position: relative;
  z-index: 1;
}

.quote-card blockquote i.fa-quote-left {
  color: rgba(46, 204, 113, 0.15);
  font-size: 2.2rem;
  position: absolute;
  top: -1.2rem;
  left: -0.6rem;
  z-index: -1;
}

.quote-card cite {
  font-family: var(--font-headings);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: block;
}

/* ==========================================================================
   Interactive Visualizations (Serving Slider, DV% Bars, Badges, NutriPair)
   ========================================================================== */

/* Serving controller & macro card */
.serving-size-card {
  margin-bottom: 1.5rem;
}

.portion-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.preset-btn:hover, .preset-btn.active {
  background: rgba(46, 204, 113, 0.08);
  border-color: var(--accent-green);
  color: var(--text-main);
}

.slider-container {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.serving-weight-display {
  font-family: var(--font-headings);
  font-weight: 700;
  color: var(--accent-green);
}

.serving-range-input {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.serving-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green-glow);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.serving-range-input::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Dynamic Macros Section */
.macros-visual-container {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.macro-bar-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.macro-bar-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.macro-bar-label {
  font-weight: 600;
  color: var(--text-main);
}

.macro-bar-value {
  color: var(--text-muted);
}

.macro-bar-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.macro-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.macro-carbs .macro-bar-fill { background: linear-gradient(to right, #3498db, #2980b9); }
.macro-protein .macro-bar-fill { background: linear-gradient(to right, #e74c3c, #c0392b); }
.macro-fat .macro-bar-fill { background: linear-gradient(to right, #f1c40f, #f39c12); }

/* Diet Suitability Badges */
.diet-badges-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.diet-badge {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: var(--font-headings);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.35rem 0.7rem;
  border-radius: 20px;
  cursor: help;
  position: relative;
  transition: var(--transition-smooth);
}

.diet-badge.active {
  background: rgba(46, 204, 113, 0.06);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

/* Tooltip popup for diet badges */
.diet-badge::after {
  content: attr(data-reason);
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: 200px;
  background: rgba(13, 16, 23, 0.96);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  text-align: center;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.3;
  z-index: 3000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: var(--transition-smooth);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.diet-badge:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Daily Value (DV%) Progress Bars */
.nutrient-bar-container {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.4rem 0;
}

.nutrient-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.nutrient-bar-name {
  font-weight: 600;
  color: var(--text-main);
}

.nutrient-bar-val {
  color: var(--text-muted);
}

.nutrient-bar-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
  overflow: hidden;
}

.nutrient-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, #2ecc71, #27ae60);
  border-radius: 3px;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Highlight excellent/good source */
.nutrient-bar-container.excellent-source .nutrient-bar-fill {
  background: linear-gradient(to right, var(--accent-green), #78ffd6);
  box-shadow: 0 0 6px var(--accent-green-glow);
}

.nutrient-bar-container.excellent-source .nutrient-bar-name::after {
  content: " ★";
  color: var(--accent-gold);
  font-size: 0.8rem;
}

/* NutriPair Synergy Card */
.synergy-card {
  margin-top: 2rem;
  border: 1px solid rgba(120, 255, 214, 0.15) !important;
}

.synergy-grid-selectors {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.synergy-item-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.synergy-item-card i {
  font-size: 1.5rem;
}

.synergy-item-card select {
  width: 100%;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  background: rgba(9, 10, 15, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 6px;
  outline: none;
}

.synergy-plus-icon {
  font-size: 1.2rem;
  color: var(--accent-green);
}

.synergy-verdict-box {
  background: rgba(120, 255, 214, 0.03);
  border: 1px solid rgba(120, 255, 214, 0.2);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
}

.synergy-verdict-box i {
  font-size: 1.4rem;
  color: var(--accent-green);
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.synergy-verdict-title {
  font-family: var(--font-headings);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.synergy-verdict-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.synergy-progress-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/* Expert References & Scientific Evidence */
.expert-references-section {
  margin-top: 3rem;
  border-top: 1px solid var(--border-color);
  padding-top: 2rem;
  margin-bottom: 2rem;
}

.expert-references-section h2 {
  font-family: var(--font-headings);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.references-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

.reference-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  transition: var(--transition-smooth);
}

.reference-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(46, 204, 113, 0.3);
  transform: translateY(-2px);
}

.reference-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
}

.reference-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.reference-link {
  color: var(--accent-green);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.2rem;
  font-size: 0.82rem;
}

.reference-link:hover {
  text-decoration: underline;
}

/* Health Mega Menu Navigation Dropdown styling.
   Brought in line with the sibling Food-Database mega-menu (style.css
   .nav-dropdown-content.mega-menu / .mega-menu-grid: 650px, 3 columns).
   The health menu has twice the topic groups, so it keeps a wider box and
   wraps to two rows of 3 columns instead of stretching to one row of 6 --
   that was nearly 2x the sibling's width and, combined with a right:-250px
   offset, could clip off the right edge of the viewport on laptop screens
   (~1350-1500px wide). */
.nav-dropdown-content.health-mega-menu {
  min-width: 780px;
  left: auto;
  right: -40px;
  transform: translateY(10px);
}

.nav-dropdown:hover .nav-dropdown-content.health-mega-menu {
  transform: translateY(0);
}

.health-mega-menu-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem;
  padding: 1rem;
}

/* Laptop/tablet breakpoint: narrow the box further and pull it fully
   flush with the button's right edge so it can't run past the viewport
   before the phone-width stacked layout below takes over. */
@media (max-width: 1440px) {
  .header-nav .nav-dropdown-content.health-mega-menu {
    min-width: 640px;
    right: 0;
  }

  .header-nav .health-mega-menu-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile nav override: the fixed min-width above is for the desktop hover
   mega-menu. On mobile the same markup is reused as a collapsible, always-
   expanded stacked list (see .header-nav rules in style.css), so the fixed
   min-width must be removed here too -- Chrome's mobile viewport sizing
   still accounts for an off-screen/clipped element's intrinsic min-width
   even when a parent has overflow-x:hidden, which was silently forcing the
   whole page's layout viewport wider than the phone screen. */
@media (max-width: 820px) {
  .header-nav .nav-dropdown-content.health-mega-menu {
    min-width: 0;
    width: 100%;
    left: 0;
    right: auto;
  }

  .header-nav .health-mega-menu-grid {
    grid-template-columns: 1fr;
  }
}

/* .diet-badge::after is a 200px-wide hover tooltip, invisible until hover
   (which isn't a reliable interaction on touch anyway). Even hidden via
   opacity/visibility, its absolutely-positioned box is still accounted for
   by Chrome's mobile viewport sizing and was silently widening the whole
   page on nutrition pages with several badges in a row (e.g. tofu). */
@media (max-width: 640px) {
  .diet-badge::after {
    display: none;
  }
}


