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

body {
  font-family: Arial, sans-serif;
  background: linear-gradient(
    135deg,
    #0f2027 0%,
    #203a43 50%,
    #2c5364 100%
  ); /* Darker gradient */
  color: white;
  overflow: hidden;
  height: 100vh;
}

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  background: rgba(0, 0, 0, 0.5); /* Darker header background */
}

.header h1 {
  font-size: 2.5rem;
  font-weight: bold;
}

.time {
  font-size: 1.5rem;
  opacity: 0.8;
}

.channel-grid {
  display: flex; /* Changed from grid */
  flex-wrap: wrap; /* Added for flex layout */
  justify-content: center; /* Added to center items in the row */
  padding: 25px; /* Adjusted padding: original 40px - 15px (half of new card margin) */
  flex: 1;
  overflow-y: auto;
}

.channel-card {
  background: rgba(10, 10, 10, 0.2); /* Darker card background */
  border-radius: 15px;
  padding: 20px;
  -webkit-transition: all 0.3s ease; /* Added prefix */
  transition: all 0.3s ease;
  cursor: pointer;
  border: 3px solid transparent;

  /* Flex properties for sizing and spacing */
  /* flex-grow: 1; Removed to prevent stretching */
  flex-shrink: 1; /* Can be kept or set to 0 if no shrinking is desired, 1 is usually fine */
  flex-basis: 300px; /* Corresponds to minmax(300px, ...) */
  min-width: 300px; /* Ensures minimum width */
  margin: 15px; /* Creates 30px gap between cards (15px on each side) */
}

.channel-card:hover,
.channel-card.focused {
  -webkit-transform: scale(1.05); /* Added prefix */
  transform: scale(1.05);
  border-color: #ffffff; /* Brighter border for dark theme */
  background: rgba(0, 0, 0, 0.4); /* Darker hover/focused background */
  -webkit-box-shadow: 0 10px 30px rgba(0, 168, 232, 0.2); /* Adjusted shadow for dark theme */
  box-shadow: 0 10px 30px rgba(0, 168, 232, 0.2); /* Adjusted shadow for dark theme */
}

.channel-card img {
  width: 100%;
  height: 150px;
  object-fit: contain; /* Changed from 'cover' to 'contain' */
  border-radius: 10px;
  margin-bottom: 15px;
}

.channel-info h3 {
  font-size: 1.5rem;
  margin-bottom: 5px;
}

.channel-info p {
  opacity: 0.8;
  font-size: 1rem;
}

.watch-page {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000; /* Solid black for video page */
  z-index: 1000;
}

.watch-page.hidden {
  display: none;
}

#videoPlayer {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.channel-name {
  font-size: 1.5rem;
  font-weight: bold;
}

.controls-hint {
  opacity: 0.7;
  font-size: 1rem;
}

.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9); /* Darker loading background */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.loading.hidden {
  display: none;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.2); /* Lighter base for spinner on dark bg */
  border-top: 5px solid #00a8e8; /* Brighter color for spinner animation */
  border-radius: 50%;
  -webkit-animation: spin 1s linear infinite; /* Added prefix */
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@-webkit-keyframes spin {
  /* Added prefixed keyframes */
  0% {
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

@keyframes spin {
  0% {
    -webkit-transform: rotate(0deg); /* Added prefix */
    transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg); /* Added prefix */
    transform: rotate(360deg);
  }
}

/* TV Remote Control Styles */
.channel-card.focused {
  outline: none;
}

/* Hide scrollbars for TV */
::-webkit-scrollbar {
  display: none;
}
