/* ==========================================================================
   Blog Post Sidebar — New Layout (15 Widgets + Trust Bar)
   ========================================================================== */

/* ── Layout override: switch to wider sidebar ─────────────────────────── */
@media (min-width: 768px) {
  .blog-post-detail .post-layout {
    grid-template-columns: 1fr 320px;
    gap: 1.8rem;
    align-items: start;
  }

  .post-sidebar {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--mid-gray) transparent;
    padding-right: 4px;
  }

  .post-sidebar::-webkit-scrollbar { width: 4px; }
  .post-sidebar::-webkit-scrollbar-track { background: transparent; }
  .post-sidebar::-webkit-scrollbar-thumb { background: var(--mid-gray); border-radius: 4px; }
}

/* ── Base sidebar widget reset ────────────────────────────────────────── */
.post-sidebar .sidebar-widget {
  background: var(--white);
  border: 1px solid var(--mid-gray);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.9rem;
  font-size: 0.875rem;
  color: var(--text-dark);
}

.post-sidebar .widget-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--mid-gray);
}

.post-sidebar .widget-header .widget-num {
  background: var(--primary-color);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.post-sidebar .widget-header h3 {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dark);
  margin: 0;
  border: none;
  padding: 0;
}

.post-sidebar .widget-header .widget-icon {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--text-light);
}

/* ==========================================================================
   Widget 1 — About This Guide
   ========================================================================== */
.sw-about-guide .guide-meta-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 0.55rem;
  font-size: 0.82rem;
}

.sw-about-guide .guide-meta-row i {
  color: var(--primary-color);
  font-size: 0.8rem;
  margin-top: 2px;
  flex-shrink: 0;
  width: 14px;
}

.sw-about-guide .guide-meta-label {
  color: var(--text-light);
  margin-right: 4px;
  flex-shrink: 0;
}

.sw-about-guide .guide-meta-value {
  color: var(--text-dark);
  font-weight: 500;
}

/* ==========================================================================
   Widget 2 — Quick Navigation
   ========================================================================== */
.sw-quick-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sw-quick-nav ul li {
  margin-bottom: 0;
}

.sw-quick-nav ul li a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: 6px;
  color: var(--text-dark);
  font-size: 0.83rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.sw-quick-nav ul li a::before {
  content: '›';
  color: var(--primary-color);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
}

.sw-quick-nav ul li a:hover {
  background: var(--light-gray);
  color: var(--primary-color);
}

/* ==========================================================================
   Widget 3 — Quick Facts
   ========================================================================== */
.sw-quick-facts table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.81rem;
}

.sw-quick-facts table tr td {
  padding: 5px 4px;
  border-bottom: 1px solid var(--mid-gray);
  vertical-align: top;
}

.sw-quick-facts table tr:last-child td {
  border-bottom: none;
}

.sw-quick-facts table tr td:first-child {
  color: var(--text-light);
  width: 42%;
  font-weight: 500;
}

.sw-quick-facts table tr td:last-child {
  color: var(--text-dark);
  font-weight: 600;
}

/* ==========================================================================
   Widget 4 — Related Topics
   ========================================================================== */
.sw-related-topics .topic-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sw-related-topics .topic-item {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-dark);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}

.sw-related-topics .topic-item:hover {
  background: var(--light-gray);
  color: var(--primary-color);
}

.sw-related-topics .topic-thumb {
  width: 36px;
  height: 28px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--light-gray);
  border: 1px solid var(--mid-gray);
}

.sw-related-topics .topic-thumb-placeholder {
  width: 36px;
  height: 28px;
  border-radius: 4px;
  background: linear-gradient(135deg, #f59e0b22, #f59e0b44);
  border: 1px solid var(--mid-gray);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--primary-color);
}

.sw-related-topics .explore-more {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
}

.sw-related-topics .explore-more:hover { text-decoration: underline; }

/* ==========================================================================
   Widget 5 — Key Entities
   ========================================================================== */
.sw-key-entities .entity-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.sw-key-entities .entity-tag {
  background: var(--light-gray);
  border: 1px solid var(--mid-gray);
  color: var(--text-dark);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 20px;
  cursor: default;
  transition: background 0.2s, color 0.2s;
}

.sw-key-entities .entity-tag:hover {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

.sw-key-entities .view-all {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
  margin-top: 2px;
}

.sw-key-entities .view-all:hover { text-decoration: underline; }

/* ==========================================================================
   Widget 6 — Research Snapshot
   ========================================================================== */
.sw-research-snapshot .research-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  font-size: 0.82rem;
}

.sw-research-snapshot .research-row i {
  color: var(--accent-color);
  font-size: 0.72rem;
  width: 12px;
  flex-shrink: 0;
}

.sw-research-snapshot .research-label {
  color: var(--text-light);
  flex: 1;
}

.sw-research-snapshot .research-val {
  font-weight: 700;
  color: var(--text-dark);
}

.sw-research-snapshot .research-icon-float {
  float: right;
  font-size: 1.8rem;
  opacity: 0.12;
  margin-top: -10px;
}

/* ==========================================================================
   Widget 7 — Knowledge Journey
   ========================================================================== */
.sw-knowledge-journey .journey-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}

.sw-knowledge-journey .journey-steps::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--mid-gray);
  border-radius: 2px;
}

.sw-knowledge-journey .journey-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 0.82rem;
  color: var(--text-light);
  position: relative;
}

.sw-knowledge-journey .journey-step.active {
  color: var(--text-dark);
  font-weight: 600;
}

.sw-knowledge-journey .step-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--mid-gray);
  border: 2px solid var(--mid-gray);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  color: #fff;
  z-index: 1;
}

.sw-knowledge-journey .journey-step.active .step-dot {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.sw-knowledge-journey .journey-step.done .step-dot {
  background: var(--accent-color);
  border-color: var(--accent-color);
}

.sw-knowledge-journey .continue-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
}

.sw-knowledge-journey .continue-link:hover { text-decoration: underline; }

/* ==========================================================================
   Widget 8 — Comparison Hub
   ========================================================================== */
.sw-comparison-hub .comparison-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sw-comparison-hub .comparison-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 6px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-dark);
  font-size: 0.82rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.sw-comparison-hub .comparison-item:hover {
  background: var(--light-gray);
  color: var(--primary-color);
}

.sw-comparison-hub .comparison-item i {
  color: var(--primary-color);
  font-size: 0.75rem;
  width: 14px;
}

.sw-comparison-hub .view-all-comp {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
}

.sw-comparison-hub .view-all-comp:hover { text-decoration: underline; }

/* ==========================================================================
   Widget 9 — Download Center
   ========================================================================== */
.sw-download-center .download-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sw-download-center .download-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 6px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-dark);
  font-size: 0.82rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.sw-download-center .download-item:hover {
  background: var(--light-gray);
  color: var(--primary-color);
}

.sw-download-center .download-item i {
  color: var(--primary-color);
  font-size: 0.8rem;
  width: 14px;
}

.sw-download-center .view-all-dl {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
}

.sw-download-center .view-all-dl:hover { text-decoration: underline; }

/* ==========================================================================
   Widget 10 — Latest Research
   ========================================================================== */
.sw-latest-research .research-papers {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sw-latest-research .research-paper {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.sw-latest-research .paper-icon {
  flex-shrink: 0;
  width: 24px;
  height: 28px;
  background: var(--light-gray);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--primary-color);
  border: 1px solid var(--mid-gray);
}

.sw-latest-research .paper-info {
  flex: 1;
  min-width: 0;
}

.sw-latest-research .paper-title {
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.3;
  display: block;
  margin-bottom: 2px;
}

.sw-latest-research .paper-date {
  font-size: 0.73rem;
  color: var(--text-light);
}

.sw-latest-research .view-all-research {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
}

.sw-latest-research .view-all-research:hover { text-decoration: underline; }

/* ==========================================================================
   Widget 11 — Popular Articles
   ========================================================================== */
.sw-popular-articles .pop-article-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sw-popular-articles .pop-article-item {
  display: flex;
  gap: 8px;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.2s;
}

.sw-popular-articles .pop-article-item:hover { opacity: 0.8; }

.sw-popular-articles .pop-thumb {
  width: 48px;
  height: 40px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--light-gray);
  border: 1px solid var(--mid-gray);
}

.sw-popular-articles .pop-thumb-placeholder {
  width: 48px;
  height: 40px;
  border-radius: 5px;
  background: linear-gradient(135deg, #f59e0b22, #10b98122);
  border: 1px solid var(--mid-gray);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--primary-color);
}

.sw-popular-articles .pop-article-info {
  flex: 1;
  min-width: 0;
}

.sw-popular-articles .pop-article-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.3;
  display: block;
  margin-bottom: 2px;
}

.sw-popular-articles .pop-article-meta {
  font-size: 0.72rem;
  color: var(--text-light);
}

.sw-popular-articles .more-articles {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
}

.sw-popular-articles .more-articles:hover { text-decoration: underline; }

/* ==========================================================================
   Widget 12 — Safety Reminder
   ========================================================================== */
.sw-safety-reminder {
  background: #fffbeb !important;
  border-color: #fbbf24 !important;
}

[data-theme="dark"] .sw-safety-reminder {
  background: #292420 !important;
  border-color: #92400e !important;
}

.sw-safety-reminder .safety-body {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-dark);
}

.sw-safety-reminder .safety-body strong {
  color: #92400e;
  display: block;
  margin-bottom: 4px;
}

[data-theme="dark"] .sw-safety-reminder .safety-body strong {
  color: #fbbf24;
}

/* ==========================================================================
   Widget 13 — Newsletter
   ========================================================================== */
.sw-newsletter .newsletter-tagline {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 8px;
  line-height: 1.5;
}

.sw-newsletter .nl-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sw-newsletter .nl-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--mid-gray);
  border-radius: 6px;
  font-size: 0.82rem;
  background: var(--white);
  color: var(--text-dark);
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.sw-newsletter .nl-input:focus {
  border-color: var(--primary-color);
}

.sw-newsletter .nl-btn {
  width: 100%;
  padding: 8px;
  background: var(--primary-color);
  color: #1f2937;
  border: none;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: 0.02em;
}

.sw-newsletter .nl-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.sw-newsletter .nl-btn:active { transform: translateY(0); }

/* ==========================================================================
   Widget 14 — Author Card
   ========================================================================== */
.sw-author-card {
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5) !important;
  border-color: #a7f3d0 !important;
}

[data-theme="dark"] .sw-author-card {
  background: linear-gradient(135deg, #052e16, #064e3b) !important;
  border-color: #065f46 !important;
}

.sw-author-card .author-card-inner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.sw-author-card .author-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
  border: 2px solid var(--accent-color);
  background: #fff;
  padding: 3px;
}

.sw-author-card .author-logo-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-color);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #fff;
  font-weight: 700;
  border: 2px solid var(--accent-color);
}

.sw-author-card .author-card-info h4 {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 4px;
}

.sw-author-card .author-card-info p {
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.5;
  margin: 0;
}

/* ==========================================================================
   Widget 15 — Category Explorer
   ========================================================================== */
.sw-category-explorer .cat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.sw-category-explorer .cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 3px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--text-dark);
  font-size: 0.65rem;
  text-align: center;
  line-height: 1.2;
  transition: background 0.2s, color 0.2s;
}

.sw-category-explorer .cat-item:hover {
  background: var(--light-gray);
  color: var(--primary-color);
}

.sw-category-explorer .cat-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--light-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--primary-color);
  border: 1px solid var(--mid-gray);
  transition: background 0.2s, border-color 0.2s;
}

.sw-category-explorer .cat-item:hover .cat-icon {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

/* ==========================================================================
   Trust Bar
   ========================================================================== */
.blog-trust-bar {
  background: var(--dark-color);
  padding: 12px 0;
  border-top: 3px solid var(--primary-color);
}

[data-theme="dark"] .blog-trust-bar {
  background: #0a0f1a;
}

.blog-trust-bar .trust-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 8px;
}

.blog-trust-bar .trust-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.85);
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
}

.blog-trust-bar .trust-badge i {
  color: var(--primary-color);
  font-size: 0.85rem;
}

.blog-trust-bar .trust-sep {
  color: rgba(255,255,255,0.2);
  font-size: 1rem;
  font-weight: 300;
}

@media (max-width: 600px) {
  .blog-trust-bar .trust-sep { display: none; }
  .blog-trust-bar .trust-inner { justify-content: center; gap: 10px 16px; }
  .blog-trust-bar .trust-badge { font-size: 0.73rem; }
}

/* ==========================================================================
   Dark mode adjustments for new widgets
   ========================================================================== */
[data-theme="dark"] .post-sidebar .sidebar-widget {
  background: var(--white);
  border-color: var(--mid-gray);
}

[data-theme="dark"] .sw-quick-nav ul li a:hover,
[data-theme="dark"] .sw-related-topics .topic-item:hover,
[data-theme="dark"] .sw-comparison-hub .comparison-item:hover,
[data-theme="dark"] .sw-download-center .download-item:hover,
[data-theme="dark"] .sw-category-explorer .cat-item:hover {
  background: var(--light-gray);
}

[data-theme="dark"] .sw-key-entities .entity-tag {
  background: var(--light-gray);
  border-color: var(--mid-gray);
}

/* ==========================================================================
   Responsive — Mobile stacks sidebar below content
   ========================================================================== */
@media (max-width: 767px) {
  .post-sidebar {
    max-height: none;
    overflow-y: visible;
    position: static;
  }

  .sw-category-explorer .cat-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}
