/* ==== RESET ==== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: system-ui, Arial, sans-serif;
}

/* ==== BODY ==== */
body {
  background-color: #f4f4f7;
  padding: 40px;
  display: flex;
  justify-content: center;
}

/* ==== ROOT CONTAINER ==== */
#root {
  color: black;
  padding-top: 100px; /* Adjusted padding for top bar */
  max-width: 1200px;
  width: 100%;
}

/* ==== UTILITY CLASSES ==== */
.hidden {
  display: none !important;
}

/* ==== TOP BAR ==== */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: white;
  padding: 15px 20px;
  display: flex;
  gap: 15px;
  align-items: center;
  border-bottom: 2px solid #ddd;
  z-index: 9999;
  flex-wrap: wrap;
}

/* ==== BACK BUTTON ==== */
#backToShows {
  padding: 10px 20px;
  background: #0077ff;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s ease;
  margin-right: auto;
}

#backToShows:hover {
  background: #0055cc;
}

/* ==== SHOW CONTROLS ==== */
#showControls {
  display: flex;
  gap: 15px;
  align-items: center;
  flex: 1;
}

/* ==== SHOW SEARCH INPUT ==== */
#showSearchInput {
  flex: 1;
  max-width: 300px;
  padding: 10px;
  font-size: 16px;
  border-radius: 8px;
  border: 2px solid #ccc;
}

#showSearchInput:focus {
  outline: none;
  border-color: #0077ff;
}

/* ==== SHOW COUNTER ==== */
#showCounter {
  font-size: 16px;
  font-weight: 500;
  color: #333;
  white-space: nowrap;
  min-width: 120px;
}

/* ==== SHOW DROPDOWN ==== */
#showDropdown {
  padding: 10px;
  font-size: 16px;
  border-radius: 8px;
  border: 2px solid #ccc;
  min-width: 250px;
  background-color: white;
}

#showDropdown:focus {
  outline: none;
  border-color: #0077ff;
}

/* ==== EPISODE CONTROLS ==== */
#episodeControls {
  display: flex;
  gap: 15px;
  align-items: center;
  flex: 1;
}

/* ==== EPISODE SELECT DROPDOWN ==== */
#episodeSelect {
  padding: 10px;
  font-size: 16px;
  border-radius: 8px;
  border: 2px solid #ccc;
  min-width: 250px;
}

#episodeSelect:focus {
  outline: none;
  border-color: #0077ff;
}

/* ==== EPISODE SEARCH INPUT ==== */
#episodeSearchInput {
  flex: 1;
  max-width: 300px;
  padding: 10px;
  font-size: 16px;
  border-radius: 8px;
  border: 2px solid #ccc;
}

#episodeSearchInput:focus {
  outline: none;
  border-color: #0077ff;
}

/* ==== EPISODE COUNTER ==== */
#episodeCounter {
  font-size: 16px;
  font-weight: 500;
  color: #333;
  white-space: nowrap;
  min-width: 180px;
}

/* ==== SHOWS CONTAINER ==== */
.shows-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
  gap: 24px;
}

/* ==== SHOW CARD ==== */
.show-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid #e4e4e4;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
  transition: all 0.3s ease;
}

.show-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.show-card-inner {
  display: flex;
  gap: 20px;
}

/* ==== SHOW IMAGE ==== */
.show-image {
  flex-shrink: 0;
  width: 210px;
}

.show-image img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}

/* ==== SHOW INFO ==== */
.show-info {
  flex: 1;
}

/* ==== SHOW TITLE ==== */
.show-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
  color: #1a1a1a;
}

/* ==== SHOW META ==== */
.show-meta {
  display: flex;
  gap: 20px;
  margin-bottom: 12px;
  font-size: 14px;
}

.show-meta span {
  color: #555;
}

.show-meta strong {
  color: #333;
  margin-right: 4px;
}

/* ==== SHOW GENRES ==== */
.show-genres {
  margin-bottom: 16px;
  font-size: 14px;
  color: #555;
}

.show-genres strong {
  color: #333;
  margin-right: 4px;
}

/* ==== SHOW SUMMARY ==== */
.show-summary {
  font-size: 14px;
  line-height: 1.6;
  color: #444;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==== EPISODES GRID ==== */
.episodes-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 32px;
}

/* ==== EPISODE CARD ==== */
.episode-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid #e4e4e4;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.episode-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* ==== EPISODE TITLE ==== */
.episode-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  color: #1a1a1a;
  text-align: center;
  border: 2px solid black;
  padding: 25px;
  border-radius: 8px;
}

/* ==== EPISODE IMAGE ==== */
.episode-card img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 16px;
}

/* ==== EPISODE SUMMARY ==== */
.episode-card .summary {
  font-size: 14px;
  line-height: 1.6;
  color: #444;
}

/* ==== ATTRIBUTION ==== */
#attribution {
  text-align: center;
  margin-top: 40px;
  font-size: 14px;
  color: #666;
}

#attribution a {
  color: #0077cc;
  text-decoration: none;
}

#attribution a:hover {
  text-decoration: underline;
}

/* ==== MESSAGE STYLES ==== */
.loading-message,
.error-message,
.no-results {
  text-align: center;
  padding: 40px;
  font-size: 18px;
  color: #666;
}

.error-message {
  color: #d32f2f;
}

.no-results {
  color: #888;
}

/* ==== RESPONSIVE DESIGN ==== */
@media (max-width: 768px) {
  body {
    padding: 20px;
  }
  
  .top-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    gap: 10px;
  }
  
  #backToShows {
    margin-right: 0;
    width: 100%;
    order: 1;
  }
  
  #showControls {
    flex-direction: column;
    width: 100%;
    order: 2;
    gap: 10px;
  }
  
  #showSearchInput,
  #episodeSearchInput {
    width: 100%;
    max-width: 100%;
  }
  
  #episodeControls {
    flex-direction: column;
    width: 100%;
    order: 3;
    gap: 10px;
  }
  
  #episodeSelect,
  #showDropdown {
    width: 100%;
  }
  
  #showCounter,
  #episodeCounter {
    text-align: center;
    width: 100%;
  }
  
  .shows-container {
    grid-template-columns: 1fr;
  }
  
  .show-card-inner {
    flex-direction: column;
  }
  
  .show-image {
    width: 100%;
    text-align: center;
  }
  
  .show-image img {
    width: 100%;
    max-width: 210px;
    margin: 0 auto;
  }
  
  .show-meta {
    flex-direction: column;
    gap: 8px;
  }
}