/* Rekkit - Dark theme with amber accent */

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --bg-tertiary: #1f1f1f;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #fbbf24;
  --accent-hover: #f59e0b;
  --accent-dim: rgba(251, 191, 36, 0.1);
  --border: #27272a;
  --radius: 12px;
  --radius-sm: 8px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 10, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  font-size: 1.5rem;
}

.logo-text {
  font-family: 'Bungee', cursive;
  font-size: 1.5rem;
  color: var(--accent);
}

/* Search */
.search-container {
  flex: 1;
  max-width: 400px;
  position: relative;
}

#search {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#search::placeholder {
  color: var(--text-muted);
}

#search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.search-results.hidden {
  display: none;
}

.search-result-item {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

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

.search-result-item:hover {
  background: var(--bg-tertiary);
}

.search-result-type {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background: var(--accent-dim);
  color: var(--accent);
  text-transform: uppercase;
  font-weight: 600;
}

/* Main content */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Hero */
.hero {
  text-align: center;
  padding: 2rem 0 3rem;
}

.hero h1 {
  font-family: 'Bungee', cursive;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Section header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-header h2 {
  font-family: 'Bungee', cursive;
  font-size: 1.25rem;
  color: var(--text-primary);
}

/* Hub grid */
.hubs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.hub-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.hub-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(251, 191, 36, 0.1);
}

.hub-card h3 {
  font-family: 'Bungee', cursive;
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.hub-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  flex: 1;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hub-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.hub-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.subreddit-tag {
  color: var(--accent);
  font-weight: 500;
}

/* Title grid (for hub detail) */
.titles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.5rem;
}

.title-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}

.title-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.title-poster {
  aspect-ratio: 2/3;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.title-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.title-poster .placeholder {
  font-size: 3rem;
  color: var(--text-muted);
}

.title-info {
  padding: 1rem;
}

.title-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.title-info .meta {
  display: flex;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  align-items: center;
}

.type-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--accent-dim);
  color: var(--accent);
  text-transform: uppercase;
  font-weight: 600;
}

.type-badge.movie { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.type-badge.tv { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.type-badge.podcast { background: rgba(16, 185, 129, 0.1); color: #10b981; }

.rating {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.rating::before {
  content: '⭐';
  font-size: 0.75rem;
}

/* Loading */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem;
  color: var(--text-muted);
}

.loading.hidden {
  display: none;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Load more */
.load-more {
  text-align: center;
  padding: 2rem;
}

.load-more.hidden {
  display: none;
}

.btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn:hover {
  background: var(--accent-hover);
}

.btn:active {
  transform: scale(0.98);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state.hidden {
  display: none;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Hub detail page */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.back-link:hover {
  color: var(--accent);
}

.hub-detail-header {
  margin-bottom: 2rem;
}

.hub-detail-header h1 {
  font-family: 'Bungee', cursive;
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.hub-detail-header p {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.hub-source {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
}

.hub-source:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Responsive */
@media (max-width: 640px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }

  .search-container {
    max-width: 100%;
    width: 100%;
  }

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

  .titles-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}
