/*
 * Copyright (c) 2024 Biovisuals Private Limited
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of Biovisuals Private Limited.
 * You shall not disclose such Confidential Information and shall use it only
 * in accordance with the terms of the license agreement you entered into with Biovisuals Private Limited.
 */

/* Cloud button in the save-status area */
.vh-cloud-btn {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 2px 6px;
  margin-left: 6px;
  font-size: 14px;
  border-radius: 5px;
  opacity: 0.85;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.vh-cloud-btn:hover {
  opacity: 1;
  background: rgba(127, 127, 127, 0.18);
}

/* Panel */
.vh-panel {
  position: fixed;
  bottom: 58px;
  left: 16px;
  width: 250px;
  max-height: 66vh;
  background: #ffffff;
  color: #1c2d4a;
  border: 1px solid #e2e6ee;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  z-index: 4000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, sans-serif;
}
.vh-panel.vh-hidden { display: none; }

.vh-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #eef1f6;
}
.vh-title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.vh-close {
  background: transparent; border: none; cursor: pointer;
  color: #6b7280; font-size: 15px; padding: 4px 6px; border-radius: 6px;
}
.vh-close:hover { background: #f1f3f8; color: #1c2d4a; }

.vh-tabs { display: flex; gap: 4px; padding: 8px 10px 0; }
.vh-tab {
  flex: 1; background: transparent; border: none; cursor: pointer;
  padding: 8px 10px; font-size: 13px; color: #6b7280; border-radius: 8px 8px 0 0;
  border-bottom: 2px solid transparent;
}
.vh-tab-active { color: #1c2d4a; font-weight: 600; border-bottom-color: #4f6ef7; }

.vh-body { overflow-y: auto; padding: 8px; flex: 1; }
.vh-empty { padding: 24px 12px; text-align: center; color: #9098a6; font-size: 13px; }

/* List item */
.vh-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 10px; transition: background 0.12s ease;
}
.vh-item:hover { background: #f6f8fc; }
.vh-item + .vh-item { border-top: 1px solid #f1f3f8; }

.vh-item-thumb {
  width: 46px; height: 34px; border-radius: 6px; overflow: hidden;
  flex-shrink: 0; background: #f1f3f8; border: 1px solid #e6e9f0;
  display: flex; align-items: center; justify-content: center;
}
.vh-item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.vh-thumb-ph { color: #c2c8d4; font-size: 13px; }

.vh-item { padding: 8px; gap: 8px; }
.vh-item-main { flex: 1; min-width: 0; }
.vh-item-line1 { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.vh-ver { font-weight: 600; font-size: 12px; }
.vh-item-line2 { font-size: 10.5px; color: #8a92a2; margin-top: 2px; }

/* Compact icon action buttons (Project tab) */
.vh-icon-btn {
  border: 1px solid #d7ddf6; background: #fff; color: #4f6ef7; cursor: pointer;
  width: 28px; height: 28px; border-radius: 7px; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
}
.vh-icon-btn:hover { background: #eef2ff; }
.vh-icon-primary { background: #4f6ef7; color: #fff; border-color: #4f6ef7; }
.vh-icon-primary:hover { background: #3f5be0; }

.vh-badge { font-size: 10px; padding: 1px 6px; border-radius: 10px; font-weight: 600; }
.vh-badge-auto { background: #eef2ff; color: #4f6ef7; }
.vh-badge-manual { background: #ecfdf5; color: #059669; }
.vh-badge-restore { background: #fef3c7; color: #b45309; }
.vh-badge-safety { background: #f3f4f6; color: #6b7280; }
.vh-current { font-size: 10px; color: #059669; font-weight: 700; }

.vh-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.vh-btn {
  border: none; cursor: pointer; font-size: 12px; padding: 5px 10px;
  border-radius: 7px; background: #4f6ef7; color: #fff; font-weight: 500;
}
.vh-btn:hover { background: #3f5be0; }
.vh-btn-ghost { background: transparent; color: #4f6ef7; border: 1px solid #d7ddf6; }
.vh-btn-ghost:hover { background: #eef2ff; }

.vh-footer { padding: 8px 12px; border-top: 1px solid #eef1f6; }
.vh-note { font-size: 10.5px; color: #9098a6; }

/* Preview modal */
.vh-preview-modal { position: fixed; inset: 0; z-index: 4200; }
.vh-preview-modal.vh-hidden { display: none; }
.vh-preview-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.55); }
.vh-preview-card {
  position: relative; margin: 5vh auto 0; width: max-content; max-width: 90vw;
  background: #fff; border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
.vh-preview-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid #eef1f6;
}
.vh-preview-title { font-weight: 600; font-size: 14px; color: #1c2d4a; }
.vh-preview-close { background: transparent; border: none; cursor: pointer; color: #6b7280; font-size: 16px; }
.vh-preview-stage {
  padding: 16px; display: flex; align-items: flex-start; justify-content: center;
  background: #f4f6fb; min-width: 320px; min-height: 200px;
  max-height: 74vh; overflow-y: auto;
}
.vh-preview-foot { padding: 10px 14px; border-top: 1px solid #eef1f6; font-size: 11px; color: #8a92a2; }

/* Lightweight thumbnail-only version preview (versionPreview.js) */
.vh-pv-list { display: flex; flex-direction: column; gap: 14px; max-width: 100%; }
.vh-pv-slide { margin: 0; display: flex; flex-direction: column; gap: 5px; }
.vh-pv-media {
  position: relative;
  max-width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #e6e9f0;
  display: flex; align-items: center; justify-content: center;
}
.vh-pv-img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  opacity: 0; transition: opacity 0.18s ease;
}
.vh-pv-img-ready { opacity: 1; }
.vh-pv-caption { font-size: 11px; color: #6b7280; padding-left: 2px; }

/* Skeleton + spinner shown immediately, before anything is fetched */
.vh-pv-skeleton {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(100deg, #eef1f6 30%, #f7f9fc 50%, #eef1f6 70%);
  background-size: 220% 100%;
  animation: vhPvShimmer 1.2s linear infinite;
}
.vh-pv-skeleton-lead { position: relative; width: 320px; height: 200px; border-radius: 8px; }
.vh-pv-spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid rgba(79, 110, 247, 0.22);
  border-top-color: #4f6ef7;
  animation: vhPvSpin 0.7s linear infinite;
}
@keyframes vhPvSpin { to { transform: rotate(360deg); } }
@keyframes vhPvShimmer { from { background-position: 120% 0; } to { background-position: -20% 0; } }

@media (prefers-reduced-motion: reduce) {
  .vh-pv-skeleton { animation: none; }
  .vh-pv-spinner { animation-duration: 2s; }
  .vh-pv-img { transition: none; }
}

/* "Preview unavailable" fallback */
.vh-pv-notice {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 18px 14px; text-align: center; width: 100%;
}
.vh-pv-notice-main { font-size: 12.5px; font-weight: 600; color: #6b7280; }
.vh-pv-notice-sub { font-size: 11px; color: #9098a6; }

.vh-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.vh-strip-btn {
  border: 1px solid #d7ddf6; background: #fff; color: #4f6ef7; cursor: pointer;
  width: 28px; height: 28px; border-radius: 6px; font-size: 12px; font-weight: 600;
}
.vh-strip-active { background: #4f6ef7; color: #fff; }

/* This-slide preview grid (clean, thumbnail-first) */
.vh-thumb-grid {
  display: grid;
  grid-template-columns: 1fr; /* one thumbnail per row */
  gap: 10px;
  padding: 4px;
}
.vh-thumb-tile {
  position: relative;
  border: 1px solid #e6e9f0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}
.vh-thumb-tile:not([disabled]):hover {
  border-color: #4f6ef7;
  box-shadow: 0 4px 14px rgba(79, 110, 247, 0.2);
  transform: translateY(-1px);
}
.vh-thumb-tile[disabled] { cursor: default; }

.vh-thumb-media {
  position: relative;
  width: 100%;
  height: 120px; /* fixed so layout is stable while thumbnails load */
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  overflow: hidden;
  background: #ffffff;
}
.vh-thumb-media img { max-width: 100%; max-height: 120px; object-fit: contain; display: block; }
.vh-thumb-media .vh-thumb-ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: #c2c8d4; background: #eef1f6; border-radius: 6px; font-size: 18px;
}
/* Time shown directly on the thumbnail (bottom-right pill) */
.vh-thumb-timepill {
  position: absolute; bottom: 4px; right: 4px; z-index: 2;
  background: rgba(28, 45, 74, 0.72); color: #fff; font-size: 9.5px; font-weight: 600;
  padding: 1px 6px; border-radius: 8px; pointer-events: none;
}

.vh-thumb-current { border-color: #059669; }
.vh-thumb-badge {
  position: absolute; top: 3px; left: 3px; z-index: 2;
  background: #059669; color: #fff; font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 8px;
}
.vh-thumb-overlay {
  position: absolute; inset: 0; z-index: 1;
  background: rgba(28, 45, 74, 0.74); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 10.5px; font-weight: 600; text-align: center; padding: 6px;
  opacity: 0; transition: opacity 0.12s ease;
}
.vh-thumb-overlay i { font-size: 14px; }
.vh-thumb-tile:not([disabled]):hover .vh-thumb-overlay { opacity: 1; }
