/* ============================================================
   VIDEOS MODULE — styles
   ============================================================ */

/* ===== Toolbar ===== */
.videos-toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 32px;
  padding: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.videos-search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}
.videos-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .9rem;
  opacity: .5;
  pointer-events: none;
}
.videos-search {
  width: 100%;
  padding: 11px 14px 11px 40px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 100px;
  color: #e8e8f0;
  font-size: .9rem;
  font-family: inherit;
  outline: none;
  transition: border-color .25s, background .25s;
  cursor: text;
}
.videos-search:focus {
  border-color: #7c5cff;
  background: rgba(124,92,255,.04);
}
.videos-search::placeholder { color: #8888a0; opacity: .5; }

.videos-categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.videos-cat-btn {
  padding: 8px 16px;
  border-radius: 100px;
  border: 1px solid rgba(255,255,255,.08);
  background: transparent;
  color: #8888a0;
  font-size: .85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: none;
  transition: .4s cubic-bezier(.2,.8,.2,1);
}
.videos-cat-btn:hover {
  border-color: #7c5cff;
  color: #e8e8f0;
}
.videos-cat-btn.active {
  background: linear-gradient(135deg, #7c5cff, #00e5ff);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px rgba(124,92,255,.3);
}
.videos-cat-btn .cat-count {
  margin-left: 6px;
  opacity: .6;
  font-size: .75rem;
  font-family: 'JetBrains Mono', monospace;
}

.videos-add-btn {
  padding: 10px 20px;
  border-radius: 100px;
  background: linear-gradient(135deg, #7c5cff, #00e5ff);
  color: #fff;
  font-size: .85rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: none;
  transition: .4s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 4px 16px rgba(124,92,255,.3);
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.videos-add-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(124,92,255,.5);
}

/* ===== Admin hint ===== */
.videos-admin-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  margin-bottom: 16px;
  background: rgba(0,229,255,.05);
  border: 1px solid rgba(0,229,255,.15);
  border-radius: 12px;
  font-size: .85rem;
  color: #00e5ff;
  font-family: 'JetBrains Mono', monospace;
}

/* ===== Grid ===== */
.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.videos-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #8888a0;
  font-size: .95rem;
}

/* ===== Video card ===== */
.video-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: .4s cubic-bezier(.2,.8,.2,1);
  cursor: none;
  position: relative;
  display: flex;
  flex-direction: column;
}
.video-card:hover {
  border-color: rgba(124,92,255,.4);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0,0,0,.3);
}
.video-card.dragging {
  opacity: 0.4;
  transform: scale(0.98);
}
.video-card.drag-over {
  border-color: #00e5ff;
  box-shadow: 0 0 0 2px rgba(0,229,255,.3);
}

.video-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #12121a;
  overflow: hidden;
}
.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s;
}
.video-card:hover .video-thumb img {
  transform: scale(1.05);
}
.video-thumb::after {
  content: '▶';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: #fff;
  background: rgba(0,0,0,.35);
  opacity: 0;
  transition: opacity .3s;
}
.video-card:hover .video-thumb::after { opacity: 1; }

.video-thumb .video-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, rgba(124,92,255,.2), rgba(0,229,255,.2));
}

.video-body {
  padding: 18px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.video-category-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: .7rem;
  font-family: 'JetBrains Mono', monospace;
  color: #00e5ff;
  background: rgba(0,229,255,.08);
  border: 1px solid rgba(0,229,255,.2);
  padding: 3px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 500;
}
.video-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #e8e8f0;
  line-height: 1.3;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.video-desc {
  font-size: .85rem;
  color: #8888a0;
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.video-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 8px;
  font-size: .75rem;
  color: #8888a0;
  font-family: 'JetBrains Mono', monospace;
}

/* ===== Admin controls on cards ===== */
.video-admin-bar {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  gap: 6px;
  z-index: 2;
}
.video-card.is-admin .video-admin-bar { display: flex; }

.video-admin-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(10,10,15,.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.08);
  color: #e8e8f0;
  font-size: .9rem;
  cursor: none;
  transition: .4s cubic-bezier(.2,.8,.2,1);
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-admin-btn:hover {
  background: rgba(124,92,255,.2);
  border-color: #7c5cff;
}
.video-admin-btn.danger:hover {
  background: rgba(255,92,124,.2);
  border-color: #ff5c7c;
  color: #ff5c7c;
}

.video-drag-handle {
  display: none;
  position: absolute;
  top: 8px;
  left: 8px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(10,10,15,.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.08);
  color: #8888a0;
  font-size: 1rem;
  cursor: grab;
  align-items: center;
  justify-content: center;
  z-index: 2;
  font-family: 'JetBrains Mono', monospace;
  user-select: none;
}
.video-card.is-admin .video-drag-handle { display: flex; }
.video-drag-handle:active { cursor: grabbing; }

/* ===== Empty state ===== */
.videos-empty {
  text-align: center;
  padding: 80px 20px;
  color: #8888a0;
}
.videos-empty-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: .4;
}

/* ===== Video player modal ===== */
.modal-video-player {
  max-width: 900px;
  padding: 24px;
}
.video-player-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 16px;
  padding-right: 40px;
  color: #e8e8f0;
}
.video-player-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}
.video-player-frame iframe,
.video-player-frame video {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
.video-player-desc {
  color: #8888a0;
  font-size: .9rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== Video form: source switcher ===== */
.source-switcher {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
}
.source-tab {
  flex: 1;
  padding: 9px 14px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: #8888a0;
  font-size: .85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: none;
  transition: .4s cubic-bezier(.2,.8,.2,1);
}
.source-tab:hover { color: #e8e8f0; }
.source-tab.active {
  background: linear-gradient(135deg, #7c5cff, #00e5ff);
  color: #fff;
  box-shadow: 0 4px 12px rgba(124,92,255,.25);
}

.platform-hint {
  margin-top: 6px;
  font-size: .75rem;
  font-family: 'JetBrains Mono', monospace;
  color: #00e5ff;
  min-height: 1em;
  transition: opacity .2s;
}
.platform-hint:empty { opacity: 0; }

.form-help {
  margin-top: 6px;
  font-size: .72rem;
  font-family: 'JetBrains Mono', monospace;
  color: #8888a0;
  opacity: .7;
  line-height: 1.4;
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  line-height: 1.5;
  cursor: text;
}
select.form-input {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238888a0' stroke-width='2' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* ===== Thumbnail switcher ===== */
.thumb-switcher {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  margin-bottom: 10px;
}
.thumb-tab {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: #8888a0;
  font-size: .82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: none;
  transition: .4s cubic-bezier(.2,.8,.2,1);
}
.thumb-tab:hover { color: #e8e8f0; }
.thumb-tab.active {
  background: linear-gradient(135deg, #7c5cff, #00e5ff);
  color: #fff;
  box-shadow: 0 4px 12px rgba(124,92,255,.25);
}

/* ===== Thumbnail upload area ===== */
.thumb-upload-area {
  position: relative;
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .25s, background .25s;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.thumb-upload-area:hover {
  border-color: #7c5cff;
  background: rgba(124,92,255,.04);
}
.thumb-upload-area.dragover {
  border-color: #00e5ff;
  background: rgba(0,229,255,.08);
}
.thumb-upload-area.has-file {
  padding: 8px;
  border-style: solid;
  border-color: rgba(124,92,255,.4);
}

/* Input file скрыт, но остаётся в DOM для программного клика */
.thumb-upload-area input[type="file"] {
  position: absolute !important;
  opacity: 0 !important;
  width: 1px !important;
  height: 1px !important;
  top: 0;
  left: 0;
  pointer-events: none !important;
}

/* Дочерние элементы области загрузки — клики проходят сквозь них к родителю */
.thumb-upload-area .thumb-upload-placeholder,
.thumb-upload-area .thumb-upload-icon,
.thumb-upload-area .thumb-upload-text,
.thumb-upload-area .thumb-upload-hint {
  cursor: pointer;
  pointer-events: none;
}

.thumb-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.thumb-upload-icon {
  font-size: 2rem;
  opacity: .5;
}
.thumb-upload-text {
  font-size: .9rem;
  color: #e8e8f0;
  font-weight: 500;
}
.thumb-upload-hint {
  font-size: .75rem;
  color: #8888a0;
  font-family: 'JetBrains Mono', monospace;
}

/* Превью и кнопка удаления — реагируют на клики отдельно */
.thumb-preview {
  max-width: 100%;
  max-height: 240px;
  border-radius: 8px;
  object-fit: contain;
  cursor: pointer;
  pointer-events: auto;
}

.thumb-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(10,10,15,.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.08);
  color: #ff5c7c;
  font-size: .9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .4s cubic-bezier(.2,.8,.2,1);
  pointer-events: auto;
}
.thumb-remove-btn:hover {
  background: rgba(255,92,124,.2);
  border-color: #ff5c7c;
}

.thumb-upload-progress {
  margin-top: 10px;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 100px;
  overflow: hidden;
}
.thumb-upload-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #7c5cff, #00e5ff);
  width: 0%;
  transition: width .2s;
  border-radius: 100px;
}

/* ===== Current thumbnail (при редактировании) ===== */
.thumb-current {
  margin-top: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
}
.thumb-current-image {
  max-width: 100%;
  max-height: 120px;
  border-radius: 6px;
  margin: 8px 0;
  object-fit: contain;
}
.thumb-remove-current {
  background: none;
  border: none;
  color: #ff5c7c;
  font-size: .8rem;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.thumb-remove-current:hover {
  color: #ff8ca1;
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
  .videos-grid { grid-template-columns: 1fr; }
  .videos-toolbar { flex-direction: column; align-items: stretch; }
  .videos-add-btn {
    margin-left: 0;
    width: 100%;
    justify-content: center;
    display: flex;
  }
  .video-player-title { font-size: 1.1rem; }
  .thumb-upload-area { min-height: 120px; padding: 16px; }
  .thumb-upload-icon { font-size: 1.5rem; }
  .thumb-upload-text { font-size: .85rem; }
}