/* Widget Components */

/* Popular Tags Widget */
.popular-tags-widget {
  margin: 2rem 0;
  padding: 1.5rem 0;
  border-top: 1px solid var(--color-border);
}

.popular-tags-widget h3 {
  margin: 0 0 1rem 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-bubble {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  text-decoration: none;
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  transition: all 0.2s;
}

.tag-bubble:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

.tag-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.5rem;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: var(--weight-semibold);
}

.tag-bubble:hover .tag-count {
  background: var(--color-text-inverse);
  color: var(--color-primary);
}

/* Random Posts Widget */
.random-posts-widget {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.random-posts-widget h3 {
  margin: 0 0 1rem 0;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.random-posts-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.random-post-item {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.random-post-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.random-post-item h4 {
  margin: 0 0 0.25rem 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1.4;
}

.random-post-item h4 a {
  color: var(--color-text-primary);
  text-decoration: none;
}

.random-post-item h4 a:hover {
  color: var(--color-primary);
}

.random-post-item time {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

/* Section Navigation */
.section-navigation {
  margin: 2rem 0;
}

.section-stats {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--color-primary);
}

.section-stats .stat {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.section-stats strong {
  display: block;
  font-size: var(--text-2xl);
  color: var(--color-primary);
  font-weight: var(--weight-bold);
}

.subsections h2 {
  margin: 0 0 1rem 0;
  font-size: var(--type-h2);
  font-weight: var(--weight-semibold);
}

.subsection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* Force single column on very small screens */
@media (max-width: 399px) {
  .subsection-grid {
    grid-template-columns: 1fr;
  }
}

/* Additional breakpoint for very small screens */
@media (max-width: 399px) {
  .section-stats {
    gap: 0.75rem;
  }
}

.subsection-card {
  padding: 1.5rem;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: all 0.2s;
}

.subsection-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.subsection-card h3 {
  margin: 0 0 0.5rem 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
}

.subsection-card h3 a {
  color: var(--color-text-primary);
  text-decoration: none;
}

.subsection-card h3 a:hover {
  color: var(--color-primary);
}

.subsection-card p {
  margin: 0 0 0.5rem 0;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.subsection-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: var(--weight-medium);
}

/* Featured Posts Section */
.featured-posts {
  margin-bottom: 3rem;
}

.section-subtitle {
  margin: 0 0 1.5rem 0;
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-primary);
}

.archive-list-featured {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

/* Child Items (compact row-based layout) */
.child-items {
  margin: 2.5rem 0;
}

.child-items-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.child-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-primary);
  transition: all 0.2s;
}

.child-item:last-child {
  border-bottom: none;
}

.child-item:hover {
  background: var(--color-bg-secondary);
  border-left: 3px solid var(--color-primary);
  padding-left: calc(1rem - 3px);
}

.child-item-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--color-primary);
  opacity: 0.6;
  transition: opacity 0.2s;
}

.child-item:hover .child-item-icon {
  opacity: 0.9;
}

.child-item-content {
  flex: 1;
  min-width: 0;
}

.child-item-title {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
}

.child-item-title a {
  color: var(--color-text-primary);
  text-decoration: none;
  transition: color 0.2s;
}

.child-item-title a:hover {
  color: var(--color-primary);
}

.child-item-description {
  display: none;
}

.child-item-meta {
  display: inline-flex;
  margin-left: 0.5rem;
  gap: 0.5rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.child-item-meta .meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.375rem;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
  font-weight: var(--weight-medium);
  font-size: 0.6875rem;
}

/* ==========================================================================
   Content Tiles Component (Enhanced)
   Flexible content display with multiple variants
   ========================================================================== */

/* Base container */
.content-tiles {
  margin: 2.5rem 0;
}

/* Section header */
.content-tiles-title {
  margin: 0 0 1rem 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.content-tiles-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 1.25em;
  background: var(--color-primary);
  border-radius: 2px;
}

/* Group header (for grouped mode) */
.content-tiles-group-header {
  padding: 0.5rem 1rem;
  background: var(--color-bg-tertiary);
  border-bottom: 1px solid var(--color-border);
}

.content-tiles-group-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Compact variant (default) - row-based list */
.content-tiles--compact .content-tiles-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.content-tile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-primary);
  transition: all 0.2s;
}

.content-tile:last-child {
  border-bottom: none;
}

.content-tile:hover {
  background: var(--color-bg-secondary);
  border-left: 3px solid var(--color-primary);
  padding-left: calc(1rem - 3px);
}

/* Related item styling */
.content-tile--related {
  background: var(--color-bg-secondary);
}

.content-tile--related:hover {
  border-left-color: var(--color-accent, var(--color-primary));
}

.content-tile-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--color-primary);
  opacity: 0.6;
  transition: opacity 0.2s;
}

.content-tile--related .content-tile-icon {
  color: var(--color-accent, var(--color-text-muted));
}

.content-tile:hover .content-tile-icon {
  opacity: 0.9;
}

.content-tile-content {
  flex: 1;
  min-width: 0;
}

.content-tile-title {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
}

.content-tile-title a {
  color: var(--color-text-primary);
  text-decoration: none;
  transition: color 0.2s;
}

.content-tile-title a:hover {
  color: var(--color-primary);
}

.content-tile-description {
  display: none;
}

.content-tile-meta {
  display: inline-flex;
  margin-left: 0.5rem;
  gap: 0.5rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.content-tile-meta .meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.375rem;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
  font-weight: var(--weight-medium);
  font-size: 0.6875rem;
}

/* Badge for related items */
.content-tile-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  background: var(--color-accent-bg, var(--color-bg-tertiary));
  color: var(--color-accent, var(--color-text-secondary));
  border-radius: var(--radius-sm);
  font-size: 0.625rem;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Cards variant - grid of preview cards */
.content-tiles--cards .content-tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.content-tile-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: all 0.2s;
}

.content-tile-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.content-tile-card--related {
  background: var(--color-bg-secondary);
  border-style: dashed;
}

.content-tile-card-icon {
  width: 32px;
  height: 32px;
  margin-bottom: 0.75rem;
  color: var(--color-primary);
  opacity: 0.7;
}

.content-tile-card--related .content-tile-card-icon {
  color: var(--color-accent, var(--color-text-muted));
}

.content-tile-card-title {
  margin: 0 0 0.5rem 0;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: 1.3;
}

.content-tile-card-title a {
  color: var(--color-text-primary);
  text-decoration: none;
}

.content-tile-card-title a:hover {
  color: var(--color-primary);
}

.content-tile-card-description {
  flex: 1;
  margin: 0 0 0.75rem 0;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.content-tile-card-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Minimal variant - simple link list */
.content-tiles--minimal .content-tiles-minimal {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.content-tiles--minimal li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

.content-tiles--minimal li::before {
  content: '→';
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.content-tiles--minimal a {
  color: var(--color-text-primary);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: color 0.2s;
}

.content-tiles--minimal a:hover {
  color: var(--color-primary);
}

.content-tiles--minimal .content-tile--related::before {
  content: '↗';
  color: var(--color-accent, var(--color-text-muted));
}

/* Responsive */
@media (max-width: 768px) {
  .section-stats {
    flex-direction: column;
    gap: 1rem;
  }

  .subsection-grid {
    grid-template-columns: 1fr;
  }

  .archive-list-featured {
    grid-template-columns: 1fr;
  }

  .tag-cloud {
    gap: 0.375rem;
  }

  .tag-bubble {
    font-size: 0.8125rem;
    padding: 0.375rem 0.75rem;
  }

  .content-tiles--cards .content-tiles-grid {
    grid-template-columns: 1fr;
  }

  .content-tiles-title {
    font-size: var(--text-base);
  }
}
