/* Netflix-style layout */
body {
  background-color: #141414;
  color: white;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

/* Apply custom background if set */
body.has-custom-bg {
  background-image: var(--custom-bg-image);
  background-size: cover;
  background-attachment: fixed;
  background-position: center;
}

/* Site header with logo - Netflix-style gradient */
.site-header {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.95) 0%, rgba(20, 20, 20, 0.85) 50%, rgba(20, 20, 20, 0.7) 100%);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.site-logo {
  max-width: 80px;
  max-height: 160px;
  height: auto;
  object-fit: contain;
}

/* Reduce top padding of main container (80% reduction from py-6 = 1.5rem) */
.container {
  padding-top: 0.3rem !important;
}

/* Category row layout */
.category-row {
  margin-bottom: 0.2rem;
}

.category-title {
  font-size: 1.05rem;
  font-weight: 500;
  margin-bottom: 0.0045rem;
  padding-left: 0.5rem;
}

.row-items {
  display: flex;
  overflow-x: auto;
  padding: 0.5rem 0;
  scrollbar-width: none; /* Firefox */
}

.row-items::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Edge */
}

/* Card styling */
.card {
  cursor: pointer;
  display: block;
  margin-right: 0.75rem;
  position: relative;
  min-width: 140px;
  border-radius: 0.375rem;
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.card:focus {
  outline: 2.4px solid #ffffff;
  outline-offset: 2px;
}

/* Ensure cards are clickable and focusable */
.card[tabindex="0"] {
  cursor: pointer;
}

/* Add visual feedback on hover */
.card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

/* Netflix-style text overlay */
.card-img-container {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  overflow: hidden;
  border-radius: 0.375rem;
}

.card-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  top: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.3) 60%, rgba(0, 0, 0, 0.3) 100%);
  display: flex;
  align-items: flex-end;
  padding: 1rem;
  opacity: 0; /* Hidden by default */
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.card-title {
  color: white;
  font-weight: 500;
  font-size: 0.7rem;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Hide old overlay on focus, show new one */
.card:focus .card-overlay {
  opacity: 0 !important; /* Keep hidden on focus */
}

/* Metadata overlay - shows on focus with gradient */
.card-overlay-info {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7) 0%, rgba(30, 30, 30, 0.85) 100%);
  display: none; /* Hidden by default */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  z-index: 10;
  border-radius: 0.375rem;
}

.card:focus .card-overlay-info {
  display: flex; /* Show on focus */
  opacity: 1;
  transition: opacity 0.3s ease;
}

.card-overlay-info .card-info-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: white;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
}

.card-overlay-info .card-info-meta {
  font-size: 0.55rem;
  color: #ddd;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  align-items: center;
  text-align: center;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.9);
}

.card-overlay-info .card-info-meta span {
  display: block;
  font-size: 0.55rem;
}

/* Make date even smaller than runtime */
.card-overlay-info .card-info-meta span:last-child {
  font-size: 0.5rem;
}

/* Grid layout for category and video pages */
.grid-layout {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
  padding: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .grid-layout {
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
  }

  .card {
    min-width: 105px;
  }
}

@media (max-width: 480px) {
  .grid-layout {
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  }

  .card {
    min-width: 84px;
  }

  .card-title {
    font-size: 0.6125rem;
  }
}
