/* Discovery Page Styles */
.discovery-hero {
  background: var(--primary);
  color: white;
  padding: 40px 0 50px;
  margin-bottom: 40px;
  text-align: center;
}

.discovery-hero .hero-title {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 12px;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--white-90);
  max-width: 600px;
  margin: 0 auto 24px;
}

.global-search-container {
  max-width: 600px;
  margin: 0 auto;
}

.global-search-box {
  position: relative;
}

.global-search-box input {
  width: 100%;
  padding: 14px 50px 14px 20px;
  font-size: 18px;
  border: 2px solid transparent;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  transition: all 0.3s ease;
}

.global-search-box input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.global-search-box input:focus {
  outline: none;
  background: white;
  color: var(--dark-text);
  border-color: var(--primary-dark);
}

.global-search-box .search-icon {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.7);
  transition: color 0.3s ease;
}

.global-search-box input:focus~.search-icon {
  color: var(--medium-text);
}

.clear-search-btn {
  position: absolute;
  right: 50px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--medium-text);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
}

/* Tabs */
.discovery-tabs {
  display: flex;
  gap: 8px;
  /*  border-bottom: 2px solid var(--border); */
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tab-link {
  padding: 10px 20px;
  font-size: 16px;
  font-weight: 600;
  color: var(--medium-text);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.tab-link:hover {
  color: var(--dark-text);
  background-color: var(--surface-hover);
}

.tab-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-link .tab-count {
  margin-left: 8px;
  font-size: 0.9em;
  color: var(--color-text-secondary);
  font-weight: normal;
  transition: color 0.2s ease-in-out;
}

.tab-link.active .tab-count {
  color: var(--color-accent);
}

/* Tab Content & Controls */
.tab-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.az-filter,
.sort-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.filter-label {
  font-weight: 600;
  font-size: 11px;
  margin-right: 8px;
  color: var(--medium-text);
}

.az-link,
.sort-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--background);
  color: var(--medium-text);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  text-transform: uppercase;
}

.az-link:hover,
.sort-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.az-link.active,
.sort-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Results Grid & Cards */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  /* min-height: 300px; */
  align-items: start;
  /* Prevents cards from stretching vertically */
}

.entity-card {
  background: var(--surface);
  border-radius: 8px;
  padding: 16px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.entity-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--shadow-light);
  border-color: var(--primary-border);
}

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

.card-image-container {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  margin-top: -7px;
  background-color: var(--background);
}

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

.card-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 20px;
  background-color: var(--primary-bg-light);
}

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

.card-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--dark-text);
  margin: 0 0 -10px 0;
  line-height: 1.3;
}

.card-type {
  font-size: 12px;
  color: var(--light-text);
  text-transform: capitalize;
}

.card-stats {
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--medium-text);
}

/* Genre-specific card adjustments */
.entity-card.genre-card .card-header {
  margin-bottom: 8px;
}

.entity-card.genre-card .card-stats {
  border-top: none;
  padding-top: 0;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-item i {
  font-size: 11px;
  color: var(--primary);
}

/* Load More & Loading States */
.load-more-container {
  text-align: center;
  padding: 30px 0;
}

.load-more-btn {
  padding: 12px 30px;
  font-size: 16px;
  font-weight: 600;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.load-more-btn:hover {
  background: var(--primary-dark);
}

.loading-state,
.no-results-state {
  text-align: center;
  padding: 60px 40px;
  color: var(--light-text);
  grid-column: 1 / -1;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 4px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Search Results View */
.search-results-container {
  animation: fadeIn 0.5s;
}

.search-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.search-results-title {
  font-size: 24px;
  font-weight: 700;
}

.search-results-title span {
  font-weight: 400;
  color: var(--medium-text);
}

.search-category {
  margin-bottom: 32px;
}

.search-category-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

/* Responsive */
@media (max-width: 768px) {
  .hero-title {
    font-size: 32px;
  }

  .global-search-box input {
    font-size: 16px;
  }

  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

@media (max-width: 480px) {
  .results-grid {
    grid-template-columns: 1fr;
  }

  .az-filter,
  .sort-filter {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .az-link,
  .sort-btn {
    padding: 5px 10px;
    font-size: 11px;
  }
}