/*
 * Stylesheet for Pasha TV Dilman
 *
 * This file defines the general look and feel of the application.  The design
 * follows a dark theme appropriate for television viewing environments.  Text
 * sizes are large and easy to read from a distance, and interactive elements
 * like navigation items and cards respond to focus and hover states.  The
 * layout supports right‑to‑left languages by inheriting rtl from the HTML
 * element.  Colours can be adjusted as needed, but defaults are chosen for
 * good contrast and clarity on a TV display.
 */

/* Reset some defaults */
body {
  margin: 0;
  font-family: sans-serif;
  background-color: #0c0c0c;
  color: #f2f2f2;
  direction: rtl;
}

/* Navigation bar */
nav#nav {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background-color: #1a1a1a;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  position: sticky;
  top: 0;
  z-index: 10;
}

nav#nav .logo {
  font-size: 1.5rem;
  font-weight: bold;
  margin-left: 1rem;
  white-space: nowrap;
}

nav#nav .nav-items {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-grow: 1;
  justify-content: flex-start;
}

nav#nav .nav-items li {
  margin: 0 1rem;
  cursor: pointer;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  color: #ccc;
  transition: color 0.2s ease, border-color 0.2s ease;
}

nav#nav .nav-items li:hover,
nav#nav .nav-items li:focus {
  color: #fff;
}

nav#nav .nav-items li.active {
  color: #00bcd4;
  border-color: #00bcd4;
}

nav#nav input#search {
  border: none;
  background-color: #2c2c2c;
  color: #f2f2f2;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  width: 200px;
  max-width: 50%;
  transition: width 0.3s ease;
}

nav#nav input#search:focus {
  outline: none;
  width: 250px;
}

/* Controls container for search and filters */
nav#nav .controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

nav#nav select {
  background-color: #2c2c2c;
  color: #f2f2f2;
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
}

nav#nav select option {
  background-color: #2c2c2c;
  color: #f2f2f2;
}

nav#nav select:focus {
  outline: none;
}

/* Style for the advanced filter button */
.filter-btn {
  background-color: #00bcd4;
  color: #1f1f1f;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.2s ease;
}

.filter-btn:hover {
  background-color: #00acc1;
}

/*
 * Advanced filter overlay styles
 * This overlay covers the entire screen and centres the filter panel.
 */
#filter-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

/* When overlay is not hidden show flex layout */
#filter-overlay:not(.hidden) {
  display: flex;
}

#filter-content {
  background-color: #1f1f1f;
  width: 90%;
  max-width: 900px;
  max-height: 90%;
  overflow-y: auto;
  border-radius: 8px;
  padding: 1rem;
  position: relative;
}

/* Close button inside filter overlay */
#filter-close {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #f2f2f2;
  cursor: pointer;
}

/* Tabs at the top of the filter overlay */
#filter-content .filter-tabs {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 0.5rem 0 1rem;
}

#filter-content .filter-tabs button {
  background: none;
  border: none;
  padding: 0.5rem 1rem;
  color: #ccc;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 1rem;
  transition: color 0.2s ease, border-color 0.2s ease;
}

#filter-content .filter-tabs button:hover {
  color: #fff;
}

#filter-content .filter-tabs button.active {
  color: #00bcd4;
  border-color: #00bcd4;
}

/* Sections inside filter overlay */
#filter-body .section {
  margin-bottom: 1rem;
}

#filter-body .section h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: #f2f2f2;
}

.package-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.package-pill {
  padding: 0.4rem 0.75rem;
  background-color: #2c2c2c;
  border-radius: 16px;
  color: #f2f2f2;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.package-pill.active {
  background-color: #00bcd4;
  color: #1f1f1f;
}

.rating-stars {
  display: flex;
  gap: 0.3rem;
}

.star {
  font-size: 1.5rem;
  color: #777;
  cursor: pointer;
  transition: color 0.2s ease;
}

.star.selected {
  color: #ffd700;
}

.year-range {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.year-range input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  background: transparent;
}

.year-range input[type="range"]:focus {
  outline: none;
}

.year-range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 20px;
  background: #00bcd4;
  cursor: pointer;
  border-radius: 3px;
}

.year-range input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 20px;
  background: #00bcd4;
  cursor: pointer;
  border-radius: 3px;
}

.year-values {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: #ccc;
}

.filter-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 1rem;
}

.filter-actions button {
  flex: 1;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
}

#filter-clear {
  background-color: #555;
  color: #fff;
  transition: background-color 0.2s ease;
}

#filter-clear:hover {
  background-color: #666;
}

#filter-apply {
  background-color: #00bcd4;
  color: #1f1f1f;
  transition: background-color 0.2s ease;
}

#filter-apply:hover {
  background-color: #00acc1;
}

/* Main content area */
main#content {
  padding: 1.5rem;
}

/* Card grid */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

/* Single card */
.card {
  background-color: #1f1f1f;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Favourite star */
.card .fav-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #777;
  cursor: pointer;
  z-index: 2;
}

.card .fav-btn.fav {
  color: #ffd700;
}

.card:hover {
  transform: scale(1.05);
}

.card img {
  width: 100%;
  height: 250px;
  object-fit: cover;
}

.card-content {
  padding: 0.5rem 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card h3 {
  margin: 0.5rem 0 0.25rem;
  font-size: 1.1rem;
  line-height: 1.3;
  color: #fff;
}

.card p {
  margin: 0;
  font-size: 0.8rem;
  color: #b0b0b0;
  line-height: 1.4;
}

/* Small badge for ratings or age */
.badge {
  display: inline-block;
  background-color: #00bcd4;
  color: #fff;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  margin-left: 0.25rem;
}

/* Modal for series details */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background-color: #181818;
  padding: 1.5rem;
  border-radius: 8px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  color: #e0e0e0;
}

.modal .close {
  font-size: 1.5rem;
  cursor: pointer;
  float: left;
  margin-bottom: 1rem;
}

/* Subtitle selection within video overlay */
#subtitle-container {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#subtitle-container label {
  font-size: 0.9rem;
  color: #cccccc;
}

#subtitle-select {
  background-color: #2c2c2c;
  color: #f2f2f2;
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

/* Seasons and episodes */
.season {
  margin-bottom: 1.5rem;
}

.season h4 {
  margin: 0.5rem 0;
  font-size: 1.1rem;
  color: #00bcd4;
}

.episodes {
  list-style: none;
  padding: 0;
  margin: 0;
}

.episodes li {
  padding: 0.3rem 0;
  cursor: pointer;
  transition: color 0.2s;
}

.episodes li:hover {
  color: #00bcd4;
  text-decoration: underline;
}

/* Overlay styles */
#overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

#overlay.hidden {
  display: none;
}

#overlay-content {
  background-color: #1f1f1f;
  border-radius: 8px;
  width: 80%;
  max-width: 800px;
  max-height: 90%;
  overflow-y: auto;
  position: relative;
  padding: 1rem;
}

#overlay-close {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: none;
  border: none;
  color: #f2f2f2;
  font-size: 2rem;
  cursor: pointer;
}

#player-container, #details-container {
  margin-top: 2rem;
}

#video-player {
  width: 100%;
  max-height: 80vh;
  background-color: #000;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  nav#nav {
    flex-wrap: wrap;
  }
  nav#nav .nav-items {
    flex-basis: 100%;
    justify-content: space-around;
    margin-top: 0.5rem;
  }
  nav#nav input#search {
    width: 100%;
    margin-top: 0.5rem;
  }
}

/* Utility class to hide elements */
.hidden {
  display: none !important;
}

/* IPTV setup and channel list styles */

/* Container for IPTV setup form */
#iptv-setup {
  max-width: 600px;
  margin: 2rem auto;
  background-color: #1f1f1f;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

#iptv-setup h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.4rem;
  text-align: center;
  color: #00bcd4;
}

#iptv-setup .iptv-input {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.8rem;
}

#iptv-setup label {
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
  color: #ccc;
}

#iptv-setup input {
  padding: 0.5rem;
  border: none;
  border-radius: 4px;
  background-color: #2c2c2c;
  color: #f2f2f2;
  font-size: 0.9rem;
}

#iptv-setup input:focus {
  outline: none;
  background-color: #343434;
}

#iptv-setup .iptv-or {
  text-align: center;
  margin: 0.8rem 0;
  color: #888;
  font-size: 0.8rem;
}

#iptv-setup button {
  background-color: #00bcd4;
  color: #1f1f1f;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background-color 0.2s ease;
  width: 100%;
}

#iptv-setup button:hover {
  background-color: #00acc1;
}

/* IPTV channel cards reuse the existing .cards and .card styles. */
/* We add a specific selector for group titles in IPTV lists */
.iptv-group-title {
  margin-top: 1.2rem;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  color: #00bcd4;
  border-bottom: 1px solid #333;
  padding-bottom: 0.2rem;
}

/* EPG container styles for IPTV schedule */
#epg-container {
  margin-top: 1rem;
  padding: 0.5rem;
  background-color: #1a1a1a;
  border-top: 1px solid #333;
  border-radius: 4px;
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.85rem;
}

#epg-container h4 {
  margin: 0.5rem 0;
  color: #00bcd4;
  font-size: 1rem;
}

#epg-container ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#epg-container li {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  border-bottom: 1px solid #2c2c2c;
}

#epg-container li:last-child {
  border-bottom: none;
}

#epg-container .program-time {
  color: #ccc;
  margin-left: 0.5rem;
}

#epg-container .program-title {
  color: #f2f2f2;
  flex-grow: 1;
}

/* IPTV group filter pills */
.iptv-group-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.iptv-group-pill {
  padding: 0.3rem 0.6rem;
  background-color: #2c2c2c;
  border-radius: 16px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #ccc;
  transition: background-color 0.2s, color 0.2s;
}

.iptv-group-pill:hover {
  background-color: #00acc1;
  color: #1f1f1f;
}

.iptv-group-pill.active {
  background-color: #00bcd4;
  color: #1f1f1f;
}