/* RESET & BASE STYLES */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background: #111;
  color: #fff;
}

/* NAVIGATION */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: #222;
}

.navbar img {
  height: 40px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-links a {
  color: white;
  text-decoration: none;
  margin: 0 5px;
}

.search-bar {
  padding: 5px;
  border-radius: 5px;
  border: none;
}

/* BANNER */
.banner {
  height: 50vh;
  background-size: cover;
  display: flex;
  align-items: center;
  padding: 20px;
}

.banner h1 {
  background: rgba(0, 0, 0, 0.7);
  padding: 10px;
}

/* ROWS */
.row {
  margin: 20px;
}

.row h2 {
  margin-bottom: 10px;
}

/* LIST STYLE */
.list {
  display: flex;
  overflow-x: auto;
}

.list img {
  width: 150px;
  margin-right: 10px;
  cursor: pointer;
  border-radius: 5px;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.list img:hover {
  transform: scale(1.05);
  filter: brightness(1.2);
  z-index: 2;
}

/* MODAL STYLES */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.modal-content {
  background: #222;
  padding: 20px;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  text-align: center;
  border-radius: 10px;
}

.modal-body {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}

.modal-body img {
  width: 30%;
  border-radius: 5px;
}

.modal-text {
  flex: 1;
  text-align: left;
}

.modal img {
  width: 25%;
  border-radius: 5px;
}

.stars {
  color: gold;
}

.close {
  position: absolute;
  top: 10px;
  right: 20px;
  cursor: pointer;
  font-size: 24px;
}

/* EPISODE SELECTOR */
.server-selector {
  margin: 15px 0;
  text-align: left;
}

.clickable-episode {
  cursor: pointer;
  padding: 8px;
  margin-bottom: 5px;
  border-radius: 6px;
  background-color: #1c1c1c;
  color: #fff;
  transition: background-color 0.2s ease;
}

.clickable-episode:hover {
  background-color: #333;
}

.clickable-episode.active {
  background-color: #444;
  font-weight: bold;
  color: #00ffcc;
}

/* SEARCH MODAL */
.search-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 15;
}

.search-modal input {
  width: 300px;
  padding: 10px;
  border-radius: 5px;
  border: none;
  margin-bottom: 20px;
}

.search-modal .results {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.search-modal img {
  width: 120px;
  border-radius: 5px;
  cursor: pointer;
}

.search-modal .close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 30px;
}

/* FOOTER */
.footer {
  background: #222;
  color: #ccc;
  padding: 20px;
  text-align: center;
  margin-top: 40px;
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 15px;
}

.footer-links a {
  color: red;
  text-decoration: none;
  transition: color 0.3s;
}

.footer-links a:hover {
  color: #fff;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
  .navbar {
    flex-direction: row;
    align-items: flex-start;
  }

  .nav-links {
    flex-direction: row;
    width: 100%;
    gap: 10px;
    margin-top: 10px;
  }

  .nav-links a,
  .search-bar {
    width: 100%;
  }

  .search-bar {
    margin-top: 10px;
  }

  .banner {
    height: 30vh;
  }

  .modal-body {
    align-items: center;
  }

  .modal-body img {
    width: 40%;
  }

  .modal-text {
    text-align: center;
  }

  .list {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .list img {
    width: 120px;
  }

  .search-modal input {
    margin-top: 50px;
    width: 90%;
  }

  .search-modal .results {
    justify-content: center;
    grid-template-columns: repeat(auto-fill, minmax(45%, 1fr));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 0;
  }
}

@media (max-width: 480px) {
  .banner h1 {
    font-size: 20px;
    padding: 5px;
  }

  .row h2 {
    font-size: 18px;
  }

  .modal-content {
    width: 95%;
    padding: 15px;
  }

  .modal-body img {
    width: 40%;
  }

  .search-modal .close {
    font-size: 24px;
    top: 10px;
    right: 20px;
  }
}

@media (max-width: 600px) {
  .footer-content {
    font-size: 14px;
  }

  .footer-links {
    flex-direction: row;
    gap: 8px;
  }
}
/* Make posters focusable and add Netflix-like focus highlight */
.list img {
  transition: transform 0.3s ease, box-shadow 0.3s ease, border 0.3s ease;
  cursor: pointer;
}

/* Focus styles - use :focus-visible for better accessibility (shows on remote/keyboard) */
.list img:focus-visible,
.list img:focus {  /* Fallback for browsers without :focus-visible */
  outline: none;  /* Remove default outline */
  transform: scale(1.15);  /* Zoom like Netflix */
  border: 4px solid #fff;  /* White border */
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.9);  /* Strong glow */
  z-index: 10;
  border-radius: 8px;
}

/* Subtle hover for mouse users (optional, won't interfere with remote) */
.list img:hover {
  transform: scale(1.08);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

/* Improve row scrolling - hide scrollbar, smooth behavior */
.list {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;  /* Firefox */
  -ms-overflow-style: none;  /* IE/Edge */
}

.list::-webkit-scrollbar {
  display: none;  /* Chrome/Safari */
}

/* Optional: Focus on modal elements too (e.g., server select, episodes) */
.server-selector select:focus,
#season-select:focus,
.clickable-episode:focus {
  outline: none;
  background-color: #444;
  box-shadow: 0 0 15px #e50914;  /* Netflix red glow */
  transform: scale(1.05);
}

/* Make modal interactive elements focusable with TV-friendly highlights */
.server-selector select,
#season-select,
#episode-items li.clickable-episode,
#modal-video {  /* The iframe */
  transition: transform 0.3s ease, box-shadow 0.3s ease, border 0.3s ease;
  cursor: pointer;
}

.server-selector select:focus,
#season-select:focus,
#episode-items li.clickable-episode:focus,
#modal-video:focus {
  outline: none;
  transform: scale(1.05);
  border: 3px solid #e50914;  /* Netflix red border */
  box-shadow: 0 0 20px rgba(229, 9, 20, 0.8);  /* Red glow */
  z-index: 10;
}

/* Episode list scrolling */
#episode-items {
  max-height: 200px;  /* Optional: limit height if many episodes */
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
#episode-items::-webkit-scrollbar {
  display: none;
}

/* PIN OVERLAY STABILITY */
/* ================= PIN SYSTEM (COMPACT & GLOW) ================= */
#pinOverlay {
    position: fixed; inset: 0; 
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    z-index: 100000; display: none; align-items: center; justify-content: center;
}

.pin-box {
    width: 90%; max-width: 340px; /* Thinner box */
    background: #1c1c1e; /* iOS Dark Mode Gray */
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 28px;
    padding: 2rem 1.5rem 1.5rem 1.5rem; /* Tightened vertical space */
    display: flex; flex-direction: column; align-items: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.auth-view { width: 100%; display: flex; flex-direction: column; align-items: center; }

.pin-input {
    width: 80%; /* Smaller width so it doesn't hit edges */
    background: rgba(255,255,255,0.05);
    border: 2px solid transparent; /* Transparent border for glow transition */
    border-radius: 12px;
    padding: 12px;
    color: #fff;
    font-size: 2rem;
    text-align: center;
    letter-spacing: 8px;
    margin: 15px 0;
    transition: all 0.3s ease;
    outline: none;
}

/* iOS FOCUS GLOW EFFECT */
.pin-input:focus {
    border-color: #007aff;
    background: rgba(0, 122, 255, 0.1);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.3), 0 0 15px rgba(0, 122, 255, 0.2);
}

.auth-title { font-size: 1.4rem; font-weight: 700; margin: 0; color: #fff; }
.auth-subtitle { font-size: 0.9rem; opacity: 0.6; margin: 5px 0 10px 0; }

.btn-auth {
    width: 100%; padding: 14px; border-radius: 14px;
    font-size: 1rem; font-weight: 700; border: none; cursor: pointer;
    margin-top: 10px; transition: transform 0.1s;
}

.btn-login { background: #007aff; color: #fff; } /* Apple Blue */
.btn-reg { background: #34c759; color: #fff; }   /* Apple Green */

.btn-auth:active { transform: scale(0.97); }

.auth-switch { margin-top: 15px; font-size: 0.85rem; color: #8e8e93; }
.auth-switch span { color: #007aff; font-weight: 600; cursor: pointer; }

.btn-cancel {
    margin-top: 20px; /* Reduced space */
    background: none; border: none;
    color: #ff3b30; /* iOS Red */
    font-weight: 600; font-size: 0.9rem;
    cursor: pointer; opacity: 0.8;
}
.btn-cancel:hover { opacity: 1; }

.hidden-view { display: none !important; }