/* ===== Variables ===== */
:root {
  --yellow: #ffc107;
  --yellow-light: #fff8e1;
  --yellow-dark: #e6ac00;
  --blue: #1a6fd4;
  --blue-dark: #1558a8;
  --charcoal: #212529;
  --charcoal-light: #343a40;
  --gray-50: #f8f9fa;
  --gray-100: #f1f3f5;
  --gray-200: #e9ecef;
  --gray-400: #adb5bd;
  --gray-600: #6c757d;
  --gray-800: #343a40;
  --white: #ffffff;
  --purple-light: #f3e8ff;
  --purple: #7c3aed;
  --blue-light: #e8f4fd;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 4px 24px rgba(33, 37, 41, 0.08);
  --shadow-lg: 0 12px 40px rgba(33, 37, 41, 0.12);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font: "Vazirmatn", system-ui, sans-serif;
  --header-h: 72px;
}

/* ===== Reset ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--white);
  color: var(--charcoal);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}

.btn--dark {
  background: var(--charcoal);
  color: var(--white);
}

.btn--dark:hover {
  background: var(--charcoal-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn--primary {
  background: var(--blue);
  color: var(--white);
  padding: 14px 28px;
  font-size: 1rem;
}

.btn--primary:hover {
  background: var(--blue-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ===== Header ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-200);
  height: var(--header-h);
  padding-top: env(safe-area-inset-top);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo__img {
  width: auto;
  height: 48px;
  object-fit: contain;
}

.logo__img--sm {
  height: 36px;
}

.header .btn--dark {
  flex-shrink: 0;
  min-height: 44px;
}

/* ===== Player Section ===== */
.player-section {
  padding: 40px 0 64px;
}

.section-head {
  text-align: center;
  margin-bottom: 36px;
}

.section-head h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  margin-bottom: 8px;
}

.section-head__subtitle {
  display: inline-block;
  color: var(--gray-600);
  font-size: 1.05rem;
  font-weight: 500;
  background: var(--yellow-light);
  padding: 6px 20px;
  border-radius: 100px;
}

.player-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  align-items: start;
}

.player-main {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

.video-wrapper {
  position: relative;
  background: var(--charcoal);
  aspect-ratio: 16 / 9;
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}

.video-info {
  padding: 24px;
}

.video-info h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.video-info p {
  color: var(--gray-600);
  font-size: 0.9rem;
  margin-bottom: 0;
}

/* ===== Playlist ===== */
.playlist {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  max-height: calc(56.25vw * 0.55 + 180px);
  display: flex;
  flex-direction: column;
  direction: rtl;
  text-align: right;
}

.playlist__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
  flex-shrink: 0;
  text-align: right;
}

.playlist__header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.playlist__count {
  font-size: 0.8rem;
  color: var(--gray-600);
  background: var(--gray-200);
  padding: 4px 10px;
  border-radius: 100px;
}

.playlist__list {
  overflow-y: auto;
  flex: 1;
  padding: 8px;
}

.playlist__list::-webkit-scrollbar {
  width: 6px;
}

.playlist__list::-webkit-scrollbar-thumb {
  background: var(--gray-400);
  border-radius: 6px;
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
  text-align: right;
  direction: rtl;
  -webkit-tap-highlight-color: transparent;
}

.playlist-item:hover {
  background: var(--gray-50);
}

.playlist-item--active {
  background: var(--yellow-light);
  border-color: var(--yellow);
}

.playlist-item__number {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--gray-100);
  color: var(--charcoal);
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.playlist-item--active .playlist-item__number {
  background: var(--yellow);
  color: var(--charcoal);
}

.playlist-item__info {
  flex: 1;
  min-width: 0;
  text-align: right;
}

.playlist-item__title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.playlist-item__desc {
  font-size: 0.78rem;
  color: var(--gray-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-item__play {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--charcoal);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0;
  transition: var(--transition);
}

.playlist-item:hover .playlist-item__play,
.playlist-item--active .playlist-item__play {
  opacity: 1;
}

.playlist-item--active .playlist-item__play {
  background: var(--yellow-dark);
}

.playlist-item__play svg {
  width: 14px;
  height: 14px;
  color: var(--white);
  margin-right: -2px;
}

/* ===== CTA Section ===== */
.cta-section {
  padding: 56px 0;
  background: linear-gradient(135deg, var(--charcoal) 0%, var(--charcoal-light) 100%);
  color: var(--white);
}

.cta-section__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.cta-section__content h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.cta-section__content p {
  color: var(--gray-400);
  font-size: 0.95rem;
  max-width: 520px;
}

/* ===== Footer ===== */
.footer {
  padding: 28px 0;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 500;
}

.footer__copy {
  font-size: 0.8rem;
  color: var(--gray-600);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .player-layout {
    grid-template-columns: 280px 1fr;
    gap: 20px;
  }

  .playlist {
    max-height: 520px;
  }
}

@media (max-width: 768px) {
  :root {
    --header-h: 64px;
  }

  .container {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .logo__img {
    height: 40px;
  }

  .header .btn--dark {
    padding: 10px 16px;
    font-size: 0.85rem;
  }

  .player-section {
    padding: 24px 0 40px;
  }

  .section-head {
    margin-bottom: 24px;
  }

  .section-head h1 {
    font-size: 1.35rem;
    line-height: 1.5;
  }

  .section-head__subtitle {
    font-size: 0.9rem;
    padding: 5px 16px;
  }

  .player-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .player-main {
    order: 1;
    border-radius: var(--radius-sm);
  }

  .playlist {
    order: 2;
    max-height: none;
    border-radius: var(--radius-sm);
  }

  .playlist__list {
    max-height: 280px;
  }

  .playlist-item__play {
    opacity: 1;
  }

  .playlist-item__desc {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .video-info h3 {
    font-size: 1.05rem;
  }

  .video-info p {
    font-size: 0.85rem;
  }

  .cta-section {
    padding: 40px 0;
    padding-bottom: max(40px, env(safe-area-inset-bottom));
  }

  .cta-section__inner {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }

  .cta-section__content h2 {
    font-size: 1.25rem;
  }

  .cta-section__content p {
    font-size: 0.9rem;
    max-width: 100%;
  }

  .footer {
    padding: 20px 0;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .footer__inner {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }

  .footer__brand {
    flex-direction: column;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  :root {
    --header-h: 60px;
  }

  .logo__img {
    height: 34px;
  }

  .header .btn--dark {
    padding: 8px 14px;
    font-size: 0.8rem;
    gap: 6px;
  }

  .header .btn--dark svg {
    width: 16px;
    height: 16px;
  }

  .player-section {
    padding-top: 20px;
  }

  .section-head {
    margin-bottom: 20px;
  }

  .section-head h1 {
    font-size: 1.2rem;
  }

  .player-main,
  .playlist {
    border-radius: 10px;
    box-shadow: 0 2px 16px rgba(33, 37, 41, 0.06);
  }

  .video-wrapper {
    border-radius: 10px 10px 0 0;
  }

  .video-info {
    padding: 14px 16px;
  }

  .playlist__header {
    padding: 14px 16px;
  }

  .playlist__header h3 {
    font-size: 0.9rem;
  }

  .playlist-item {
    padding: 12px 14px;
    min-height: 52px;
  }

  .playlist-item__number {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }

  .playlist-item__title {
    font-size: 0.88rem;
  }

  .playlist__list {
    max-height: 240px;
    padding: 6px;
  }

  .cta-section__inner .btn,
  .cta-section__inner .btn--primary {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }
}

@media (max-width: 360px) {
  .section-head h1 {
    font-size: 1.1rem;
  }

  .header .btn--dark span,
  .header .btn--dark {
    font-size: 0.78rem;
  }
}
