/* ══════════════════════════════════════════════════════════════
   Ailo Chat — Видео карусель + попап-плеер
   Горизонтальные карточки 16:9 · MP4 · попап с переходом к товару
   ══════════════════════════════════════════════════════════════ */

/* ── СЕКЦИЯ ─────────────────────────────────────────────────── */
.ailo-videos { display: flex; flex-direction: column; gap: 8px; }

.ailo-videos__head {
  display: flex; align-items: baseline; justify-content: space-between;
}

.ailo-videos__title {
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ailo-text-3);
}

.ailo-videos__all {
  font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ailo-brand);
  background: none; border: none; padding: 0; cursor: pointer;
  text-decoration: none;
}

/* ── СКРОЛЛ-РЯД ─────────────────────────────────────────────── */
.ailo-videos__scroll {
  display: flex; gap: 10px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 0 14px;
  margin: 0 -14px;          /* full-bleed внутри 14px-паддинга чата */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.ailo-videos__scroll::-webkit-scrollbar { display: none; }

/* ── КАРТОЧКА ───────────────────────────────────────────────── */
.ailo-video-card {
  flex: 0 0 220px; width: 220px;
  scroll-snap-align: start;
  background: transparent; border: none; padding: 0;
  cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 8px;
  font-family: inherit;
}

.ailo-video-card__thumb {
  width: 220px; height: 124px;          /* 16:9 */
  border-radius: 12px;
  position: relative; overflow: hidden;
  background: #2A1F1A;                  /* fallback пока MP4 грузится */
}

.ailo-video-card__thumb video,
.ailo-video-card__thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

.ailo-video-card__play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(0,0,0,0.5);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: 1.5px solid rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.ailo-video-card__play svg { width: 14px; height: 14px; fill: white; }

.ailo-video-card__duration {
  position: absolute; bottom: 6px; right: 6px;
  padding: 2px 7px; border-radius: 6px;
  background: rgba(0,0,0,0.6);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  font-size: 10px; font-weight: 500; color: #fff;
  letter-spacing: 0.02em;
}

.ailo-video-card__sale {
  position: absolute; top: 6px; left: 6px;
  padding: 2px 8px; border-radius: 100px;
  background: var(--ailo-brand);
  font-size: 9px; font-weight: 700; color: #fff;
  letter-spacing: 0.04em; text-transform: uppercase;
}

.ailo-video-card__cat {
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ailo-text-3);
  margin-bottom: 3px; padding: 0 2px;
}

.ailo-video-card__name {
  font-size: 12px; font-weight: 600; line-height: 1.35;
  color: var(--ailo-text-1);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 32px;
  margin: 0 0 4px;
  padding: 0 2px;
}

.ailo-video-card__price-row {
  display: flex; align-items: baseline; gap: 6px;
  padding: 0 2px;
}
.ailo-video-card__price {
  font-size: 12px; font-weight: 700;
  color: var(--ailo-text-1);
  letter-spacing: -0.01em;
}
.ailo-video-card__price-old {
  font-size: 10px; color: var(--ailo-text-3);
  text-decoration: line-through;
}

/* ══════════════════════════════════════════════════════════════
   ПОПАП-ПЛЕЕР
   ══════════════════════════════════════════════════════════════ */
.ailo-video-popup {
  position: absolute; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.75);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: ailoBackdropIn 200ms ease;
}

.ailo-video-popup__inner {
  width: 100%; max-width: 340px;
  border-radius: 16px; overflow: hidden;
  background: #0F0D0B;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: ailoPopupIn 220ms cubic-bezier(.2,.9,.3,1.2);
}

.ailo-video-popup__player {
  aspect-ratio: 16/9;
  background: #2A1F1A;
  position: relative; overflow: hidden;
}

.ailo-video-popup__player video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

.ailo-video-popup__center {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%,-50%);
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 2px solid rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.ailo-video-popup__center svg { width: 22px; height: 22px; fill: #fff; }
.ailo-video-popup--playing .ailo-video-popup__center { display: none; }

.ailo-video-popup__top {
  position: absolute; top: 10px; left: 10px; right: 10px;
  display: flex; justify-content: space-between; align-items: center;
  pointer-events: none;
}
.ailo-video-popup__btn {
  pointer-events: auto;
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: rgba(0,0,0,0.5);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.ailo-video-popup__btn svg { width: 14px; height: 14px; }

.ailo-video-popup__progress {
  position: absolute; left: 10px; right: 10px; bottom: 10px;
}
.ailo-video-popup__bar {
  height: 3px; border-radius: 100px;
  background: rgba(255,255,255,0.2); overflow: hidden;
}
.ailo-video-popup__bar-fill {
  height: 100%; width: 0%;
  background: #fff; border-radius: 100px;
  transition: width 100ms linear;
}
.ailo-video-popup__time {
  display: flex; justify-content: space-between;
  margin-top: 5px;
  font-size: 9px; color: rgba(255,255,255,0.7);
  letter-spacing: 0.02em;
}

.ailo-video-popup__info {
  padding: 14px 16px 16px;
  background: var(--ailo-bg);
}
.ailo-video-popup__cat {
  font-size: 9px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ailo-text-3); margin-bottom: 5px;
}
.ailo-video-popup__name {
  font-size: 15px; font-weight: 600; line-height: 1.35;
  color: var(--ailo-text-1);
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}
.ailo-video-popup__price-row {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 12px;
}
.ailo-video-popup__price {
  font-size: 18px; font-weight: 700; color: var(--ailo-text-1);
  letter-spacing: -0.01em;
}
.ailo-video-popup__price-old {
  font-size: 12px; color: var(--ailo-text-3);
  text-decoration: line-through;
}
.ailo-video-popup__discount {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--ailo-brand);
}

.ailo-video-popup__cta {
  width: 100%; height: 42px;
  border-radius: 100px; border: none;
  background: var(--ailo-brand); color: #fff;
  font-size: 13px; font-weight: 600; letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(255,45,135,0.35);
  font-family: inherit;
  text-decoration: none;
  display: flex; align-items: center; justify-content: center;
}

@keyframes ailoBackdropIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes ailoPopupIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

/* ══════════════════════════════════════════════════════════════
   HTML-ШАБЛОН ДЛЯ СПРАВКИ

   <section class="ailo-videos">
     <div class="ailo-videos__head">
       <div class="ailo-videos__title">Видео товаров</div>
       <a class="ailo-videos__all" href="/videos">Все →</a>
     </div>
     <div class="ailo-videos__scroll">

       <button type="button" class="ailo-video-card" data-video-id="123">
         <div class="ailo-video-card__thumb">
           <img src="poster-123.jpg" alt="" loading="lazy" />
           <span class="ailo-video-card__sale">−21%</span>
           <span class="ailo-video-card__duration">0:24</span>
           <span class="ailo-video-card__play">
             <svg viewBox="0 0 24 24"><polygon points="5 3 19 12 5 21 5 3"/></svg>
           </span>
         </div>
         <div class="ailo-video-card__cat">Двери</div>
         <h4 class="ailo-video-card__name">Скрытая дверь под покраску</h4>
         <div class="ailo-video-card__price-row">
           <span class="ailo-video-card__price">₾ 1 240</span>
           <span class="ailo-video-card__price-old">₾ 1 580</span>
         </div>
       </button>

       …другие карточки…
     </div>
   </section>

   <!-- ПОПАП -->
   <div class="ailo-video-popup" role="dialog" aria-modal="true" data-video-id="123">
     <div class="ailo-video-popup__inner">
       <div class="ailo-video-popup__player">
         <video src="video-123.mp4" playsinline muted preload="metadata"></video>
         <button class="ailo-video-popup__center" aria-label="Play">
           <svg viewBox="0 0 24 24"><polygon points="5 3 19 12 5 21 5 3"/></svg>
         </button>
         <div class="ailo-video-popup__top">
           <button class="ailo-video-popup__btn" data-action="mute" aria-label="Mute">
             <!-- mute icon -->
           </button>
           <button class="ailo-video-popup__btn" data-action="close" aria-label="Close">
             <!-- close icon -->
           </button>
         </div>
         <div class="ailo-video-popup__progress">
           <div class="ailo-video-popup__bar">
             <div class="ailo-video-popup__bar-fill"></div>
           </div>
           <div class="ailo-video-popup__time">
             <span data-current>0:00</span>
             <span data-total>0:24</span>
           </div>
         </div>
       </div>
       <div class="ailo-video-popup__info">
         <div class="ailo-video-popup__cat">Двери</div>
         <h3 class="ailo-video-popup__name">Скрытая дверь под покраску</h3>
         <div class="ailo-video-popup__price-row">
           <span class="ailo-video-popup__price">₾ 1 240</span>
           <span class="ailo-video-popup__price-old">₾ 1 580</span>
           <span class="ailo-video-popup__discount">−21%</span>
         </div>
         <a class="ailo-video-popup__cta" href="/product/123">Перейти к товару</a>
       </div>
     </div>
   </div>

   ── АДМИНКА (WordPress / WooCommerce) ──────────────────────────
   • ACF Repeater на товаре (или мета-поле): video_url (MP4),
     poster_url (JPG), duration_label (например "0:24")
   • На странице где показывать карусель — выбрать товары
     через ACF Relationship / shortcode атрибут [ailo_videos ids="12,34,56"]
   • PHP-цикл рендерит .ailo-video-card по ID товаров
   • JS: при клике на .ailo-video-card[data-video-id="X"] — открыть
     попап с MP4 этого товара. data-action="close" / "mute" — управление.
   ══════════════════════════════════════════════════════════════ */
