/* ========================================
   SIDEBAR STYLES - UNIVERSAL (Archive & Single Post)
======================================== */

/* Blog Sidebar (Archive Pages) */
.blog-sidebar {
  position: sticky;
  top: 100px;
  align-self: start;
}

/* Single Post Sidebar */
.single-post-sidebar {
  position: relative;
}

/* Widget Base Styles */
.sidebar-widget {
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  transition: all 0.3s ease;
}

.sidebar-widget:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.sidebar-widget .widget-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #f1f5f9;
}

.sidebar-widget .widget-title svg {
  color: var(--accent);
  flex-shrink: 0;
}

/* Sticky Widget (TOC) */
.sticky-widget {
  position: sticky;
  top: 100px;
}

/* Table of Contents */
.toc-widget .widget-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toc-widget {
  overflow: hidden;
  position: relative;
}

#toc-container {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  position: relative;
  z-index: 1;
}

#toc-container ul {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

#toc-container li {
  list-style: none !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
  border-bottom: none !important;
  position: relative;
}

#toc-container li::before {
  display: none !important;
  content: none !important;
}

#toc-container a {
  display: block;
  padding: 0.625rem 0;
  padding-left: 1rem;
  color: #475569;
  text-decoration: none;
  font-size: 0.9375rem;
  line-height: 1.5;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  position: relative;
  z-index: 1;
}

#toc-container a.toc-sub-heading {
  padding-left: 2rem;
}

#toc-container a:hover,
#toc-container a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: #f8fafc;
}

/* Search Widget */
.search-widget .search-form {
  display: flex;
  gap: 0.5rem;
}

.search-field {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9375rem;
  transition: border-color 0.3s ease;
}

.search-field:focus {
  outline: none;
  border-color: var(--accent);
}

.search-submit {
  background: linear-gradient(135deg, var(--accent) 0%, #5a67d8 100%);
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.search-submit:hover {
  background: linear-gradient(135deg, #5a67d8 0%, #4c51bf 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Share Buttons Widget (Single Post) */
.share-widget .widget-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.share-widget .share-buttons-widget {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.share-btn-widget {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  width: 100%;
  justify-content: flex-start;
}

.share-btn-widget svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.share-btn-widget.twitter {
  background: linear-gradient(135deg, #1da1f2 0%, #0c85d0 100%);
}

.share-btn-widget.facebook {
  background: linear-gradient(135deg, #1877f2 0%, #0a5dcf 100%);
}

.share-btn-widget.linkedin {
  background: linear-gradient(135deg, #0077b5 0%, #005582 100%);
}

.share-btn-widget.copy-link-widget {
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
}

.share-btn-widget:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.share-btn-widget.copy-link-widget.copied {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

/* Categories Widget */
.categories-list {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.categories-list li {
  margin-bottom: 0.75rem !important;
  list-style: none !important;
  padding-left: 0 !important;
}

.categories-list li:last-child {
  margin-bottom: 0 !important;
}

.categories-list li::before {
  display: none !important;
  content: none !important;
}

.categories-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  background: #f8fafc;
  border-radius: 8px;
  color: #475569;
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.categories-list a:hover {
  background: var(--accent);
  color: #fff;
  transform: translateX(4px);
}

.category-count {
  background: #e2e8f0;
  color: #64748b;
  padding: 0.25rem 0.625rem;
  border-radius: 50px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.categories-list a:hover .category-count {
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
}

/* Recent Posts / Related Posts Widget */
.recent-posts-list,
.related-posts-list {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.recent-posts-list li,
.related-posts-list li {
  list-style: none !important;
  padding-left: 0 !important;
}

.recent-posts-list li::before,
.related-posts-list li::before {
  display: none !important;
  content: none !important;
}

.recent-post-item,
.related-post-item {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem !important;
  padding-bottom: 1.25rem !important;
  border-bottom: 1px solid #f1f5f9 !important;
  list-style: none !important;
}

.recent-post-item:last-child,
.related-post-item:last-child {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
  border-bottom: none !important;
}

.recent-post-thumb,
.related-post-thumb {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  background: #f1f5f9;
}

.recent-post-thumb img,
.related-post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.recent-post-item:hover .recent-post-thumb img,
.related-post-item:hover .related-post-thumb img {
  transform: scale(1.1);
}

.recent-post-content,
.related-post-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.recent-post-content h4,
.related-post-content h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
}

.recent-post-content h4 a,
.related-post-content h4 a {
  color: #1e293b;
  text-decoration: none;
  transition: color 0.2s ease;
}

.recent-post-content h4 a:hover,
.related-post-content h4 a:hover {
  color: var(--accent);
}

.recent-post-date,
.related-post-date {
  font-size: 0.8125rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.recent-post-date svg,
.related-post-date svg {
  color: #94a3b8;
  flex-shrink: 0;
}

/* Tags Widget */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-item {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 50px;
  color: #475569;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.tag-item:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Newsletter Widget */
.newsletter-widget p {
  color: #64748b;
  font-size: 0.9375rem;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.newsletter-form input[type="email"] {
  padding: 0.75rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9375rem;
  transition: border-color 0.2s ease;
}

.newsletter-form input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
}

.newsletter-form .btn-primary {
  width: 100%;
}

.newsletter-form .btn-small {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
}

/* Responsive Sidebar */
@media (max-width: 1200px) {
  .blog-sidebar,
  .sticky-widget {
    top: 80px;
  }
}

@media (max-width: 1024px) {
  .blog-sidebar {
    position: relative;
    top: 0;
  }
  
  .single-post-sidebar {
    max-width: 700px;
    margin: 0 auto;
  }
  
  .sticky-widget {
    position: relative;
    top: 0;
  }
}

@media (max-width: 768px) {
  .sidebar-widget {
    padding: 1.5rem;
  }
  
  .recent-post-thumb,
  .related-post-thumb {
    width: 70px;
    height: 70px;
  }
}

@media (max-width: 480px) {
  .sidebar-widget {
    padding: 1.25rem;
    margin-bottom: 1.5rem;
  }
  
  .sidebar-widget .widget-title {
    font-size: 1rem;
  }
}

/* Override content styles for sidebar */
.sidebar-widget ul {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.sidebar-widget ul li {
  list-style: none !important;
  padding-left: 0 !important;
  margin-bottom: 0 !important;
}

.sidebar-widget ul li::before {
  display: none !important;
  content: none !important;
}

.sidebar-widget ol {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.sidebar-widget ol li {
  list-style: none !important;
  padding-left: 0 !important;
  margin-bottom: 0 !important;
}

.sidebar-widget ol li::before {
  display: none !important;
  content: none !important;
}

/* Specific TOC styling override */
.toc-widget ul,
.toc-widget ul li {
  list-style: none !important;
  padding-left: 0 !important;
  margin: 0 !important;
}

.toc-widget ul li::before {
  display: none !important;
  content: none !important;
}

/* Related posts list specific */
.related-posts-list,
.related-posts-list li {
  list-style: none !important;
  padding-left: 0 !important;
}

.related-posts-list li::before {
  display: none !important;
  content: none !important;
}

/* CRITICAL: Force clean sidebar lists - override ALL content styles */
.sidebar-widget * {
  list-style: none !important;
}

.sidebar-widget ul,
.sidebar-widget ol {
  padding-left: 0 !important;
  margin: 0 !important;
}

.sidebar-widget li {
  padding-left: 0 !important;
}

.sidebar-widget li::before,
.sidebar-widget li::after {
  display: none !important;
  content: none !important;
}

/* Categories widget spacing fix */
.categories-widget .categories-list li {
  margin-bottom: 0.75rem !important;
}

.categories-widget .categories-list li:last-child {
  margin-bottom: 0 !important;
}

/* TOC specific clean */
.toc-widget #toc-container,
.toc-widget #toc-container ul,
.toc-widget #toc-container li {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
}

.toc-widget #toc-container li::before {
  display: none !important;
  content: none !important;
}

/* Share widget buttons - ensure proper spacing */
.share-widget .share-buttons-widget {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Related posts widget - ensure spacing */
.related-posts-widget .related-posts-list li {
  margin-bottom: 1.25rem !important;
  padding-bottom: 1.25rem !important;
  border-bottom: 1px solid #f1f5f9 !important;
}

.related-posts-widget .related-posts-list li:last-child {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
  border-bottom: none !important;
}