/* ═══════════════════════════════════════════════════════════════════════════
   DP Media Viewer — Premium Custom Lightbox & Video Player
   Supports: Images (JPG PNG WEBP GIF BMP AVIF HEIC TIFF SVG)
             Videos  (MP4 WEBM MOV AVI MKV FLV WMV)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Overlay Backdrop ────────────────────────────────────────────────────── */
#dp-viewer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: dpFadeIn 0.22s ease;
  touch-action: none;
}
#dp-viewer-overlay.dp-active { display: flex; flex-direction: column; }

@keyframes dpFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes dpSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Top Toolbar ─────────────────────────────────────────────────────────── */
#dp-viewer-toolbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, transparent 100%);
  gap: 8px;
}

#dp-viewer-title {
  color: rgba(255,255,255,0.85);
  font-size: 0.82rem;
  font-family: 'Inter', 'Outfit', sans-serif;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50vw;
}

.dp-toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 30px;
  padding: 4px 6px;
  backdrop-filter: blur(10px);
}

.dp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.82);
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.18s, color 0.18s, transform 0.15s;
  flex-shrink: 0;
}
.dp-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
  transform: scale(1.08);
}
.dp-btn:active { transform: scale(0.93); }
.dp-btn.dp-btn-danger:hover { background: rgba(220,53,69,0.7); color: #fff; }

#dp-viewer-counter {
  color: rgba(255,255,255,0.6);
  font-size: 0.78rem;
  font-family: monospace;
  padding: 0 6px;
  white-space: nowrap;
}

/* ── Main Stage ──────────────────────────────────────────────────────────── */
#dp-viewer-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  user-select: none;
}

/* ── Image Container ─────────────────────────────────────────────────────── */
#dp-img-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%; height: 100%;
  cursor: grab;
}
#dp-img-container:active { cursor: grabbing; }
#dp-img-container img {
  max-width: 92vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: dpSlideUp 0.25s ease;
  transform-origin: center center;
  transition: transform 0.18s ease, opacity 0.2s ease;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* ── Navigation Arrows ───────────────────────────────────────────────────── */
.dp-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  color: rgba(255,255,255,0.85);
  font-size: 1.3rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.2s, transform 0.15s;
  user-select: none;
}
.dp-nav-btn:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
  transform: translateY(-50%) scale(1.1);
}
#dp-prev { left: 14px; }
#dp-next { right: 14px; }
.dp-nav-btn.dp-hidden { display: none; }

/* ── Bottom Info Bar ─────────────────────────────────────────────────────── */
#dp-viewer-infobar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
}
#dp-viewer-infobar span {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.7);
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: monospace;
  white-space: nowrap;
}
#dp-zoom-level { min-width: 52px; text-align: center; }

/* ── Thumbnail Strip ─────────────────────────────────────────────────────── */
#dp-thumb-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 16px;
  background: rgba(0,0,0,0.4);
  border-top: 1px solid rgba(255,255,255,0.06);
  scrollbar-width: none;
  flex-shrink: 0;
  max-height: 76px;
}
#dp-thumb-strip::-webkit-scrollbar { display: none; }

.dp-thumb {
  width: 58px; height: 56px;
  border-radius: 6px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.55;
  transition: opacity 0.2s, border-color 0.2s, transform 0.15s;
  flex-shrink: 0;
  background: #222;
}
.dp-thumb:hover { opacity: 0.85; transform: scale(1.05); }
.dp-thumb.dp-thumb-active {
  border-color: #e74c3c;
  opacity: 1;
  transform: scale(1.07);
}
.dp-thumb-video {
  position: relative;
  width: 58px; height: 56px;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  opacity: 0.55;
  transition: opacity 0.2s, border-color 0.2s;
  background: #111;
  display: flex; align-items: center; justify-content: center;
}
.dp-thumb-video.dp-thumb-active { border-color: #e74c3c; opacity: 1; }
.dp-thumb-video i { color: rgba(255,255,255,0.8); font-size: 1.4rem; }

/* ── ═══════════════════════════════════════════════════════════════
   VIDEO PLAYER — Custom Modern Controls
   ═══════════════════════════════════════════════════════════════ */

#dp-video-container {
  display: none;
  position: relative;
  width: 100%; height: 100%;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: #000;
}
#dp-video-container.dp-active { display: flex; }

#dp-video-el {
  max-width: 100%;
  max-height: calc(100vh - 120px);
  width: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

/* Unsupported format overlay */
#dp-video-unsupported {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.7);
  gap: 14px;
  text-align: center;
  padding: 40px;
}
#dp-video-unsupported i { font-size: 3rem; color: #e74c3c; }
#dp-video-unsupported p { font-size: 0.9rem; }
#dp-video-unsupported a {
  background: #e74c3c;
  color: #fff;
  text-decoration: none;
  padding: 8px 22px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.2s;
}
#dp-video-unsupported a:hover { background: #c0392b; }

/* Controls Bar */
#dp-video-controls {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 10;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.55) 60%, transparent 100%);
  padding: 10px 16px 14px;
  transition: opacity 0.35s ease;
  transform: translateZ(0);
}
#dp-video-controls.dp-controls-hidden { opacity: 0; pointer-events: none; }

/* Seek / Progress Row */
.dp-seek-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.dp-seek-wrap {
  flex: 1;
  position: relative;
  height: 4px;
  cursor: pointer;
}
.dp-seek-track {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: rgba(255,255,255,0.2);
  overflow: hidden;
}
#dp-buffered-bar {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: rgba(255,255,255,0.35);
  border-radius: 4px;
  transition: width 0.4s linear;
}
#dp-progress-bar {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: linear-gradient(90deg, #e74c3c, #ff6b6b);
  border-radius: 4px;
  transition: width 0.1s linear;
}
#dp-seek-thumb {
  position: absolute;
  top: 50%;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.15s;
  pointer-events: none;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
  z-index: 2;
}
.dp-seek-wrap:hover #dp-seek-thumb { transform: translate(-50%, -50%) scale(1); }
.dp-seek-wrap:hover .dp-seek-track { height: 6px; top: -1px; }

.dp-time-display {
  color: rgba(255,255,255,0.8);
  font-size: 0.75rem;
  font-family: monospace;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Controls Main Row */
.dp-controls-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dp-vc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  font-size: 1.05rem;
  transition: background 0.18s, color 0.18s, transform 0.15s;
  flex-shrink: 0;
}
.dp-vc-btn:hover { background: rgba(255,255,255,0.15); color: #fff; transform: scale(1.1); }
.dp-vc-btn:active { transform: scale(0.93); }
#dp-play-btn { width: 42px; height: 42px; font-size: 1.25rem; }

.dp-spacer { flex: 1; }

/* Volume slider */
#dp-volume-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
#dp-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 70px; height: 3px;
  border-radius: 3px;
  background: rgba(255,255,255,0.25);
  outline: none;
  cursor: pointer;
  transition: width 0.2s;
}
#dp-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 0 4px rgba(0,0,0,0.4);
}
#dp-volume-slider::-moz-range-thumb {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  border: none;
}

/* Speed selector */
#dp-speed-select {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.85);
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
  transition: background 0.18s;
}
#dp-speed-select:hover { background: rgba(255,255,255,0.18); }
#dp-speed-select option { background: #1a1a1a; color: #fff; }

/* Big play button overlay */
#dp-big-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 70px; height: 70px;
  border-radius: 50%;
  background: rgba(231,76,60,0.85);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  box-shadow: 0 0 30px rgba(231,76,60,0.5);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 5;
}
#dp-big-play.dp-hidden { opacity: 0; pointer-events: none; }
#dp-big-play:hover { transform: translate(-50%, -50%) scale(1.08); }

/* Ripple effect on play/pause */
.dp-ripple {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%) scale(0);
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  pointer-events: none;
  animation: dpRipple 0.5s ease-out forwards;
  z-index: 6;
}
@keyframes dpRipple {
  to { transform: translate(-50%,-50%) scale(2.5); opacity: 0; }
}

/* Format / quality badge */
#dp-format-badge {
  position: absolute;
  top: 70px; right: 14px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.75);
  font-size: 0.65rem;
  font-family: monospace;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  z-index: 8;
  pointer-events: none;
}

/* Loading spinner */
#dp-loading {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  z-index: 7;
}
#dp-loading.dp-active { display: block; }
.dp-spinner {
  width: 44px; height: 44px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: #e74c3c;
  border-radius: 50%;
  animation: dpSpin 0.75s linear infinite;
}
@keyframes dpSpin { to { transform: rotate(360deg); } }

/* ── Admin Specific — Upload Progress Bar ─────────────────────────────────── */
.dp-upload-zone {
  border: 2px dashed #dee2e6;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
  position: relative;
}
.dp-upload-zone:hover, .dp-upload-zone.dp-drag-over {
  border-color: #e74c3c;
  background: rgba(231,76,60,0.04);
}
.dp-upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%; height: 100%;
  cursor: pointer;
}
.dp-upload-icon { font-size: 2rem; color: #adb5bd; margin-bottom: 8px; }
.dp-upload-label { font-size: 0.85rem; color: #6c757d; }
.dp-upload-formats { font-size: 0.72rem; color: #adb5bd; margin-top: 4px; }

/* File queue */
#dp-file-queue { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.dp-file-item {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 10px 12px;
  position: relative;
}
.dp-file-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.dp-file-thumb {
  width: 40px; height: 40px;
  border-radius: 6px;
  object-fit: cover;
  background: #dee2e6;
  flex-shrink: 0;
}
.dp-file-info { flex: 1; min-width: 0; }
.dp-file-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #343a40;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dp-file-size { font-size: 0.72rem; color: #6c757d; }
.dp-file-status {
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 12px;
}
.dp-file-status.pending { background: #e9ecef; color: #6c757d; }
.dp-file-status.uploading { background: #fff3cd; color: #856404; }
.dp-file-status.done { background: #d1e7dd; color: #0a3622; }
.dp-file-status.error { background: #f8d7da; color: #842029; }

/* Progress track */
.dp-progress-track {
  height: 5px;
  background: #dee2e6;
  border-radius: 4px;
  overflow: hidden;
}
.dp-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #e74c3c, #ff6b6b);
  border-radius: 4px;
  transition: width 0.2s ease;
}

/* Overall batch progress */
#dp-batch-progress {
  display: none;
  margin-top: 14px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #212529, #343a40);
  border-radius: 10px;
  color: #fff;
}
#dp-batch-progress.dp-active { display: block; }
#dp-batch-label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.75);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}
#dp-batch-bar-track {
  height: 8px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  overflow: hidden;
}
#dp-batch-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #e74c3c, #ff6b6b);
  border-radius: 8px;
  transition: width 0.25s ease;
}

/* ── Admin Media Card — Rotation Controls ─────────────────────────────────── */
.dp-media-card {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
}
.dp-media-preview {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
  background: #212529;
  transition: transform 0.3s ease;
}
.dp-media-preview-video {
  width: 100%;
  height: 130px;
  object-fit: cover;
  background: #111;
}
.dp-media-type-badge {
  position: absolute;
  top: 6px; left: 6px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 10px;
  font-family: monospace;
  backdrop-filter: blur(6px);
}
.dp-media-actions {
  padding: 8px;
  background: #fff;
  border-top: 1px solid #f0f0f0;
}
.dp-rotate-controls {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-bottom: 6px;
}
.dp-rotate-btn {
  flex: 1;
  padding: 5px;
  font-size: 0.78rem;
  border: 1px solid #dee2e6;
  background: #fff;
  color: #495057;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.18s;
  display: flex; align-items: center; justify-content: center; gap: 3px;
}
.dp-rotate-btn:hover { background: #e74c3c; border-color: #e74c3c; color: #fff; }
.dp-save-rotation {
  display: none;
  width: 100%;
  padding: 4px;
  font-size: 0.75rem;
  background: #198754;
  border: none;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 6px;
  transition: background 0.18s;
}
.dp-save-rotation:hover { background: #157347; }
.dp-save-rotation.dp-visible { display: block; }

/* Image preview before upload (admin) */
#dp-img-preview-wrap {
  margin-top: 10px;
  display: none;
  position: relative;
}
#dp-img-preview-wrap.dp-active { display: block; }
#dp-img-preview-wrap img {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 8px;
  background: #f0f0f0;
  border: 1px solid #dee2e6;
  transition: transform 0.3s ease;
}
.dp-preview-rotate-bar {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.dp-preview-rotate-bar button {
  flex: 1;
  padding: 6px;
  border: 1px solid #dee2e6;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.18s;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.dp-preview-rotate-bar button:hover { background: #e74c3c; color: #fff; border-color: #e74c3c; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  #dp-viewer-toolbar { padding: 8px 10px; }
  .dp-toolbar-group { gap: 2px; padding: 3px 4px; }
  .dp-btn { width: 30px; height: 30px; font-size: 0.88rem; }
  .dp-nav-btn { width: 38px; height: 38px; font-size: 1rem; }
  #dp-prev { left: 6px; }
  #dp-next { right: 6px; }
  #dp-thumb-strip { max-height: 62px; }
  .dp-thumb { width: 46px; height: 44px; }
  #dp-volume-slider { width: 50px; }
  .dp-time-display { font-size: 0.68rem; }
  #dp-speed-select { font-size: 0.68rem; padding: 3px 5px; }
}
