/* Видео-виджет на главной (templates/include/video-widget.tpl.inc) */

/* Карточка стоит над чат-кнопкой: та на left 50 / bottom 50, высотой 70px */
.video-widget {
  position: fixed;
  left: 50px;
  bottom: 136px;
  z-index: 999;
  width: 140px;
  height: 200px;
  animation: videoWidgetIn 0.6s cubic-bezier(.2, .8, .2, 1);
}

.video-widget[hidden],
.video-widget-modal[hidden] {
  display: none;
}

.video-widget__preview {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 18px;
  overflow: hidden;
  background: #1d1d1d;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.video-widget__preview:hover,
.video-widget__preview:focus-visible {
  transform: scale(1.05);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.36);
  outline: none;
}

.video-widget__preview-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* Значок «play» внизу карточки */
.video-widget__play {
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  border-radius: 50%;
  background: rgba(58, 170, 53, 0.92);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.video-widget__play::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -7px 0 0 -4px;
  border-style: solid;
  border-width: 7px 0 7px 12px;
  border-color: transparent transparent transparent #fff;
}

.video-widget__hide {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #333;
  font-size: 18px;
  line-height: 24px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.video-widget__hide:hover {
  background: #f0f0f0;
}

/* Окно с видео */
.video-widget-modal {
  position: fixed;
  inset: 0;
  z-index: 1040; /* ниже модалок bootstrap (1050), чтобы «Записаться» открылась поверх */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.8);
  animation: videoWidgetFade 0.25s ease;
}

.video-widget-modal__box {
  position: relative;
  height: min(86vh, 760px);
  aspect-ratio: 9 / 16;
  max-width: 100%;
}

.video-widget-modal__video {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  background: #000;
  object-fit: contain;
}

.video-widget-modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.video-widget-modal__close:hover {
  background: rgba(0, 0, 0, 0.8);
}

.video-widget-modal__cta {
  position: absolute;
  left: 50%;
  bottom: 99px; /* над панелью управления видео */
  transform: translateX(-50%);
  padding: 12px 24px;
  border: none;
  border-radius: 999px;
  background: #3aaa35;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: background 0.25s ease;
}

.video-widget-modal__cta:hover {
  background: #2f8e2b;
}

body.video-widget-open {
  overflow: hidden;
}

@keyframes videoWidgetIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: none; }
}

@keyframes videoWidgetFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (max-width: 768px) {
  /* чат-кнопка тут на left 30 / bottom 30 */
  .video-widget {
    left: 30px;
    bottom: 114px;
    width: 100px;
    height: 144px;
  }

  .video-widget__preview {
    border-radius: 14px;
  }

  .video-widget__play {
    width: 28px;
    height: 28px;
    margin-left: -14px;
    bottom: 8px;
  }

  .video-widget__play::before {
    margin: -6px 0 0 -3px;
    border-width: 6px 0 6px 10px;
  }

  .video-widget-modal {
    padding: 0;
  }

  .video-widget-modal__box {
    width: 100%;
    height: 100%;
    max-height: 100%;
    aspect-ratio: auto;
  }

  .video-widget-modal__video {
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .video-widget,
  .video-widget-modal {
    animation: none;
  }
}
