* {
  box-sizing: border-box;
}

.current-show-title {
  text-align: center;
  font-size: 2rem;
  color: #1a252f;
  margin: 0 auto 1.5rem auto;
  max-width: 1200px;
  padding: 0 1rem;
}

#cards-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 1rem 3rem;
  margin: 0 auto;
  width: 100%;
  max-width: 1200px;
}

#cards-container.episodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 1fr));
  justify-content: center;
}

section.card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-radius: 15px;
  background: white;
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.1);
  max-width: 22rem;
  width: 100%;
  margin: 0 auto;

  h3 {
    text-align: center;
    padding: 1rem;
    margin: -1px -1px 0 -1px;
    border: 1px solid black;
    border-radius: 15px;
    background: white;
  }

  img {
    width: 70%;
    margin: 0 auto;
  }

  p {
    padding: 1rem;
  }
}

section.show-card {
  max-width: 100%;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  border-top: 1px solid #1a252f;

  .show-title {
    margin-top: 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e9ecef;
    font-size: 1.5rem;
    color: #1a252f;
    cursor: pointer;
    transition: color 0.2s ease;
  }

  .show-title:hover {
    color: #2980b9;
  }

  .show-body {
    display: flex;
    gap: 1.5rem;

    @media (max-width: 768px) {
      flex-direction: column;
    }
  }

  .show-img {
    width: 160px;
    height: auto;
    align-self: flex-start;
    object-fit: cover;
    border-radius: 8px;
    margin: 0;
  }

  .show-summary {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #333;
  }

  .show-info {
    width: 200px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 1rem;
    flex-shrink: 0;
    align-self: flex-start;

    p {
      padding: 0;
      margin: 0 0 0.5rem 0;
      font-size: 0.9rem;
    }

    @media (max-width: 768px) {
      width: 100%;
    }
  }
}

footer {
  height: 50px;
  padding-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-top: 1px solid black;
}

.controls-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 2rem;
  margin: 0 auto 1.5rem auto;
  max-width: 1200px;
  width: 100%;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.controls-bar input[type="text"],
.controls-bar select,
.nav-btn {
  background: white;
  border: 1px solid black;
  border-radius: 15px;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  min-width: 200px;
}

.nav-btn {
  min-width: auto;
  padding: 0.8rem 1rem;
  cursor: pointer;
  font-weight: 600;
  color: #1a252f;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.nav-btn:hover {
  background: #f0f4f8;
  border-color: #2980b9;
}

@media (max-width: 768px) {
  .controls-bar {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    gap: 1rem;
  }

  .control-group {
    justify-content: center;
    width: 100%;
  }

  .control-group select,
  .search-container {
    width: 100%;
    max-width: 280px;
    min-width: 0;
  }

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

  #episode-count {
    text-align: center;
    margin: 0;
  }

  #cards-container {
    padding: 1rem;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.search-container {
  position: relative;
}

.search-container input {
  padding-right: 2.2rem !important;
}

.clear-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.25rem;
  font-weight: bold;
  cursor: pointer;
  color: #888;
  display: none;
  padding: 0;
  line-height: 1;
}

.clear-btn:hover {
  color: #333;
}

.status-message {
  color: blue;
}

.status-message.error {
  color: red;
}
