/* General Body Styles */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  background-color: #f9f9f9;
  margin: 0;
  color: #0f0f0f;
}

/* Sticky Header Wrapper */
.sticky-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: #f9f9f9;
  padding: 16px 24px 0 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Header Bar with Flexbox */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between; /* Pushes logo to left and dropdown to right */
  gap: 16px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 16px;
}

/* Logo and Site Name */
.logo-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0; /* Prevents the logo section from shrinking on small screens */
}
.logo-img {
  height: 32px;
  width: 32px;
}
.site-name {
  font-size: 20px;
  font-weight: 600;
  white-space: nowrap;
}

/* Country Selector Dropdown */
.country-selector-wrapper {
  position: relative;
}
.country-selector {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: #e7e7e7;
  border: none;
  padding: 10px 32px 10px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' class='bi bi-chevron-down' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.country-selector:hover {
  background-color: #ccc;
}

/* Category Navigation Styles */
.category-nav-container {
  width: 100%;
  overflow: hidden;
}
.category-nav {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.category-nav::-webkit-scrollbar {
  display: none;
}
.category-chip {
  display: inline-block;
  padding: 8px 16px;
  background-color: #f2f2f2;
  color: #0f0f0f;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s, color 0.2s;
}
.category-chip:hover {
  background-color: #e5e5e5;
}
.category-chip.active {
  background-color: #0f0f0f;
  color: #ffffff;
}

/* Main Video Grid */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px 16px;
  padding: 0 24px;
}

/* Video Card Styling */
.video-card {
  background-color: transparent;
  box-shadow: none;
  display: flex;
  flex-direction: column;
}
.video-card a {
  text-decoration: none;
  color: inherit;
}
.thumbnail-container {
  position: relative;
  width: 100%;
}
.thumbnail-container img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  border-radius: 12px;
}
.video-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}
.video-rank {
  position: absolute;
  top: 0;
  left: 0;
  background-color: #ff0000;
  color: white;
  padding: 5px 10px;
  border-radius: 12px 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}
.details {
  display: flex;
  padding: 12px 0 0 0;
  gap: 12px;
}
.text-meta {
  display: flex;
  flex-direction: column;
}
.video-title {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.channel-name {
  font-size: 14px;
  color: #606060;
  margin: 8px 0 2px 0;
}
.metadata {
  font-size: 14px;
  color: #606060;
}
.message-container {
  text-align: center;
  padding: 40px;
}
.loader {
  border: 6px solid #f3f3f3;
  border-top: 6px solid #ff0000;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px auto;
}
.error-message {
  background-color: #ffebee;
  color: #c62828;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #c62828;
  display: inline-block;
}
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* --- MODIFIED: Media Query for Mobile Responsiveness --- */
/* Only hide the site name on very narrow screens where it won't fit */
@media (max-width: 420px) {
  .site-name {
    display: none; /* Hide the site name */
  }
  .sticky-header {
    padding: 12px 16px 0 16px;
  }
  .video-grid {
    padding: 0 16px;
  }
}

/* --- Footer Link Styles --- */
.footer-links {
    margin-top: 16px;
}
.footer-links a {
    color: #606060;
    text-decoration: none;
    margin: 0 10px;
}
.footer-links a:hover {
    text-decoration: underline;
}