/* Import Google Fonts - Poppins */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* Root vars for easy theming */
:root {
  --sebg-bg: #ffffff;
  --sebg-text: #374151;
  --sebg-muted: #6b7280;
  --sebg-primary: #c83e34;
  --sebg-primary-contrast: #000000;
  --sebg-border: #e5e7eb;
  --sebg-tag-bg: #f3f4f6;
  --sebg-hover: #f9fafb;
  --sebg-shadow: 0 1px 3px 0 rgba(200, 62, 52, 0.15), 0 1px 2px 0 rgba(200, 62, 52, 0.1);
  --sebg-shadow-lg: 0 10px 15px -3px rgba(200, 62, 52, 0.2), 0 4px 6px -2px rgba(200, 62, 52, 0.15);
  --sebg-transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  --sebg-transition-fast: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --sebg-transition-smooth: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  --sebg-transition-ultra: all 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --sebg-font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.sebg-blog-grid {
  display: block;
  font-family: var(--sebg-font);
}

/* Section Header */
.sebg-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 24px;
}

.sebg-section-title {
  font-size: 28px;
  font-weight: 600;
  color: var(--sebg-text);
  margin: 0;
  font-family: var(--sebg-font);
}

/* Search Section */
.sebg-search-section {
  flex-shrink: 0;
  position: relative;
}

.sebg-search-input {
  width: 400px;
  padding: 16px 20px;
  border: 1px solid var(--sebg-border);
  border-radius: 12px;
  font-size: 16px;
  font-family: var(--sebg-font);
  background: var(--sebg-bg);
  color: var(--sebg-text);
  transition: var(--sebg-transition);
}

.sebg-search-input::placeholder {
  color: var(--sebg-muted);
  transition: var(--sebg-transition-fast);
  font-family: var(--sebg-font);
}

.sebg-search-input:focus {
  outline: none;
  border-color: var(--sebg-primary);
  box-shadow: 0 0 0 3px rgba(200, 62, 52, 0.1);
  transform: translateY(-1px);
}

.sebg-search-input:focus::placeholder {
  opacity: 0.7;
  transform: translateX(4px);
}

/* Categories Section */
.sebg-categories-section {
  width: 100%;
  position: relative;
  overflow: hidden;
  margin-bottom: 32px;
  min-height: 40px; /* Prevent layout shift */
}

.sebg-categories-container {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  position: relative;
  transition: none; /* Remove transition to prevent jumping */
  max-height: 40px;
  overflow: hidden;
  will-change: auto; /* Remove will-change to prevent repaints */
}

.sebg-categories-container.expanded {
  max-height: none;
  overflow: visible;
}

.sebg-categories-container:not(.expanded) .sebg-filter:nth-child(n+10) {
  opacity: 0;
  transform: translateY(-20px) scale(0.85);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
  filter: blur(2px);
}

.sebg-categories-container.expanded .sebg-filter:nth-child(n+10) {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  position: static;
  visibility: visible;
  filter: blur(0);
}

/* Show all categories when expanded */
.sebg-categories-container.expanded .sebg-filter {
  display: inline-flex !important;
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
  pointer-events: auto !important;
  position: static !important;
  visibility: visible !important;
  filter: blur(0) !important;
}

/* Staggered animation for expanded filters with longer delays */
.sebg-categories-container.expanded .sebg-filter:nth-child(10) { transition-delay: 0ms; }
.sebg-categories-container.expanded .sebg-filter:nth-child(11) { transition-delay: 50ms; }
.sebg-categories-container.expanded .sebg-filter:nth-child(12) { transition-delay: 100ms; }
.sebg-categories-container.expanded .sebg-filter:nth-child(13) { transition-delay: 150ms; }
.sebg-categories-container.expanded .sebg-filter:nth-child(14) { transition-delay: 200ms; }
.sebg-categories-container.expanded .sebg-filter:nth-child(15) { transition-delay: 250ms; }
.sebg-categories-container.expanded .sebg-filter:nth-child(16) { transition-delay: 300ms; }
.sebg-categories-container.expanded .sebg-filter:nth-child(17) { transition-delay: 350ms; }
.sebg-categories-container.expanded .sebg-filter:nth-child(18) { transition-delay: 400ms; }

/* Ensure smooth transitions for all categories */
.sebg-categories-container .sebg-filter {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

/* Additional styling for expanded state */
.sebg-categories-container.expanded {
  padding-bottom: 16px;
  margin-bottom: -16px;
}

/* Ensure consistent spacing and prevent layout shifts */
.sebg-categories-section {
  contain: layout style;
}

/* Filter Buttons */
.sebg-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--sebg-font);
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
  border: 1px solid transparent;
  background: var(--sebg-tag-bg);
  color: var(--sebg-text);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
  will-change: auto;
}

.sebg-filter::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(200, 62, 52, 0.15), transparent);
  transition: var(--sebg-transition);
}

.sebg-filter:hover::before {
  left: 100%;
}

.sebg-filter::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(200, 62, 52, 0.1) 0%, transparent 70%);
  opacity: 0;
  transition: var(--sebg-transition-fast);
  pointer-events: none;
}

.sebg-filter:hover::after {
  opacity: 1;
}

.sebg-filter:hover {
  background: var(--sebg-primary);
  color: var(--sebg-primary-contrast);
  transform: translateY(-2px) scale(1.02);
  border-color: var(--sebg-primary);
}

.sebg-filter.is-active {
  background: var(--sebg-primary);
  color: var(--sebg-primary-contrast);
  border-color: var(--sebg-primary);
  transform: translateY(-1px) scale(1.01);
}

.sebg-filter:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(200, 62, 52, 0.3);
}

/* Grid containers */
.sebg-grid {
  gap: 24px;
}

/* Grid layout */
.sebg-grid--grid {
  display: grid;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .sebg-blog-grid.columns-2 .sebg-grid--grid { grid-template-columns: repeat(2, 1fr); }
  .sebg-blog-grid.columns-3 .sebg-grid--grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .sebg-blog-grid.columns-3 .sebg-grid--grid { grid-template-columns: repeat(3, 1fr); }
}

/* Masonry layout (CSS columns) */
.sebg-grid--masonry {
  column-count: 1;
  column-gap: 24px;
}
@media (min-width: 640px) {
  .sebg-blog-grid.columns-2 .sebg-grid--masonry { column-count: 2; }
  .sebg-blog-grid.columns-3 .sebg-grid--masonry { column-count: 2; }
}
@media (min-width: 1024px) {
  .sebg-blog-grid.columns-3 .sebg-grid--masonry { column-count: 3; }
}
.sebg-grid--masonry .sebg-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 24px;
  break-inside: avoid;
}

/* Card */
.sebg-card {
  border: 1px solid var(--sebg-border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--sebg-bg);
  display: flex;
  flex-direction: column;
  transition: var(--sebg-transition);
  box-shadow: var(--sebg-shadow);
  font-family: var(--sebg-font);
}

.sebg-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--sebg-shadow-lg);
  border-color: var(--sebg-primary);
}

.sebg-card__thumb {
  display: block;
  overflow: hidden;
}

.sebg-card__thumb img {
  width: 100%;
  height: auto;
  display: block;
  transition: var(--sebg-transition);
}

.sebg-card:hover .sebg-card__thumb img {
  transform: scale(1.05);
}

.sebg-card__body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  font-family: var(--sebg-font);
}

.sebg-card__taxonomies {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.sebg-card__tag {
  background: var(--sebg-tag-bg);
  color: var(--sebg-text);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--sebg-font);
  padding: 4px 10px;
  transition: var(--sebg-transition-fast);
}

.sebg-card__tag:hover,
.sebg-card .sebg-card__tag:hover,
.sebg-blog-grid .sebg-card__tag:hover,
.sebg-card__taxonomies .sebg-card__tag:hover {
  background: #c83e34 !important;
  background-color: #c83e34 !important;
  color: #000000 !important;
  transform: translateY(-1px);
}

.sebg-card__title {
  font-size: 18px;
  font-weight: 600;
  font-family: var(--sebg-font);
  margin: 0 0 12px 0;
  line-height: 1.4;
  color: var(--sebg-text);
}

.sebg-card__title a { 
  color: inherit; 
  text-decoration: none; 
  transition: var(--sebg-transition-fast);
  font-family: var(--sebg-font);
  border-bottom: none;
}

.sebg-card__title a:hover { 
  color: var(--sebg-primary);
  text-decoration: none;
  border-bottom: none;
}

.sebg-card__excerpt {
  color: var(--sebg-muted);
  margin: 0 0 16px 0;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  font-family: var(--sebg-font);
  font-weight: 400;
}

.sebg-card__date {
  color: var(--sebg-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--sebg-font);
  margin-top: auto;
}

/* Infinite loader */
.sebg-infinite-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 0;
  color: var(--sebg-muted);
  font-family: var(--sebg-font);
}

.sebg-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--sebg-border);
  border-top-color: var(--sebg-primary);
  border-radius: 50%;
  animation: sebg-spin 0.8s linear infinite;
}

@keyframes sebg-spin {
  to { transform: rotate(360deg); }
}

/* Card Meta Section */
.sebg-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--sebg-border);
}

.sebg-card__author {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sebg-card__avatar {
  width: 24px;
  height: 24px;
  border-radius: 50px !important;
  object-fit: cover;
}

.sebg-card__author-name {
  color: var(--sebg-text);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--sebg-font);
}

.sebg-card__separator {
  color: var(--sebg-muted);
  font-size: 12px;
  font-weight: 400;
}

.sebg-card__date {
  color: var(--sebg-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--sebg-font);
  margin-top: 0;
}

/* Load more */
.sebg-load-more-wrap { 
  text-align: center; 
  margin-top: 32px; 
}

.sebg-load-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  border: 1px solid var(--sebg-border);
  background: var(--sebg-bg);
  color: var(--sebg-text);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--sebg-font);
  cursor: pointer;
  transition: var(--sebg-transition);
  box-shadow: var(--sebg-shadow);
  position: relative;
  overflow: hidden;
}

.sebg-load-more::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(200, 62, 52, 0.1), transparent);
  transition: var(--sebg-transition);
}

.sebg-load-more:hover::before {
  left: 100%;
}

.sebg-load-more:hover {
  border-color: var(--sebg-primary);
  background: var(--sebg-primary);
  color: var(--sebg-primary-contrast);
  transform: translateY(-2px);
  box-shadow: var(--sebg-shadow-lg);
}

.sebg-load-more.is-loading { 
  opacity: 0.6; 
  pointer-events: none; 
}

/* Loading state */
.sebg-blog-grid.is-loading { 
  opacity: 0.8; 
}

/* No posts */
.sebg-no-posts { 
  color: var(--sebg-muted); 
  text-align: center; 
  padding: 48px 24px;
  font-size: 16px;
  font-family: var(--sebg-font);
}

/* Responsive Design */
@media (max-width: 768px) {
  .sebg-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .sebg-section-title {
    font-size: 24px;
  }
  
  .sebg-search-section {
    width: 100%;
  }
  
  .sebg-search-input {
    width: 100%;
  }
  
  .sebg-categories-container {
    justify-content: flex-start;
  }
  
  .sebg-filter {
    font-size: 13px;
    padding: 6px 12px;
  }

  /* Horizontal scroll for filters - show all categories */
  .sebg-categories-section {
    overflow: visible;
  }
  .sebg-categories-container {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    max-height: none;
    height: auto;
    gap: 16px;
    -webkit-overflow-scrolling: touch;
  }
  .sebg-categories-container .sebg-filter {
    flex: 0 0 auto;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
    position: static !important;
    visibility: visible !important;
    filter: none !important;
    display: inline-flex !important;
  }
  /* Remove all hiding rules for mobile */
  .sebg-categories-container:not(.expanded) .sebg-filter:nth-child(n+10),
  .sebg-categories-container .sebg-filter:nth-child(n+10) {
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
    position: static !important;
    visibility: visible !important;
    filter: none !important;
    display: inline-flex !important;
  }
}

@media (max-width: 480px) {
  .sebg-section-header {
    gap: 12px;
  }
  
  .sebg-section-title {
    font-size: 20px;
  }
  
  .sebg-categories-container {
    gap: 6px;
  }
  
  .sebg-filter {
    font-size: 12px;
    padding: 5px 10px;
  }
} 