/* ============================================================
   BLOGS PAGE STYLES
   Learning Hub - Community UI
   ============================================================ */

/* Main Container - 25% + 75% */
.blogs-main-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 40px 24px;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 25% 75%;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1200px) {
  .blogs-main-container {
    grid-template-columns: 1fr;
  }
}

/* Left Sidebar - 25% */
.blogs-sidebar {
  position: sticky;
  top: 20px;
  height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
}

.sidebar-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .sidebar-card {
  background: #1f2937;
  border-color: #374151;
}

.sidebar-content {
  padding: 16px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-content::-webkit-scrollbar {
  width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 10px;
}

[data-theme="dark"] .sidebar-content::-webkit-scrollbar-thumb {
  background: #374151;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 12px 0;
}

[data-theme="dark"] .sidebar-section-title {
  color: #9ca3af;
}

.sidebar-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 16px 0;
}

[data-theme="dark"] .sidebar-divider {
  background: #374151;
}

/* Mobile Authors & Tags panel — hidden on desktop, only visible on mobile via JS */
.blog-mobile-authors-panel {
  display: none;
}

/* Categories Filter Container (Right Side) */
.categories-filter-container {
  margin-bottom: 24px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .categories-filter-container {
  background: #1f2937;
  border-color: #374151;
}

.categories-filter-label {
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

[data-theme="dark"] .categories-filter-label {
  color: #9ca3af;
}

.categories-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Categories List (for sidebar - keeping for backwards compatibility if needed) */
.categories-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.category-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}

[data-theme="dark"] .category-item {
  background: #111827;
  border-color: #374151;
  color: #f9fafb;
}

[data-theme="dark"] .category-item {
  background: #111827;
  border-color: #374151;
}

.category-item:hover {
  border-color: #7c3aed;
  background: #f5f3ff;
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.2);
}

[data-theme="dark"] .category-item:hover {
  background: #2d1b4e;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.category-item.active {
  border-color: #7c3aed;
  background: #7c3aed;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

[data-theme="dark"] .category-item.active {
  background: #8b5cf6;
  border-color: #8b5cf6;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

.category-item-name {
  font-size: 13px;
  font-weight: 600;
}

.category-item.active .category-item-name {
  color: #ffffff;
}

.category-item-count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
}

.category-item.active .category-item-count {
  background: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

/* Tags List */
.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-item {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}

[data-theme="dark"] .tag-item {
  background: #111827;
  border-color: #374151;
  color: #9ca3af;
}

.tag-item:hover {
  border-color: #7c3aed;
  background: #f5f3ff;
  color: #7c3aed;
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.2);
}

[data-theme="dark"] .tag-item:hover {
  background: #2d1b4e;
  color: #8b5cf6;
}

.tag-item.active {
  border-color: #7c3aed;
  background: #7c3aed;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

[data-theme="dark"] .tag-item.active {
  background: #8b5cf6;
  border-color: #8b5cf6;
}

/* Authors List */
.authors-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.author-card {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .author-card {
  background: #1f2937;
  border-color: #374151;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.author-card:hover {
  border-color: #7c3aed;
  background: #f5f3ff;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
  transform: translateY(-2px);
}

[data-theme="dark"] .author-card:hover {
  background: #2d1b4e;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.author-card.active {
  border-color: #7c3aed;
  background: #f5f3ff;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}

[data-theme="dark"] .author-card.active {
  background: #2d1b4e;
  border-color: #7c3aed;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.35);
}

.author-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.author-avatar {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  border: 2px solid #e5e7eb;
  background: linear-gradient(135deg, #f5f3ff 0%, #e9d5ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: #7c3aed;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.15);
}

[data-theme="dark"] .author-avatar {
  background: linear-gradient(135deg, #2d1b4e 0%, #4c1d95 100%);
  border-color: #374151;
  color: #8b5cf6;
  box-shadow: 0 2px 6px rgba(139, 92, 246, 0.25);
}

.author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.author-info {
  flex: 1;
  min-width: 0;
}

.author-name {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 3px 0;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="dark"] .author-name {
  color: #f9fafb;
}

.author-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.author-badge.verified {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #0284c7;
}

[data-theme="dark"] .author-badge.verified {
  background: #1e3a8a;
  border-color: #3b82f6;
  color: #93c5fd;
}

.author-badge.associate {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #d97706;
}

[data-theme="dark"] .author-badge.associate {
  background: #78350f;
  border-color: #fbbf24;
  color: #fde68a;
}

.author-badge.other {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  color: #6b7280;
}

[data-theme="dark"] .author-badge.other {
  background: #111827;
  border-color: #374151;
  color: #9ca3af;
}

.author-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
  font-size: 11px;
  color: #6b7280;
  font-weight: 500;
}

[data-theme="dark"] .author-stats {
  border-top-color: #374151;
  color: #9ca3af;
}

.author-stat-item {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
}

.author-stat-item svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.author-stat-count {
  font-weight: 600;
  color: #111827;
}

[data-theme="dark"] .author-stat-count {
  color: #f9fafb;
}

/* Right Content - 66% */
.blogs-content {
  min-width: 0;
}

.blogs-header {
  margin-bottom: 24px;
}

.blogs-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 8px 0;
  letter-spacing: -0.02em;
}

[data-theme="dark"] .blogs-header h1 {
  color: #f9fafb;
}

.blogs-header p {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
  margin: 0;
}

[data-theme="dark"] .blogs-header p {
  color: #9ca3af;
}

/* Blogs List */
.blogs-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

/* Blog Card */
.blog-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: all 0.2s ease;
  cursor: pointer;
  display: flex;
  gap: 20px;
  padding: 20px;
}

[data-theme="dark"] .blog-card {
  background: #1f2937;
  border-color: #374151;
}

.blog-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: #7c3aed;
}

[data-theme="dark"] .blog-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.blog-card-image-container {
  flex-shrink: 0;
  width: 200px;
  height: 150px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

[data-theme="dark"] .blog-card-image-container {
  border-color: #374151;
  background: #111827;
}

.blog-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.blog-card-title {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

[data-theme="dark"] .blog-card-title {
  color: #f9fafb;
}

.blog-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

[data-theme="dark"] .blog-card-meta {
  color: #9ca3af;
}

.blog-card-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.blog-card-meta-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.blog-card-description {
  color: #6b7280;
  font-size: 14px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

[data-theme="dark"] .blog-card-description {
  color: #9ca3af;
}

.blog-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.blog-tag {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  transition: all 0.2s ease;
}

[data-theme="dark"] .blog-tag {
  background: #111827;
  border-color: #374151;
  color: #9ca3af;
}

.blog-tag:hover {
  border-color: #7c3aed;
  background: #f5f3ff;
  color: #7c3aed;
}

[data-theme="dark"] .blog-tag:hover {
  background: #2d1b4e;
  color: #8b5cf6;
}

/* View Blog Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: slideUp 0.3s ease;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

[data-theme="dark"] .modal-content {
  background: #1f2937;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

[data-theme="dark"] .modal-header {
  border-bottom-color: #374151;
}

.modal-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  margin: 0;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
}

[data-theme="dark"] .modal-header h2 {
  color: #f9fafb;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

[data-theme="dark"] .modal-close {
  background: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}

.modal-close:hover {
  border-color: #ef4444;
  background: #fef2f2;
  color: #ef4444;
}

[data-theme="dark"] .modal-close:hover {
  background: #7f1d1d;
  border-color: #ef4444;
  color: #fca5a5;
}

.modal-body {
  padding: 32px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

[data-theme="dark"] .modal-body {
  color: #f9fafb;
}

.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 10px;
}

[data-theme="dark"] .modal-body::-webkit-scrollbar-thumb {
  background: #374151;
}

.view-blog-image {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 24px;
  border: 1px solid #e5e7eb;
}

[data-theme="dark"] .view-blog-image {
  border-color: #374151;
}

.view-blog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
}

[data-theme="dark"] .view-blog-meta {
  border-bottom-color: #374151;
  color: #9ca3af;
}

.view-blog-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.view-blog-meta-item svg {
  width: 16px;
  height: 16px;
}

.view-blog-content {
  font-size: 16px;
  line-height: 1.7;
  color: #111827;
}

[data-theme="dark"] .view-blog-content {
  color: #f9fafb;
}

.view-blog-content h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 32px 0 16px 0;
  color: #111827;
  line-height: 1.3;
}

[data-theme="dark"] .view-blog-content h2 {
  color: #f9fafb;
}

.view-blog-content h2:first-child {
  margin-top: 0;
}

.view-blog-content h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 24px 0 12px 0;
  color: #111827;
}

[data-theme="dark"] .view-blog-content h3 {
  color: #f9fafb;
}

.view-blog-content p {
  margin: 0 0 16px 0;
}

.view-blog-content ul,
.view-blog-content ol {
  margin: 16px 0;
  padding-left: 24px;
}

.view-blog-content li {
  margin: 8px 0;
}

.view-blog-content strong {
  font-weight: 600;
  color: #111827;
}

[data-theme="dark"] .view-blog-content strong {
  color: #f9fafb;
}

.view-blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
}

[data-theme="dark"] .view-blog-tags {
  border-top-color: #374151;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* Empty State */
.blogs-empty {
  text-align: center;
  padding: 60px 20px;
  color: #6b7280;
}

[data-theme="dark"] .blogs-empty {
  color: #9ca3af;
}

.blogs-empty svg {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  color: #d1d5db;
  opacity: 0.5;
}

[data-theme="dark"] .blogs-empty svg {
  color: #4b5563;
}

.blogs-empty h3 {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 8px 0;
}

[data-theme="dark"] .blogs-empty h3 {
  color: #f9fafb;
}

.blogs-empty p {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

[data-theme="dark"] .blogs-empty p {
  color: #9ca3af;
}

/* Responsive */
@media (max-width: 1200px) {
  .blogs-sidebar {
    position: static;
    max-height: none;
  }
  
  .blog-card {
    flex-direction: column;
  }
  
  .blog-card-image-container {
    width: 100%;
    height: 200px;
  }
}

@media (max-width: 768px) {
  .blogs-main-container {
    padding: 8px 10px;
    gap: 0;
  }
  
  /* Sidebar: hidden on mobile — content moved to inline panel via JS */
  .blogs-sidebar {
    display: none !important;
  }

  /* Mobile Authors & Tags panel: show on mobile, collapsed by default */
  .blog-mobile-authors-panel {
    display: block;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.25s ease;
    opacity: 0;
    padding: 0;
    margin: 0;
  }

  .blog-mobile-authors-panel.expanded {
    max-height: 2000px;
    opacity: 1;
    padding: 12px;
    margin-bottom: 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  }

  [data-theme="dark"] .blog-mobile-authors-panel.expanded {
    background: #1f2937;
    border-color: #374151;
  }

  /* Categories filter: no margin when collapsed */
  .categories-filter-container {
    margin-bottom: 0;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .categories-filter-container.expanded {
    padding: 12px;
    margin-bottom: 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  }

  [data-theme="dark"] .categories-filter-container.expanded {
    background: #1f2937;
    border-color: #374151;
  }

  .categories-filter-label {
    margin-bottom: 8px;
    font-size: 11px;
  }

  .blogs-header {
    margin-bottom: 10px !important;
  }
  
  .blogs-header h1 {
    font-size: 20px;
    margin-bottom: 2px !important;
  }

  .blogs-header p {
    font-size: 12px;
  }
  
  .blog-card {
    flex-direction: column;
    padding: 12px;
  }
  
  .blog-card-image-container {
    width: 100%;
    height: 180px;
  }
  
  .blog-card-title {
    font-size: 16px;
  }

  .blog-card-description {
    font-size: 13px;
    -webkit-line-clamp: 2;
  }

  .blog-card-meta {
    gap: 8px;
  }

  .blog-card-meta-item {
    font-size: 11px;
  }

  .blogs-list {
    gap: 12px;
  }
  
  .modal-content {
    margin: 10px;
    max-height: calc(100vh - 20px);
  }
  
  .modal-header {
    padding: 16px 20px;
  }
  
  .modal-header h2 {
    font-size: 20px;
  }
  
  .modal-body {
    padding: 24px;
  }
}

@media (max-width: 480px) {
  .blogs-main-container {
    padding: 6px 8px;
  }

  .blogs-header h1 {
    font-size: 18px;
  }

  .blogs-header p {
    font-size: 11px;
  }

  .blog-card {
    padding: 10px;
  }

  .blog-card-image-container {
    height: 150px;
  }

  .blog-card-title {
    font-size: 15px;
  }

  .blog-card-meta-item {
    font-size: 10px;
  }

  .blog-card-meta-item svg {
    width: 12px;
    height: 12px;
  }

  .blogs-list {
    gap: 10px;
  }

  .modal-content {
    margin: 4px;
  }

  .modal-header {
    padding: 12px 14px;
  }

  .modal-header h2 {
    font-size: 17px;
  }

  .modal-body {
    padding: 14px;
  }
}