/* Browse Page Styles */

#browse {
  max-width: 1400px;
  padding-top: 2rem;
  position: relative;
}

.browse-container {
  display: flex;
  gap: 4rem;
  align-items: flex-start;
  justify-content: center;
}

/* Filter Sidebar */
.filter-sidebar {
  position: sticky;
  top: 5rem;
  width: 280px;
  flex-shrink: 0;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
}

.filters {
  text-align: left;
  border: 1px solid #eee;
  padding: 1.5rem;
  background: #fafafa;
}

.filter-controls {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e5e5;
}

.filter-row-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.filter-row-inline:last-child {
  margin-bottom: 0;
}

.filter-row-inline label {
  font-size: 0.85rem;
  color: #666;
  font-weight: 500;
  white-space: nowrap;
}

.filter-row-inline select {
  flex: 1;
  padding: 0.4rem 0.6rem;
  border: 1px solid #ddd;
  border-radius: 0;
  font-family: inherit;
  font-size: 0.85rem;
  color: #333;
  background: #fff;
  cursor: pointer;
}

/* Filter Search */
.filter-search-block {
  position: relative;
  margin: 0 0 1.2rem 0;
}

.filter-search {
  width: 100%;
  padding: 0.4rem 0.6rem 0.4rem 1.6rem;
  border: 1px solid #ddd;
  border-radius: 0;
  font-family: inherit;
  font-size: 0.85rem;
  color: #333;
  background: #fff;
  box-sizing: border-box;
}

.filter-search::placeholder {
  color: #aaa;
}

.filter-search-icon {
  position: absolute;
  top: 50%;
  left: 0.5rem;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: #aaa;
  pointer-events: none;
}

/* Filter Categories */
.filter-category {
  margin-bottom: 1rem;
}

.filter-category:last-of-type {
  margin-bottom: 0;
}

.filter-category-header {
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-bottom: 0.4rem;
}

.filter-category h3 {
  font-size: 0.8rem;
  font-weight: 500;
  color: #666;
  margin: 0;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.category-toggle {
  background: none;
  border: none;
  color: #999;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.2rem;
  transition: all 0.2s ease;
  line-height: 1;
}

.category-toggle:hover {
  color: #333;
}

.filter-category-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.filter-category-content.expanded {
  max-height: 500px;
}

.filter-hint {
  font-size: 0.7rem;
  font-weight: 400;
  color: #999;
  text-transform: none;
  letter-spacing: 0;
  font-style: italic;
}

/* Tag Filter Buttons */
.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
}

.tag-btn {
  padding: 0.4rem 0.8rem;
  border: 1px solid #ddd;
  background: #fff;
  color: #333;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 0;
}

.tag-btn:hover {
  background: #fafafa;
  border-color: #333;
}

.tag-btn.active {
  background: #111;
  color: #fff;
  border-color: #111;
}

.tag-count {
  color: #bbb;
}

.clear-btn {
  padding: 0.4rem 0.8rem;
  border: 1px solid #333;
  background: #fff;
  color: #333;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 0.5rem;
  border-radius: 0;
}

.clear-btn:hover {
  background: #111;
  color: #fff;
}

.no-tags {
  font-size: 0.85rem;
  color: #999;
  font-style: italic;
}

/* Main Content */
.main-content {
  flex: 1;
  min-width: 0;
  max-width: 800px;
}

.main-content-spacer {
  width: 280px;
  flex-shrink: 0;
}

/* Info Sidebar (right side) */
.info-sidebar {
  position: sticky;
  top: 5rem;
  width: 220px;
  flex-shrink: 0;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
}

.info-box {
  text-align: left;
  border: 1px solid #eee;
  padding: 1.25rem;
  background: #fafafa;
}

.info-box h3 {
  font-size: 0.9rem;
  font-weight: 500;
  color: #333;
  margin: 0 0 0.75rem 0;
  font-style: normal;
}

.info-box p {
  font-size: 0.85rem;
  color: #666;
  line-height: 1.6;
  margin: 0 0 0.75rem 0;
}

.info-box p:last-child {
  margin-bottom: 0;
}

.info-box a {
  color: #666;
  text-decoration: none;
  border-bottom: 1px dotted #999;
  transition: opacity 0.2s ease;
}

.info-box a:hover {
  opacity: 0.6;
}

/* Story Feed */
.story-feed {
  max-width: 800px;
}

.story-card {
  border-top: 1px solid #eee;
  padding: 2rem 0;
  text-align: left;
}

.story-card:first-child {
  border-top: none;
}

.story-title {
  font-size: 1.3rem;
  font-weight: 400;
  margin: 0 0 0.3rem 0;
  color: #111;
}

.story-author {
  font-size: 0.9rem;
  color: #666;
  margin: 0 0 0.5rem 0;
  font-style: normal;
}

.author-link {
  color: #666;
  text-decoration: none;
  border-bottom: 1px dotted #999;
  transition: opacity 0.2s ease;
}

.author-link:hover {
  opacity: 0.6;
}

.story-meta {
  font-size: 0.85rem;
  color: #999;
  margin-bottom: 0.3rem;
}

.story-meta strong {
  color: #666;
  font-weight: 600;
}

.story-meta-secondary {
  margin-bottom: 0.3rem;
}

.story-meta-date {
  font-size: 0.8rem;
  color: #aaa;
  margin-bottom: 0;
}

.story-description {
  font-size: 0.95rem;
  color: #333;
  line-height: 1.6;
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  border-left: 2px solid #eee;
}

.story-excerpt {
  font-size: 0.95rem;
  color: #333;
  line-height: 1.6;
  margin-bottom: 1rem;
  font-style: italic;
}

/* Tag type variations */
.story-tag-theme {
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
  color: #666;
  font-style: italic;
}

.story-tag-custom {
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
  color: #666;
  font-weight: 500;
}

.story-tag-trope {
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
  color: #666;
}

.story-tag-warning {
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
  color: #666;
}

.story-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.story-stats {
  font-size: 0.8rem;
  color: #999;
}

.read-more-link {
  font-size: 0.9rem;
  color: #333;
  text-decoration: none;
  border-bottom: 1px solid #333;
  transition: opacity 0.2s ease;
}

.read-more-link:hover {
  opacity: 0.6;
}

/* Filter Toggle Button (mobile only) */
.filter-toggle {
  display: none;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid #ddd;
  background: #fff;
  color: #666;
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  margin-bottom: 0.5rem;
}

.filter-toggle:hover {
  background: #fafafa;
  border-color: #999;
}

.filter-toggle.active {
  background: #333;
  color: #fff;
  border-color: #333;
}

.filter-toggle-icon {
  font-size: 0.8rem;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 99;
}

.sidebar-overlay.visible {
  display: block;
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
  .filter-toggle {
    display: flex;
  }

  .filter-sidebar {
    position: fixed;
    top: 3.5rem;
    left: 0;
    bottom: 0;
    width: 280px;
    height: auto;
    max-height: none;
    z-index: 100;
    background: #fff;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    padding-top: 0;
    transition: transform 0.3s ease;
    transform: translateX(0);
    overflow-y: auto;
  }

  .filter-sidebar.collapsed {
    transform: translateX(-100%);
  }

  .filter-sidebar .filters {
    height: 100%;
    overflow-y: auto;
    padding-bottom: 2rem;
    box-sizing: border-box;
  }

  .browse-container {
    display: block;
  }

  .main-content {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
  }

  .main-content-spacer {
    display: none;
  }

  .info-sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  #browse {
    padding-top: 0.5rem;
  }

  .filter-toggle {
    margin-top: 0.5rem;
  }

  .filter-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
  }

  .story-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .story-feed {
    max-width: 100%;
  }

  .story-card {
    padding: 1.25rem 0;
  }
}
