/*===========================*/
/*         Font Face         */
/*===========================*/
@font-face {
  font-family: 'IRANYekanX';
  src: url('/assets/fonts/IRANYekanXFaNum-Regular.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

/*===========================*/
/*        Variables          */
/*===========================*/
:root {
  --colorPrimary: #10101F;
  --colorBackground: #1C2F3D;
  --colorOnPrimary: #F3E4E3;
  --colorSecondary: #4A5A6A;
  --colorSecondaryLight: #5D6E84;
  --colorAccent: #7B1B3A;
  --colorAccentHover: #991f4c;
  --colorError: #D32F2F;
  --colorPlaceholder: #BBB9B9;
  --uiRadius: 18px;
  --cardRadius: 12px;
}

/*===========================*/
/*      Global Styles        */
/*===========================*/
*, *::before, *::after {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
}

body.loading *:not(#initialLoader):not(#initialLoader *) {
  display: none !important;
}

body {
  font-family: 'IRANYekanX', sans-serif;
  background-color: var(--colorBackground);
  color: var(--colorOnPrimary);
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

a {
  text-decoration: none;
}

.text-center {
  text-align: center;
}

/*=======================*/
/*      Scrollbar        */
/*=======================*/
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: var(--colorBackground);
}

::-webkit-scrollbar-thumb {
  background-color: var(--colorSecondary);
  border-radius: var(--uiRadius);
  border: 3px solid var(--colorBackground);
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--colorSecondaryLight);
}

* {
  scrollbar-width: auto;
  scrollbar-color: var(--colorSecondary) var(--colorBackground);
}

/*===========================*/
/*         Layouts           */
/*===========================*/
.container {
  background-color: var(--colorPrimary);
  padding: 30px 25px;
  border-radius: var(--uiRadius);
  box-shadow: 0 8px 20px rgba(18, 18, 31, 0.7);
  width: 90%;
  max-width: 400px;
  text-align: center;
  overflow: visible;
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background: var(--colorBackground);
  margin-bottom: 85px;
  color: var(--colorOnPrimary);
}

.content-area.no-bottom-space {
  margin-bottom: 0 !important;
}

.content-area h3 {
  margin-bottom: -5px;
}

.content-area img {
  transition: opacity 0.3s ease-in-out;
  opacity: 0;
}

.content-area img.loaded {
  opacity: 1;
}

/*===========================*/
/*       Typography          */
/*===========================*/
h1 {
  margin-bottom: 20px;
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--colorOnPrimary);
}

/*===========================*/
/*        Form Fields        */
/*===========================*/
input {
  width: 100%;
  padding: 14px 16px;
  margin: 10px 0;
  border-radius: var(--uiRadius);
  border: none;
  background-color: var(--colorSecondary);
  color: var(--colorOnPrimary);
  font-size: 1rem;
  outline: none;
  font-family: inherit;
  transition: background-color 0.3s ease;
}

input::placeholder {
  color: var(--colorPlaceholder);
}

input:focus {
  background-color: var(--colorSecondaryLight);
}

input.error {
  border: 2px solid var(--colorError) !important;
}

button {
  width: 100%;
  padding: 14px;
  margin-top: 20px;
  border-radius: var(--uiRadius);
  border: none;
  background-color: var(--colorAccent);
  color: white;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.3s ease;
  font-family: inherit;
  outline: none;
}

button:hover,
button:focus {
  background-color: var(--colorAccentHover);
}

/*===============================*/
/*      Splash and Signin        */
/*===============================*/
.noscroll-body {
  position: relative;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  margin: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--colorOnPrimary);
  text-align: center;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: none;
}

#poster {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  object-fit: cover;
  object-position: center center;
  z-index: -1;
}

.logo {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50%;
}

.version {
  width: 100%;
  position: fixed;
  font-size: 14px;
  text-align: center;
  color: var(--colorPlaceholder);
  bottom: 15px;
}

#splashError {
  width: 100%;
  position: fixed;
  font-size: 18px;
  text-align: center;
  color: var(--colorError);
  bottom: 25%;
}

#errorMessage {
  color: var(--colorError);
  margin-top: 15px;
  min-height: 20px;
}

.vlc-error {
  position: absolute;
  top: 25%;
  font-size: 20px;
  color: #D32F2F;
  text-align: center;
  width: 100%;
}

.vlc-try {
  font-size: 20px;
  text-align: center;
}

video {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: black;
  outline: none;
}

#backBtn, #vlcBtn, #mxBtn {
  all: unset;
  position: fixed;
  top: 20px;
  left: 20px;
  width: 48px;
  height: 48px;
  background-color: rgba(55, 71, 79, 0.85);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  opacity: 0;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

#vlcBtn {
  right: 20px;
}

#mxBtn {
  right: 80px;
}

#backBtn.show,
#vlcBtn.show,
#mxBtn.show {
  opacity: 1;
}

#backBtn svg {
  display: block;
}

.page-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.page-title img {
  all: unset;
  overflow: hidden;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.install-btn {
  background-color: #fffae6;
  border: 1px solid #f0c36d;
  color: #8a6d3b;
}

.install-btn:hover {
  background-color: #fff0b3;
  border-color: #e6ac00;
  color: #7a5500;
}

.install-banner {
  background-color: #fffae6;
  border: 1px solid #f0c36d;
  color: #8a6d3b;
  padding: 1rem;
  border-radius: var(--uiRadius);
  margin: 1.5rem auto 0;
  text-align: center;
  font-size: 0.95rem;
  max-width: 400px;
  line-height: 1.8;
}

/*===========================*/
/*     Horizontal Lists      */
/*===========================*/
.pipe {
  font-weight: normal;
  font-size: 30px;
  color: var(--colorAccent);
  vertical-align:middle;
}

.slider,
.stars,
.video-list,
.genres {
  display: flex;
  overflow-x: auto;
  gap: 14px;
  padding: 7px 15px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  margin-left: -15px;
  margin-right: -15px;
}

.is-ios .slider::after,
.is-ios .stars::after,
.is-ios .video-list::after,
.is-ios .genres::after {
  content: "";
  flex: 0 0 1px;
}

.slider::-webkit-scrollbar,
.stars::-webkit-scrollbar,
.video-list::-webkit-scrollbar
.video-list-grid::-webkit-scrollbar {
  display: none;
}

.video-list-grid {
  display: grid;
  overflow: visible;
  gap: 14px;
  padding: 7px 15px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  margin-left: -15px;
  margin-right: -15px;
  grid-template-columns: repeat(3, calc((100% - 28px) / 3));
}

@media (orientation: landscape) {
  .video-list-grid {
    grid-template-columns: repeat(6, calc((100% - 70px) / 6));
  }
}

.video-list-grid a,
.video-list-grid a .video {
  width: 100%;
}

.slider .slide,
.video,
.stars .star {
  flex: 0 0 auto;
  transition: transform 0.3s ease;
}

.slider .slide {
  width: 320px;
  aspect-ratio: 16 / 9;
  border-radius: var(--cardRadius);
  overflow: hidden;
  background: var(--colorSecondary);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  position: relative;
}

.slider .slide:hover {
  transform: scale(1.04);
}

.slider .slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slider .slide p {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0;
  padding: 10px;
  background: linear-gradient(to top, rgba(16, 16, 31, 1), rgba(16, 16, 31, 0));
  color: var(--colorOnPrimary);;
  font-size: 17px;
  text-align: center;
  z-index: 2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stars .star {
  text-align: center;
  color: var(--colorOnPrimary);
  cursor: pointer;
}

.stars .star:hover {
  transform: scale(1.08);
}

.stars .star img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.stars .star p {
  font-size: 13px;
  margin: 5px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.genres {
  gap: 7px;
}

.genre {
  background: var(--colorAccent);
  color: white;
  padding: 5px 10px;
  border-radius: var(--uiRadius);
  font-size: 17px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.3s ease;
  flex-shrink: 0;
}

.genre a {
    all: unset;
}

.genre:hover,
.genre.active {
  background-color: var(--colorOnPrimary);
  color: black;
}

.video {
  width: 140px;
  text-align: center;
  color: var(--colorOnPrimary);
  cursor: pointer;
  border-radius: var(--cardRadius);
  background: var(--colorSecondary);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  position: relative;
}

.video:hover {
  transform: scale(1.04);
}

.video img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--cardRadius) var(--cardRadius) 0 0;
}

.video p {
  margin: 0;
  padding: 8px 10px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--colorSecondary);
  border-radius: 0 0 var(--uiRadius) var(--uiRadius);
  height: 35px;
}

.video .more-thumb {
  width: 100%;
  aspect-ratio: 2 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--cardRadius) var(--cardRadius) 0 0;
  color: var(--colorOnPrimary);
  font-size: 80px;
}

.item {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--colorOnPrimary);
  font-size: 18px;
}

.dubbled {
  position: absolute;
  top: 2px;
  right: 2px;
  background-color: var(--colorAccent);
  color: white;
  font-size: 12px;
  padding: 5px;
  border-radius: var(--cardRadius);
  font-family: inherit;
  z-index: 1;
}

.imdb {
  position: absolute;
  bottom: 38px;
  left: 3px;
  background-color: rgba(255,215,0,0.75);
  color: black;
  font-size: 12px;
  padding: 3px 5px 3px 23px;
  border-radius: 5px;
  font-family: Arial;
  font-weight: bold;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.imdb::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background: black;
  clip-path: polygon(
      50% 0%,
      61% 35%,
      98% 35%,
      68% 57%,
      79% 91%,
      50% 70%,
      21% 91%,
      32% 57%,
      2% 35%,
      39% 35%
  );
}

.season-section {
  display: none;
  animation: fadeIn 0.4s ease-in-out;
}

.season-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/*===========================*/
/*        Bottom Nav         */
/*===========================*/
:root {
  --bottomNavHeight: 76px;
  --bottomNavInset: 12px;
  --bottomNavPadding: 8px;
  --bottomNavGap: 8px;
  --bottomNavRadius: 999px;
  --bottomNavBlur: 10px;
  --bottomNavTransition: 380ms cubic-bezier(0.22, 1, 0.36, 1);
}

.content-area {
  margin-bottom: 108px;
}

.bottom-nav {
  position: fixed;
  left: var(--bottomNavInset);
  right: var(--bottomNavInset);
  bottom: max(10px, calc(env(safe-area-inset-bottom) - 10px));
  height: var(--bottomNavHeight);
  padding: var(--bottomNavPadding);
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: var(--bottomNavGap);
  border-radius: var(--bottomNavRadius);
  direction: rtl;
  z-index: 1000;
  isolation: isolate;
  overflow: hidden;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--colorOnPrimary) 9%, transparent) 0%,
      color-mix(in srgb, var(--colorOnPrimary) 4%, transparent) 22%,
      color-mix(in srgb, var(--colorPrimary) 18%, transparent) 100%
    ),
    color-mix(in srgb, var(--colorPrimary) 44%, transparent);
  border: 1px solid color-mix(in srgb, var(--colorOnPrimary) 10%, transparent);
  box-shadow:
    0 10px 28px color-mix(in srgb, black 22%, transparent),
    0 3px 10px color-mix(in srgb, black 14%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--colorOnPrimary) 10%, transparent),
    inset 0 -1px 0 color-mix(in srgb, var(--colorOnPrimary) 3%, transparent);
  backdrop-filter: blur(var(--bottomNavBlur)) saturate(140%) contrast(106%);
  -webkit-backdrop-filter: blur(var(--bottomNavBlur)) saturate(140%) contrast(106%);
}

.bottom-nav::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(
      circle at 20% 0%,
      color-mix(in srgb, var(--colorOnPrimary) 10%, transparent),
      transparent 32%
    ),
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--colorOnPrimary) 6%, transparent) 0%,
      transparent 35%,
      color-mix(in srgb, black 4%, transparent) 100%
    );
}

.bottom-nav::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--colorOnPrimary) 3%, transparent),
    inset 0 12px 16px color-mix(in srgb, var(--colorOnPrimary) 2%, transparent),
    inset 0 -8px 14px color-mix(in srgb, black 5%, transparent);
}

.bottom-nav button {
  all: unset;
  position: relative;
  z-index: 2;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  border-radius: 999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  overflow: hidden;
  box-sizing: border-box;
  color: color-mix(in srgb, var(--colorOnPrimary) 42%, var(--colorSecondary));
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.1px;
  transition:
    color 220ms ease,
    transform 220ms ease,
    flex-grow var(--bottomNavTransition),
    opacity 220ms ease,
    background var(--bottomNavTransition),
    box-shadow var(--bottomNavTransition),
    border-color var(--bottomNavTransition);
}

.bottom-nav button::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--colorOnPrimary) 7%, transparent),
      color-mix(in srgb, var(--colorOnPrimary) 2%, transparent)
    );
  transition: opacity 220ms ease;
}

.bottom-nav button:hover::before {
  opacity: 1;
}

.bottom-nav button:hover:not(.active) {
  color: color-mix(in srgb, var(--colorOnPrimary) 82%, var(--colorSecondary));
  transform: translateY(-1px);
}

.bottom-nav button:active {
  transform: scale(0.975);
}

.bottom-nav button svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  margin: 0;
  position: relative;
  z-index: 2;
  transition:
    transform 220ms ease,
    filter 220ms ease,
    opacity 220ms ease;
}

.bottom-nav button span {
  position: relative;
  z-index: 2;
  white-space: nowrap;
  transition:
    transform 220ms ease,
    color 220ms ease,
    opacity 220ms ease;
}

.bottom-nav button.active {
  flex: 1.35 1 0;
  color: var(--colorOnPrimary);
  font-weight: 800;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--colorOnPrimary) 18%, transparent) 0%,
      color-mix(in srgb, var(--colorOnPrimary) 8%, transparent) 38%,
      color-mix(in srgb, var(--colorPrimary) 10%, transparent) 100%
    ),
    color-mix(in srgb, var(--colorOnPrimary) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--colorOnPrimary) 14%, transparent);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--colorOnPrimary) 16%, transparent),
    inset 0 -1px 0 color-mix(in srgb, var(--colorOnPrimary) 4%, transparent),
    0 8px 18px color-mix(in srgb, black 16%, transparent),
    0 2px 6px color-mix(in srgb, black 10%, transparent);
}

.bottom-nav button.active::before {
  opacity: 0;
}

.bottom-nav button.active::after {
  opacity: 1;
}

.bottom-nav button.active svg {
  transform: translateY(-1px) scale(1.06);
  filter: drop-shadow(0 2px 6px color-mix(in srgb, black 18%, transparent));
}

.bottom-nav button.active span {
  color: var(--colorOnPrimary);
  text-shadow: 0 1px 1px color-mix(in srgb, black 14%, transparent);
  transform: scale(1.02);
}

.bottom-nav button:not(.active) {
  opacity: 0.88;
}

.bottom-nav button.active {
  opacity: 1;
}

.bottom-nav button:focus-visible {
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--colorOnPrimary) 16%, transparent),
    0 0 0 5px color-mix(in srgb, var(--colorAccent) 14%, transparent);
}

.bottom-nav.hidden {
  display: none !important;
}

@media (min-width: 768px) {
  .bottom-nav {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(680px, calc(100% - 24px));
    bottom: max(10px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 480px) {
  :root {
    --bottomNavHeight: 72px;
    --bottomNavInset: 10px;
    --bottomNavPadding: 7px;
    --bottomNavGap: 6px;
  }

  .bottom-nav button {
    font-size: 10px;
  }

  .bottom-nav button svg {
    width: 22px;
    height: 22px;
  }

  .content-area {
    margin-bottom: 102px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bottom-nav,
  .bottom-nav *,
  .bottom-nav *::before,
  .bottom-nav *::after {
    transition: none !important;
    animation: none !important;
  }
}

/*===========================*/
/*        Responsive         */
/*===========================*/
@media only screen and (max-width: 480px) {
  .container {
    padding: 25px 20px;
  }

  h1 {
    font-size: 1.4rem;
  }

  input,
  button {
    font-size: 1rem;
    padding: 12px 14px;
  }
}

@media (min-width: 768px) {
  .slider .slide {
    width: 480px;
  }

  .video {
    width: 180px;
  }

  .video p {
    font-size: 14px;
  }

  .item {
    font-size: 22px;
  }

  .stars .star img {
    width: 100px;
    height: 100px;
  }

  .page-title img {
    width: 100px;
    height: 100px;
  }
}

@media (orientation: landscape) {
  .logo {
    width: 35%;
  }
}

/*===============*/
/*    Loading    */
/*===============*/
.spinner {
  margin: 0 auto;
  width: 60px;
  height: 60px;
  position: relative;
  text-align: center;

  -webkit-animation: sk-rotate 2.0s infinite linear;
  animation: sk-rotate 2.0s infinite linear;
}

.dot1, .dot2 {
  width: 60%;
  height: 60%;
  display: inline-block;
  position: absolute;
  top: 0;
  background-color: var(--colorAccent);
  border-radius: 100%;

  -webkit-animation: sk-bounce 2.0s infinite ease-in-out;
  animation: sk-bounce 2.0s infinite ease-in-out;
}

.dot2 {
  top: auto;
  bottom: 0;
  -webkit-animation-delay: -1.0s;
  animation-delay: -1.0s;
}

@-webkit-keyframes sk-rotate {  
  100% { -webkit-transform: rotate(360deg); }
}

@keyframes sk-rotate {  
  100% { transform: rotate(360deg); -webkit-transform: rotate(360deg); }
}

@-webkit-keyframes sk-bounce {
  0%, 100% { -webkit-transform: scale(0.0); }
  50% { -webkit-transform: scale(1.0); }
}

@keyframes sk-bounce {
  0%, 100% { 
    transform: scale(0.0);
    -webkit-transform: scale(0.0);
  } 
  50% { 
    transform: scale(1.0);
    -webkit-transform: scale(1.0);
  }
}

/*===========================*/
/*      Popup Dialog        */
/*===========================*/
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 16, 31, 0.85);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.popup-dialog {
  background: var(--colorSecondary);
  border-radius: var(--uiRadius);
  padding: 28px 22px;
  width: 92%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 15px 40px rgba(0,0,0,0.6);
  animation: dialogPop 0.25s ease;
}
.popup-dialog p {
  margin: 0 0 24px;
  line-height: 2;
  font-size: 15px;
}

.popup-actions {
  display: flex;
  gap: 12px;
}
.popup-actions button {
  flex: 1;
  margin: 0;
  font-size: 15px;
}
.popup-actions .secondary {
  background: var(--colorSecondaryLight);
}
.popup-actions .secondary:hover {
  filter: brightness(1.1);
  transition: filter 0.3s ease;
}

@keyframes dialogPop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
