/* File: /public/styles/clips/clips-base.css */

/* ✅ чтобы на iOS не было “белого свечения” при бонсе
ВАЖНО: не ломаем фон остальных страниц, где клипы подключаются как виджет/модалка */
body.clips{
  background: #000;
}

/* базовый контейнер клипов */
.clips{
  --clips-bg: #000;
  background: var(--clips-bg);
  color: #fff;

  /* ✅ бренд-цвет для клипов с fallback */
  --pz-brand: var(--brand, #7c3aed);
}

/* базовая структура */
.clips-root{ width: 100%; min-height: 0; }
.clips-stage{
  position: relative;
  width: 100%;
  min-height: 0;
  background: var(--clips-bg);
}

.clips-feed{
  background: var(--clips-bg);
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.clips-feed::-webkit-scrollbar{ width: 0; height: 0; }

/* ───────── clip ───────── */

.clip{
  position: relative;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: #000;
}

.clip-inner{
  position: absolute;
  inset: 0;
  background: #000;
}

/* ✅ видео и тапы НЕ под меню (берём --mbh) */
.clip-player{
  position: absolute;
  inset: 0 0 var(--mbh, 0px) 0;
  background: #000;
}

/* ───────── OWN PLAYER ───────── */
.cp-player{
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
}

.cp-poster{
  position: absolute;
  inset: 0;
  background: #000;
  background-size: cover;
  background-position: center center;
  opacity: 1;
  transition: opacity .18s ease;
  pointer-events: none;
}

.cp-video{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  object-fit: cover; /* базово cover (в mobile.css переопределим на contain) */
}

/* слой для тапов — тоже не под меню */
.clip-tap{
  position: absolute;
  inset: 0 0 var(--mbh, 0px) 0;
  z-index: 6;
}

/* ───────── actions ───────── */

.clip-actions{
  position: absolute;
  right: calc(12px + env(safe-area-inset-right, 0px));
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
}

.clip-actions .lk-btn,
.clip-actions .cm-btn,
.clip-actions .sh-btn,
.clip-actions .dl-btn{
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  padding: 0;

  position: relative;
  appearance: none;
  -webkit-appearance: none;

  border: 1px solid color-mix(in oklab, #fff 18%, transparent);
  background: color-mix(in oklab, #000 38%, transparent);
  color: #fff;

  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}

.clip-actions .lk-btn:active,
.clip-actions .cm-btn:active,
.clip-actions .sh-btn:active,
.clip-actions .dl-btn:active{
  transform: translateY(1px);
}

.clip-actions svg{
  width: 22px;
  height: 22px;
}

/* единый счётчик */
.clip-actions .cm-count{
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 900;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in oklab, #fff 18%, transparent);
  background: color-mix(in oklab, #000 45%, transparent);
  color: #fff;
  white-space: nowrap;
}

/* ───────── meta (низ) — оставили только теги ───────── */

.clip-meta{
  position: absolute;
  left: 0;
  right: 0;

  bottom: calc(var(--mbh, 0px) + env(safe-area-inset-bottom, 0px));
  z-index: 5;

  padding: 8px 12px 10px;
  padding-right: 88px;
}

.clip-tags{
  margin-top: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.clip-tag{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;

  border: 1px solid color-mix(in oklab, #fff 16%, transparent);
  background: color-mix(in oklab, #000 52%, transparent);

  font-weight: 900;
  font-size: 11px;
  text-decoration: none;
  color: #fff;
  cursor: pointer;

  text-shadow: 0 2px 10px rgba(0,0,0,.55);
}

/* ───────────────────────────────────────────────
   ✅ TOPBAR (/clips): гамбургер слева, звук справа
   ✅ FIX: больше НЕ используем миллиардные z-index,
           иначе вылезает поверх каталога/чата
─────────────────────────────────────────────── */
.clips-topbar{
  position: fixed;
  left: 0;
  right: 0;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  z-index: 2000; /* ✅ слой UI клипов (ниже каталога/чата) */

  padding-left:  calc(12px + env(safe-area-inset-left, 0px));
  padding-right: calc(12px + env(safe-area-inset-right, 0px));

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  background: transparent;
  pointer-events: none;
}
.clips-topbar > *{ pointer-events: auto; }

body.clips-drawer-open .clips-topbar{
  opacity: 0;
  pointer-events: none;
}

.clips-topbar-left,
.clips-topbar-right{
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* глобальная кнопка звука */
.cp-global-mute{
  width: 44px;
  height: 44px;
  border-radius: 14px;

  border: 1px solid color-mix(in oklab, #fff 18%, transparent);
  background: color-mix(in oklab, #000 38%, transparent);
  color: #fff;

  display: grid;
  place-items: center;

  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;

  overflow: visible;

  /* ✅ чтобы z-index реально работал даже без position:fixed от скрипта */
  position: relative;

  /* ✅ FIX: перебиваем inline z-index (который ставится скриптом при "dock") */
  z-index: 2001 !important;
}
.cp-global-mute svg{ width: 22px; height: 22px; display:block; }

/* aria-pressed="true" = muted
   ✅ контур всегда розовый и без белого бордера внутри (не зависит от .clips-обёртки) */
body.clips .cp-global-mute[aria-pressed="true"],
body.clips--mobile .cp-global-mute[aria-pressed="true"],
body.clips--desktop .cp-global-mute[aria-pressed="true"],
#pzProfileClipsModal .cp-global-mute[aria-pressed="true"]{
  /* убираем белую обводку, которая “внутри” розового контура */
  border-color: transparent;

  outline: 2px solid var(--pz-brand);
  outline-offset: 3px;

  animation: pz-mute-pulse-shadow 1.15s ease-out infinite;
  filter: drop-shadow(0 0 10px var(--pz-brand));
}

@keyframes pz-mute-pulse-shadow{
  0%{
    box-shadow:
      0 0 0 0 color-mix(in oklab, var(--pz-brand) 45%, transparent),
      0 10px 30px rgba(0,0,0,.35);
  }
  70%{
    box-shadow:
      0 0 0 14px transparent,
      0 10px 30px rgba(0,0,0,.35);
  }
  100%{
    box-shadow:
      0 0 0 14px transparent,
      0 10px 30px rgba(0,0,0,.35);
  }
}

@media (prefers-reduced-motion: reduce){
  body.clips .cp-global-mute[aria-pressed="true"],
  body.clips--mobile .cp-global-mute[aria-pressed="true"],
  body.clips--desktop .cp-global-mute[aria-pressed="true"],
  #pzProfileClipsModal .cp-global-mute[aria-pressed="true"]{
    animation: none;
    filter: none;
  }
}

/* ✅ если используешь один mute (topbar), скрываем mute внутри каждого клипа */
body.clips--mobile .cp-player .cp-mute,
#pzProfileClipsModal .cp-player .cp-mute{
  display: none !important;
}

/* ───────────────────────────────────────────── */
/* MOBILE FILTER DRAWER (гамбургер + панель)     */
/* ✅ FIX: нормальные z-index, ниже каталога/чата */
/* ───────────────────────────────────────────── */

.cf-hamburger{
  width: 44px;
  height: 44px;
  border-radius: 14px;

  border: 1px solid color-mix(in oklab, #fff 18%, transparent);
  background: color-mix(in oklab, #000 38%, transparent);
  color: #fff;

  display: grid;
  place-items: center;

  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cf-hamburger svg{ width: 22px; height: 22px; display:block; }

html.clips-drawer-open,
body.clips-drawer-open{ overflow: hidden !important; }

.cf-modal{
  position: fixed;
  inset: 0;
  z-index: 2500; /* ✅ слой клипов (ниже каталога/чата) */

  background: rgba(0,0,0,.82);
  backdrop-filter: blur(6px);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, visibility .18s ease;
}
.cf-modal.is-open{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.cf-panel{
  width: min(86vw, 360px);
  height: 100%;
  background: #050713;
  color: #fff;

  display: flex;
  flex-direction: column;

  transform: translateX(-110%);
  transition: transform .22s ease;
}
.cf-modal.is-open .cf-panel{ transform: translateX(0); }

.cf-tabs{
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cf-tab{
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-weight: 950;
  font-size: 12px;
  cursor: pointer;
}

.cf-tab.is-active{
  background: rgba(255,255,255,.92);
  color: #000;
  border-color: transparent;
}

.cf-head{
  padding: 0 14px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.cf-search{
  flex: 1;
  height: 42px;
  border-radius: 14px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.14);
  color: #fff;
  padding: 0 12px;
  outline: none;
}

.cf-close{
  height: 42px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-weight: 900;
}

.cf-tags{
  flex: 1;
  overflow: auto;
  padding: 12px 14px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-content: flex-start;
}

.cf-tagbtn{
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in oklab, #fff 16%, transparent);
  background: color-mix(in oklab, #000 35%, transparent);
  color: #fff;
  font-weight: 900;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.cf-tagbtn.is-on{
  background: rgba(255,255,255,.92);
  color: #000;
  border-color: transparent;
}

.cf-foot{
  padding: 12px 14px calc(var(--mbh, 0px) + env(safe-area-inset-bottom, 0px) + 12px);
  border-top: 1px solid rgba(255,255,255,.12);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.cf-reset{
  height: 38px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-weight: 900;
}
.cf-reset[disabled]{ opacity: .45; }