/**
 * Стили для кастомного блока "Видео"
 */

/* Стили для контейнера блока */

.inscale-format-video:before {
  background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M19.1189 6V18C19.1189 19.105 18.2239 20 17.1189 20H6.88086C5.77586 20 4.88086 19.105 4.88086 18V6C4.88086 4.895 5.77586 4 6.88086 4H17.1199C18.2239 4 19.1189 4.895 19.1189 6Z' stroke='%23F2F3F5' stroke-width='1.5996' stroke-linecap='round' stroke-linejoin='round' /%3E%3Cpath d='M19.1191 6H20.7211C21.5491 6 22.2211 6.672 22.2211 7.5V16.5C22.2211 17.328 21.5491 18 20.7211 18H19.1191' stroke='%23F2F3F5' stroke-width='1.4685' stroke-linecap='round' stroke-linejoin='round' /%3E%3Cpath d='M4.88034 18H3.27734C2.44934 18 1.77734 17.328 1.77734 16.5V7.5C1.77734 6.672 2.44934 6 3.27734 6H4.87934' stroke='%23F2F3F5' stroke-width='1.4685' stroke-linecap='round' stroke-linejoin='round' /%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M11.4024 9.83618L14.1734 11.4752C14.5724 11.7112 14.5724 12.2892 14.1734 12.5252L11.4024 14.1642C10.9954 14.4052 10.4824 14.1112 10.4824 13.6392V10.3612C10.4824 9.88818 10.9964 9.59518 11.4024 9.83618V9.83618Z' stroke='%23F2F3F5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' /%3E%3C/svg%3E");
}

.inscale-format-video:before, .block-editor-inserter__quick-inserter button.components-button:hover .inscale-format-video:before {
  background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M19.1189 6V18C19.1189 19.105 18.2239 20 17.1189 20H6.88086C5.77586 20 4.88086 19.105 4.88086 18V6C4.88086 4.895 5.77586 4 6.88086 4H17.1199C18.2239 4 19.1189 4.895 19.1189 6Z' stroke='%23F2F3F5' stroke-width='1.5996' stroke-linecap='round' stroke-linejoin='round' /%3E%3Cpath d='M19.1191 6H20.7211C21.5491 6 22.2211 6.672 22.2211 7.5V16.5C22.2211 17.328 21.5491 18 20.7211 18H19.1191' stroke='%23F2F3F5' stroke-width='1.4685' stroke-linecap='round' stroke-linejoin='round' /%3E%3Cpath d='M4.88034 18H3.27734C2.44934 18 1.77734 17.328 1.77734 16.5V7.5C1.77734 6.672 2.44934 6 3.27734 6H4.87934' stroke='%23F2F3F5' stroke-width='1.4685' stroke-linecap='round' stroke-linejoin='round' /%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M11.4024 9.83618L14.1734 11.4752C14.5724 11.7112 14.5724 12.2892 14.1734 12.5252L11.4024 14.1642C10.9954 14.4052 10.4824 14.1112 10.4824 13.6392V10.3612C10.4824 9.88818 10.9964 9.59518 11.4024 9.83618V9.83618Z' stroke='%23F2F3F5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' /%3E%3C/svg%3E");
}

.block-editor-inserter__quick-inserter .dashicons-inscale-format-icon.inscale-format-video:before {
  background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M19.1189 6V18C19.1189 19.105 18.2239 20 17.1189 20H6.88086C5.77586 20 4.88086 19.105 4.88086 18V6C4.88086 4.895 5.77586 4 6.88086 4H17.1199C18.2239 4 19.1189 4.895 19.1189 6Z' stroke='%237385a2' stroke-width='1.5996' stroke-linecap='round' stroke-linejoin='round' /%3E%3Cpath d='M19.1191 6H20.7211C21.5491 6 22.2211 6.672 22.2211 7.5V16.5C22.2211 17.328 21.5491 18 20.7211 18H19.1191' stroke='%237385a2' stroke-width='1.4685' stroke-linecap='round' stroke-linejoin='round' /%3E%3Cpath d='M4.88034 18H3.27734C2.44934 18 1.77734 17.328 1.77734 16.5V7.5C1.77734 6.672 2.44934 6 3.27734 6H4.87934' stroke='%237385a2' stroke-width='1.4685' stroke-linecap='round' stroke-linejoin='round' /%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M11.4024 9.83618L14.1734 11.4752C14.5724 11.7112 14.5724 12.2892 14.1734 12.5252L11.4024 14.1642C10.9954 14.4052 10.4824 14.1112 10.4824 13.6392V10.3612C10.4824 9.88818 10.9964 9.59518 11.4024 9.83618V9.83618Z' stroke='%237385a2' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' /%3E%3C/svg%3E");
}

.components-button[aria-label="Видео"] {
  display: none !important;
}

.wp-block-inscale-video-block {
  margin: 0;
  padding: 0;
  max-width: 100%;
}

/* Обертка для iframe с сохранением соотношения сторон */
.inscale-video-container {
  position: relative;
  padding-bottom: 56.25%;
  /* Соотношение 16:9 */
  height: 0;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}

/* Стили для соотношения 4:3 */
.inscale-video-container[data-aspect-ratio="4:3"] {
  padding-bottom: 75%;
  /* Соотношение 4:3 */
}

/* Стили для iframe */
.inscale-video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Стили для заглушки в редакторе */
.inscale-video-placeholder-editor {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #1d222a;
  color: var(--white);
  overflow: hidden;
  border-radius: 10px;
  overflow: hidden;
}

/* Стили для превью видео */
.inscale-video-preview {
  position: absolute;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  overflow: hidden;
  background-image: linear-gradient(45deg, #2a2a2a, #1a1a1a);
  color: #fff;
  display: none;
}

/* Кнопка воспроизведения */
.inscale-video-play-button {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  margin-bottom: 20px;
  display: none;
}

.inscale-video-play-button:before {
  content: "";
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 15px 0 15px 25px;
  border-color: transparent transparent transparent #333;
  margin-left: 5px;
}

/* Информация о провайдере */
.inscale-video-preview-info {
  font-size: 14px;
  font-weight: 600;
  padding: 6px 14px;
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 20px;
  margin-top: 5px;
}

/* Оформление для разных провайдеров */
.inscale-video-preview[data-provider="vk"] {
  background-image: linear-gradient(45deg, #4a76a8, #2e5a88);
}

.inscale-video-preview[data-provider="rutube"] {
  background-image: linear-gradient(45deg, #c62c31, #a51f24);
}

/* Стили для плейсхолдера видео */
.inscale-video-placeholder {
  background-color: #f0f0f0;
  padding: 20px;
  border-radius: 5px;
  text-align: center;
  border: 1px dashed #ccc;
}

.inscale-video-placeholder p {
  margin: 0 0 10px 0;
  color: #666;
}

/* Стили для ошибки */
.inscale-video-error {
  background-color: #ffebee;
  padding: 10px;
  border-radius: 5px;
  color: #c62828;
  border: 1px solid #ef9a9a;
  margin-top: 10px;
}

/* Стили поля ввода URL */
.inscale-url-input {
  width: 100%;
  max-width: 100%;
  margin-bottom: 0;
}

/* Контейнер для поля ввода и кнопки */
.inscale-input-with-button {
  display: flex;
  width: 100%;
}

/* Стили для блока видео */
[data-type="inscale/video-block"] .components-placeholder__instructions {
  flex-basis: 100%;
}

[data-type="inscale/video-block"] .inscale-url-input {
  max-width: 456px;
}

[data-type="inscale/video-block"] .components-placeholder__fieldset {}

[data-type="inscale/video-block"] .components-base-control__field {
  margin: 0;
}

.inscale-input-with-button {
  gap: 10px;
  display: flex;
  align-items: center;
}

/* Стили для ошибок при загрузке видео */
.inscale-video-container .inscale-video-error {
  background: #f8d7da;
  color: #721c24;
  padding: 20px;
  text-align: center;
  border-radius: 4px;
  border: 1px solid #f5c6cb;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Заголовки превью для разных провайдеров */
.inscale-video-preview[data-provider="vk"] .inscale-video-preview-info {
  background-color: rgba(74, 118, 168, 0.7);
}

.inscale-video-preview[data-provider="rutube"] .inscale-video-preview-info {
  background-color: rgba(198, 44, 49, 0.7);
}

/* Кнопка воспроизведения для разных провайдеров */
.inscale-video-preview[data-provider="vk"] .inscale-video-play-button {
  box-shadow: 0 0 20px rgba(74, 118, 168, 0.6);
}

.inscale-video-preview[data-provider="rutube"] .inscale-video-play-button {
  box-shadow: 0 0 20px rgba(198, 44, 49, 0.6);
}

/* Анимация при наведении для кнопки воспроизведения */
.inscale-video-play-button:hover {
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.4);
}