/* Browse Rail Page Styles */

/* Page Header */
.browse-page-header {
  background: color-mix(in srgb, var(--cat, #8B5CF6) 92%, transparent);
  color: white;
  padding: 2rem 1rem;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.browse-page-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('/images/patterns/scribble-bg.png') center center repeat;
  background-size: 30%; /* ~70% smaller pattern on desktop */
  opacity: 0.14; /* a bit more transparent */
  z-index: 1;
}

.browse-page-content {
  max-width: 1200px;
  width: 100%;
  position: relative;
  z-index: 2;
}

.language-dropdown-header-container {
  margin-bottom: 1rem;
  text-align: right;
  z-index: 9999;
  position: relative;
}

.language-dropdown-header-container .language-dropdown .dropdown-toggle {
  color: white !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
}

.language-dropdown-header-container .language-dropdown .dropdown-toggle:hover {
  background-color: rgba(255, 255, 255, 0.2) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
}

.language-dropdown-header-container .language-dropdown .dropdown-menu {
  position: fixed !important;
  z-index: 2147483647 !important;
  transform: none !important;
}

.header-text-content {
  text-align: center;
}

.category-hero-wrap { display:flex; justify-content:center; margin-bottom: 0.75rem; }
.category-hero { max-width: 55vw; max-height: 50vh; opacity: 0.92; }

.page-title {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  text-shadow: none;
}

.page-subtitle {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  opacity: 0.9;
  font-weight: 300;
}

.content-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1rem;
  opacity: 0.8;
}

.stat-item {
  font-weight: 500;
}

.stat-separator {
  opacity: 0.6;
}

/* Filters Section */
.filters-container {
  background: #f8f9fa;
  border-bottom: 2px solid #e9ecef;
  padding: 1.5rem 1rem;
  position: relative; /* Remove sticky positioning for desktop */
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.filters-content {
  max-width: 1200px;
  margin: 0 auto;
}

.filters-row {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.filter-label {
  font-weight: 600;
  color: #495057;
  margin: 0;
  white-space: nowrap;
}

.age-band-filters {
  display: flex;
  gap: 0.5rem;
}

.age-band-btn {
  padding: 0.5rem 1rem;
  border: 2px solid #dee2e6;
  background: white;
  border-radius: 25px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #495057;
}

.age-band-btn:hover {
  border-color: #667eea;
  color: #667eea;
  transform: translateY(-1px);
}

.age-band-btn.active {
  background: #667eea;
  border-color: #667eea;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

/* Search functionality removed as requested */

.sort-controls {
  display: flex;
  align-items: center;
}

.sort-select {
  padding: 0.5rem 2rem 0.5rem 1rem;
  border: 2px solid #dee2e6;
  border-radius: 25px;
  background: white;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1rem;
}

.sort-select:hover {
  border-color: #667eea;
}

.sort-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.tags-filter-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tags-container {
  display: flex;
  gap: 0.5rem;
  flex: 1;
}

.tags-scroll-container {
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  scrollbar-width: thin;
  scrollbar-color: #dee2e6 transparent;
  padding-bottom: 0.5rem;
}

.tags-scroll-container::-webkit-scrollbar {
  height: 6px;
}

.tags-scroll-container::-webkit-scrollbar-track {
  background: transparent;
}

.tags-scroll-container::-webkit-scrollbar-thumb {
  background: #dee2e6;
  border-radius: 3px;
}

.tags-scroll-container::-webkit-scrollbar-thumb:hover {
  background: #adb5bd;
}

.tag-btn {
  padding: 0.25rem 0.75rem;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 15px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #6c757d;
  flex-shrink: 0; /* Prevent shrinking in horizontal scroll */
  white-space: nowrap; /* Keep text on one line */
}

.tag-btn:hover {
  border-color: #667eea;
  color: #667eea;
}

.tag-btn.active {
  background: #667eea;
  border-color: #667eea;
  color: white;
}

.show-more-tags {
  color: #667eea !important;
  border-color: #667eea !important;
}

/* Content Grid */
.content-grid-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 1rem 10px; /* row 1rem, column 10px */
  margin-bottom: 2rem;
}

.content-item {
  opacity: 1;
  transition: opacity 0.3s ease;
}

.content-card {
  display: block;
  background: transparent;
  border-radius: 12px;
  box-shadow: none;
  border: none;
  overflow: hidden;
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  height: auto;
  position: relative;
  aspect-ratio: 1 / 1; /* square cards */
}

.content-card:hover {
  transform: none;
  box-shadow: none;
  text-decoration: none;
  color: inherit;
}

.content-image-container {
  position: relative;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
}

.content-image {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  margin: auto;
  width: 200px;
  height: 200px;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.content-card:hover .content-image {
  transform: scale(1.05);
}

.placeholder-image {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: #dee2e6;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.content-type-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 0.25rem 0.75rem;
  border-radius: 15px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.browse-rail-page .content-type-badge { background: var(--cat, #8B5CF6) !important; }
.category-blob {
  position: absolute;
  inset: 10px 0 0 0;
  width: 100%;
  height: calc(100% - 10px);
  background-color: var(--cat, #8B5CF6);
  -webkit-mask: var(--blob) no-repeat center / 100% auto;
  mask: var(--blob) no-repeat center / 100% auto;
  opacity: 0.1;
}

.category-name-chip {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  background: var(--cat, #8B5CF6);
  border-radius: 8px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.15);
  font-weight: 400;
  padding: 4px 8px;
}

.content-type-badge.biography { background: #e74c3c; }
.content-type-badge.place { background: #2ecc71; }
.content-type-badge.event { background: #f39c12; }
.content-type-badge.invention { background: #9b59b6; }
.content-type-badge.concept { background: #3498db; }
.content-type-badge.myth { background: #e67e22; }
.content-type-badge.creations { background: #8e44ad; } /* Purple for creations/artworks */
.content-type-badge.artwork { background: #8e44ad; } /* Same color for artwork alias */

/* Age band tags at bottom of cards */
.age-band-tags {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.age-band-tag-bottom {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  background: #343a40;
  border: none;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  text-decoration: none;
  transition: all 0.2s ease;
}

.age-band-tag-bottom:hover {
  background: #495057;
  transform: translateY(-1px);
}

.content-info {
  padding: 1.25rem;
}

.content-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.3;
  color: #212529;
}

.content-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #6c757d;
  margin-bottom: 0.75rem;
}

.entity-name {
  font-weight: 600;
  color: #495057;
}

.content-subtitle {
  font-size: 0.9rem;
  color: #6c757d;
  font-style: italic;
}

.meta-separator {
  opacity: 0.5;
}

.categories {
  font-style: italic;
}

.content-summary {
  font-size: 0.875rem;
  line-height: 1.4;
  color: #6c757d;
  margin: 0;
}

/* Pagination */
.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid #e9ecef;
}

.pagination-info {
  font-size: 0.875rem;
  color: #6c757d;
}

.pagination-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.page-btn {
  padding: 0.5rem 1rem;
  background: white;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  text-decoration: none;
  color: #495057;
  font-weight: 500;
  transition: all 0.2s ease;
}

.page-btn:hover {
  border-color: #667eea;
  color: #667eea;
  text-decoration: none;
  transform: translateY(-1px);
}

.page-btn.active {
  background: #667eea;
  border-color: #667eea;
  color: white;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #6c757d;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: #495057;
}

.empty-state p {
  margin-bottom: 1.5rem;
}

.clear-filters-btn {
  padding: 0.75rem 1.5rem;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 25px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-filters-btn:hover {
  background: #5a6fd8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Sort toggle (app parity) */
.sort-toggle { display:flex; justify-content:center; margin: 10px 0 20px; }
.sort { width: 30%; max-width: 560px; margin: 0 auto; padding: 2.5px; border-radius: 20px; background: rgba(255,255,255,.95); box-shadow: 0 2px 8px rgba(0,0,0,.1); display:flex; gap:2px; }
.sort > button { flex:1; height:30px; border-radius:16px; border:0; background:transparent; font-size:14px; font-weight:500; color:#6b7280; }
.sort > button[aria-pressed="true"] { background: var(--cat, #8B5CF6); color:#fff; font-weight:500; }


/* Responsive Design */
@media (max-width: 1200px) {
  .content-image { width: 130px; height: 130px; }
}
@media (max-width: 768px) {
  .page-title {
    font-size: 2rem;
  }
  
  .page-subtitle {
    font-size: 1rem;
  }
  
  .content-stats {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  /* Mobile: Remove sticky positioning and make filters collapsible */
  .filters-container {
    position: relative;
    top: auto;
    box-shadow: none;
    padding: 1rem;
  }
  
  .filters-content {
    position: relative;
  }
  
  /* Mobile filter toggle */
  .mobile-filter-toggle {
    display: flex !important; /* Override desktop display: none */
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: #667eea;
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 1rem;
  }
  
  .mobile-filter-toggle i {
    transition: transform 0.3s ease;
  }
  
  .mobile-filter-toggle.expanded i {
    transform: rotate(180deg);
  }
  
  .mobile-filters-content {
    display: none !important; /* Hidden by default on mobile */
    overflow: hidden;
  }
  
  .mobile-filters-content.expanded {
    display: block !important; /* Show when expanded */
  }
  
  .filters-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .age-band-filters {
    flex-wrap: wrap;
  }
  
  .search-input {
    min-width: 150px;
  }
  
  .content-grid { grid-template-columns: repeat(2, 1fr); gap: 8px 10px; }
  .content-image { width: 110px; height: 110px; }
  .content-grid-container { padding-top: 1rem; }
  .browse-page-header::before { background-size: 50%; opacity: 0.12; }
  .sort { width: 60%; }
  .language-dropdown-header-container { top: calc(1rem - 20px); }
  
  .pagination-container {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .pagination-controls {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .language-dropdown-header-container {
    position: absolute;
    top: 1rem;
    right: 1rem;
    margin-bottom: 0;
  }
  
  .header-text-content {
    margin-top: 2rem;
  }
}

@media (max-width: 480px) {
  .browse-page-header {
    padding: 1.5rem 1rem;
    min-height: 250px;
  }
  
  .page-title {
    font-size: 1.75rem;
  }
  
  .content-grid { grid-template-columns: repeat(2, 1fr); }
  
  .filters-container {
    padding: 1rem;
  }
  
  .age-band-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
  }
  
  .tag-btn {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
  }
}
