/* My Zameen YouTube sliders — dark UI, Manrope inherits from theme */

.mz-yt-sliders-wrap {
  margin: 40px auto 48px;
  max-width: 100%;
}

.mz-yt-section {
  padding: 48px 0;
}

.mz-yt-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.mz-yt-section__title {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: 32px;
  line-height: 40px;
  color: #e6e7e8;
}

.mz-yt-section__view-all {
  font-family: "Manrope", sans-serif;
  font-weight: 600;
  font-size: 20px;
  line-height: 28px;
  color: #fff !important;
  text-decoration: none;
  white-space: nowrap;
}

.mz-yt-section__view-all:hover {
  text-decoration: underline;
  color: #e6e7e8;
}

/*
 * Full-width swiper; prev/next are out of document flow so slide width matches
 * a no-arrow layout. Buttons sit just outside the track (translate), not in a flex gap.
 */
.mz-yt-section__slider-row {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

.mz-yt-shorts-view-more-wrap {
  display: none;
}

.mz-yt-section__slider.swiper {
  position: relative;
  width: 100%;
  max-width: 100%;
  padding: 0;
  margin: 0;
}

.mz-yt-swiper .swiper-slide {
  height: auto;
}

/* Standard 16:9 rows: wider cards on small screens (~300px design) */
@media (max-width: 639px) {
  .mz-yt-section:not(.mz-yt-section--layout-shorts) .mz-yt-swiper .swiper-slide {
    width: min(300px, calc(100vw - 40px));
    box-sizing: border-box;
  }
}

.mz-yt-card {
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  padding: 0;
  overflow: hidden;
  background: transparent;
}

/* Standard (large) cards — Figma 16:9 frame, 8px radius */
.mz-yt-card:not(.mz-yt-card--shorts) {
  border-radius: 8px;
}

.mz-yt-card:not(.mz-yt-card--shorts) .mz-yt-card__media {
  border-radius: 8px;
}

.mz-yt-card__media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #0a0c0e;
  align-self: stretch;
  width: 100%;
}

/* Shorts / Mini Videos — vertical 9:16, 20px radius, fixed slide width via Swiper */
.mz-yt-section--layout-shorts .mz-yt-swiper .swiper-slide {
  width: 215px;
  height: auto;
}

.mz-yt-card--shorts {
  width: 100%;
  border-radius: 0px;
}

.mz-yt-card--shorts .mz-yt-card__media {
  aspect-ratio: 9 / 16;
  border-radius: 20px;
  flex: 0 0 auto;
  width: 100%;
}

.mz-yt-card--shorts .mz-yt-card__playicon {
  width: 78px;
  height: 78px;
  margin: -39px 0 0 -39px;
  background: rgba(18, 25, 35, 0.5);
}

.mz-yt-card--shorts .mz-yt-card__playicon::after {
  border-width: 11px 0 11px 17px;
}

.mz-yt-card--shorts .mz-yt-card__title {
  font-weight: 600;
  font-size: 16px;
  line-height: 24px;
}

.mz-yt-card__poster {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s ease;
}

.mz-yt-card__preview {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.mz-yt-card__iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
}

/* Hover preview: YouTube-style mute / unmute (desktop hover only) */
.mz-yt-card__preview-sound {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 5;
  pointer-events: auto;
}

.mz-yt-card__sound-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  margin: 0;
  border: none;
  border-radius: 999px;
  background: rgba(11, 12, 13, 0.85);
  color: #f7f9fa;
  font-family: "Manrope", sans-serif;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  transition: background 0.15s ease, transform 0.15s ease;
}

.mz-yt-card__sound-btn:hover {
  background: rgba(30, 34, 38, 0.95);
  transform: scale(1.02);
}

.mz-yt-card__sound-btn:focus {
  outline: 2px solid #0cf19e;
  outline-offset: 2px;
}

.mz-yt-card__sound-btn:disabled {
  opacity: 0.45;
  cursor: wait;
  transform: none;
}

.mz-yt-card__sound-btn::before {
  content: "";
  display: block;
  width: 16px;
  height: 12px;
  flex-shrink: 0;
  background: no-repeat center / contain;
  opacity: 0.95;
}

/* Muted (default): speaker with slash */
.mz-yt-card__sound-btn[aria-pressed="true"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f7f9fa' stroke-width='2'%3E%3Cpath d='M11 5L6 9H2v6h4l5 4V5z'/%3E%3Cpath d='M22 9l-6 6M16 9l6 6'/%3E%3C/svg%3E");
}

/* Unmuted */
.mz-yt-card__sound-btn[aria-pressed="false"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f7f9fa' stroke-width='2'%3E%3Cpath d='M11 5L6 9H2v6h4l5 4V5z'/%3E%3Cpath d='M15.54 8.46a5 5 0 010 7.07M19.07 4.93a9 9 0 010 14.14'/%3E%3C/svg%3E");
}

.mz-yt-card__playicon {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 62.51px;
  height: 62.51px;
  margin: -31.25px 0 0 -31.25px;
  border-radius: 50%;
  background: rgba(18, 25, 35, 0.8);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* Hide play overlay while hovering thumbnail (cursor / hover devices only) */
@media (hover: hover) and (pointer: fine) {
  .mz-yt-card__media:hover .mz-yt-card__playicon {
    opacity: 0;
  }

  /* Shorts hover preview: keep duration + mute; hide title/meta only. */
  .mz-yt-card--shorts:has(.mz-yt-card__iframe) .mz-yt-card__body {
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important;
  }

  .mz-yt-card--shorts:has(.mz-yt-card__iframe) .mz-yt-card__duration {
    z-index: 6;
  }
}

.mz-yt-card__playicon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-40%, -50%);
  border-style: solid;
  border-width: 9px 0 9px 14px;
  border-color: transparent transparent transparent #e6e7e8;
}

.mz-yt-card__duration {
  position: absolute;
  right: 4px;
  bottom: 4px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  min-width: 43px;
  min-height: 28px;
  box-sizing: border-box;
  border-radius: 4px;
  background: rgba(11, 12, 13, 0.8);
  color: #fff;
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  pointer-events: none;
}

.mz-yt-card__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  align-self: stretch;
  width: 100%;
  padding: 0;
  margin: 0;
}

.mz-yt-card__title {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: 18px;
  line-height: 24px;
  color: #e6e7e8;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mz-yt-card--shorts .mz-yt-card__title {
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.mz-yt-card__meta {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: #84898e;
}

/* Swiper nav: siblings of .swiper, absolutely placed outside the track */
.mz-yt-section__slider-row .mz-yt-nav {
  position: absolute;
  top: calc(50% - 32px);
  z-index: 4;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: #22272c;
  color: #f7f9fa;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease, background 0.2s ease, visibility 0.2s ease;
}

.mz-yt-section__slider-row .mz-yt-nav--prev {
  left: 0;
  transform: translate(calc(-100% - 12px), -50%);
}

.mz-yt-section__slider-row .mz-yt-nav--next {
  right: 0;
  transform: translate(calc(100% + 12px), -50%);
}

body.rtl .mz-yt-section__slider-row .mz-yt-nav--prev {
  left: auto;
  right: 0;
  transform: translate(calc(100% + 12px), -50%);
}

body.rtl .mz-yt-section__slider-row .mz-yt-nav--next {
  right: auto;
  left: 0;
  transform: translate(calc(-100% - 12px), -50%);
}

.mz-yt-section__slider-row .mz-yt-nav:hover {
  background: #2e3237;
}

.mz-yt-nav--hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.mz-yt-section__slider-row .mz-yt-nav::after {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  margin: 0;
  flex-shrink: 0;
  border-right: 2px solid #f7f9fa;
  border-bottom: 2px solid #f7f9fa;
  transform-origin: 50% 50%;
}

/* Border L + rotate reads off-center; translate before rotate optically centers chevron */
.mz-yt-section__slider-row .mz-yt-nav--prev::after {
  transform: translate(1.5px, 0) rotate(135deg);
}

.mz-yt-section__slider-row .mz-yt-nav--next::after {
  transform: translate(-1.5px, 0) rotate(-45deg);
}

.swiper-button-disabled.mz-yt-nav {
  opacity: 0.35;
  pointer-events: none;
}

/* Modal */
.mz-yt-modal[hidden] {
  display: none;
}

.mz-yt-modal {
  position: fixed;
  inset: 0;
  z-index: 1000000;
}

.mz-yt-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.mz-yt-modal__dialog {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(960px, 92vw);
  background: #101214;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.mz-yt-modal__close {
  position: absolute;
  right: 10px;
  top: 8px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.mz-yt-modal__close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.mz-yt-modal__frame-wrap {
  position: relative;
  padding-top: 56.25%;
}

.mz-yt-modal__iframe-shell {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.mz-yt-modal__iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Shorts-style modal: tall 9:16 frame (same embed as horizontal) */
.mz-yt-modal--shorts .mz-yt-modal__dialog {
  width: min(406px, calc(100vw - 48px));
  max-height: 92vh;
}

.mz-yt-modal--shorts .mz-yt-modal__frame-wrap {
  padding-top: 177.7777%;
}

.mz-yt-modal--reels-mobile .mz-yt-modal__backdrop {
  background: #000;
}

.mz-yt-modal--reels-mobile .mz-yt-modal__dialog {
  left: 0;
  top: 0;
  transform: none;
  width: 100vw;
  height: 100vh;
  max-height: none;
  border-radius: 0;
  background: #000;
}

.mz-yt-modal--reels-mobile .mz-yt-modal__frame-wrap {
  height: 100%;
  padding-top: 0;
}

.mz-yt-modal--reels-mobile .mz-yt-modal__reel-mute-btn {
  position: absolute;
  left: 12px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 25;
  pointer-events: auto;
}

.mz-yt-modal--reels-mobile .mz-yt-modal__reel-mute-btn[hidden] {
  display: none !important;
}

.mz-yt-modal--reels-mobile .mz-yt-modal__iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* Full-screen Shorts: swipes hit the iframe first in DOM stacking; layer sits on top only for reels. */
.mz-yt-modal__reel-swipe-layer {
  display: none;
}

.mz-yt-modal--reels-mobile .mz-yt-modal__reel-swipe-layer {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: auto;
  touch-action: none;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}

.mz-yt-modal--reels-mobile .mz-yt-modal__close {
  z-index: 20;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.68);
}

html.mz-yt-modal-open {
  overflow: hidden;
}

/* Modal: hide custom mute (reel + shared sound-btn class); use YouTube player controls / GTM video trigger. */
#mz-yt-modal:not([hidden]) .mz-yt-modal__reel-mute-btn,
#mz-yt-modal:not([hidden]) .mz-yt-card__sound-btn {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* While modal is open, hide card hover sound controls behind overlay. */
html.mz-yt-modal-open .mz-yt-sliders-wrap .mz-yt-card__sound-btn {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Mobile: no arrows — swipe the track */
@media (max-width: 767px) {
  .mz-yt-section  {
    padding: 16px 0;
  }
  .mz-yt-sliders-wrap{
    margin: 16px auto;
  }
  .mz-yt-section__slider-row .mz-yt-nav {
    display: none !important;
  }

  /* Shorts on small viewports: thumbnail + duration; title/meta hidden until modal. */
  .mz-yt-card--shorts .mz-yt-card__body {
    display: none !important;
  }

  .mz-yt-section--shorts-mobile-grid .mz-yt-section__slider.swiper {
    max-width: 343px;
    margin: 0 auto;
    overflow: visible;
  }

  .mz-yt-section--shorts-mobile-grid .mz-yt-section__slider.swiper .swiper-wrapper {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    transform: none !important;
    width: 100% !important;
  }

  .mz-yt-section--shorts-mobile-grid .mz-yt-section__slider.swiper .swiper-slide {
    display: block;
    width: auto !important;
    margin-right: 0 !important;
  }

  .mz-yt-section--shorts-mobile-grid .mz-yt-section__slider.swiper .swiper-slide[data-mz-short-hidden="1"] {
    display: none !important;
  }

  .mz-yt-section--shorts-mobile-grid .mz-yt-card--shorts {
    position: relative;
    height: 301.23px;
    gap: 0;
  }

  .mz-yt-section--shorts-mobile-grid .mz-yt-card--shorts .mz-yt-card__media {
    position: relative;
    width: 100%;
    height: 301.23px;
    aspect-ratio: auto;
    border-radius: 8px;
  }

  .mz-yt-section--shorts-mobile-grid .mz-yt-card--shorts .mz-yt-card__meta,
  .mz-yt-section--shorts-mobile-grid .mz-yt-card--shorts .mz-yt-card__playicon {
    display: none;
  }

  /* View more — mobile Shorts grid (Figma Title 1 / Body2 Medium 500) */
  .mz-yt-shorts-view-more-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 16px;
  }

  .mz-yt-shorts-view-more {
    box-sizing: border-box;
    display: inline-flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex: none;
    width: fit-content;
    min-width: 101px;
    height: 40px;
    padding: 0 12px;
    margin: 0;
    border: 1px solid #5b6169;
    border-radius: 6px;
    background: transparent;
    color: #ffffff;
    font-family: "Manrope", sans-serif;
    font-style: normal;
    font-weight: 500;
    font-size: 16px;
    line-height: 24px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.15s ease, background-color 0.15s ease;
  }

  .mz-yt-shorts-view-more:hover {
    border-color: #787f89;
    background-color: rgba(255, 255, 255, 0.04);
  }

  .mz-yt-shorts-view-more:focus-visible {
    outline: 2px solid rgba(230, 231, 232, 0.55);
    outline-offset: 2px;
  }

  .mz-yt-shorts-view-more[hidden] {
    display: none !important;
  }
}

@media (max-width: 639px) {
  .mz-yt-section__title {
    font-size: 24px;
    line-height: 32px;
  }

  .mz-yt-section__view-all {
    font-size: 16px;
    line-height: 24px;
  }

  .mz-yt-section--layout-shorts .mz-yt-swiper .swiper-slide {
    width: min(211.2px, 72vw);
  }

  .mz-yt-section--shorts-mobile-grid .mz-yt-section__slider.swiper .swiper-slide {
    width: auto !important;
  }
}

/* ---------- Section archive (/myzameen-videos/1–3/) ---------- */
.mz-yt-archive {
  margin: 24px auto 48px;
  max-width: 100%;
}

.mz-yt-archive__inner {
  max-width: 100%;
}

.mz-yt-archive__banner {
  margin-bottom: 28px;
  padding: 28px 24px;
  border-radius: 16px;
  background: linear-gradient(135deg, #1a1d21 0%, #101214 50%, #0d1519 100%);
  border: 1px solid #2e3237;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.mz-yt-archive__title {
  margin: 0 0 8px;
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1.2;
  color: #e6e7e8;
}

.mz-yt-archive__subtitle {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: 16px;
  line-height: 24px;
  color: #84898e;
}

.mz-yt-archive__empty,
.mz-yt-archive__404 {
  margin: 24px 0;
  font-family: "Manrope", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #84898e;
}

.mz-yt-archive__grid {
  display: grid;
  align-items: start;
  gap: 20px;
}

.mz-yt-archive__grid--standard {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.mz-yt-archive__grid--shorts {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 24px;
}

.mz-yt-archive__grid .mz-yt-card {
  width: 100%;
  max-width: 100%;
}

.mz-yt-archive__grid--shorts .mz-yt-card--shorts {
  max-width: 220px;
  margin: 0 auto;
}

@media (max-width: 639px) {
  .mz-yt-archive__banner {
    padding: 20px 16px;
  }
}
