/* ===============================
   GyaanVerse Image Picker
   Multi-select, reorder, dialog-safe
   =============================== */

.custom-image-input {
  position: relative;
  border: 1.5px dashed rgba(79, 172, 254, 0.72);
  border-radius: 18px;
  padding: 28px 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
  min-height: 92px;
  overflow: hidden;
}

.custom-image-input:hover,
.custom-image-input.is-dragging {
  background: rgba(0, 242, 254, 0.075);
  border-color: #00f2fe;
  transform: translateY(-1px);
}

.custom-image-input input[type="file"] {
  opacity: 0;
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  cursor: pointer;
  z-index: 2;
}

.custom-image-input::before {
  content: 'Click or drag images here';
  display: block;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
}

.custom-image-input::after {
  content: 'Supports JPG, PNG, WEBP, GIF. Add more files anytime and drag to reorder.';
  color: rgba(255, 255, 255, 0.48);
  font-size: 12px;
}

.nx-image-preview {
  margin-top: 14px;
}

.nx-image-preview .image-preview-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 12px;
  color: rgba(255, 255, 255, 0.78);
}

.nx-image-preview .image-preview-toolbar span {
  font-weight: 800;
  color: #fff;
}

.nx-image-preview .image-preview-toolbar small {
  color: rgba(255, 255, 255, 0.48);
  text-align: right;
}

.nx-image-preview .image-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 12px;
  max-height: 260px;
  overflow-y: auto;
  padding: 2px 4px 6px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(79, 172, 254, 0.8) rgba(255, 255, 255, 0.08);
}

.nx-image-preview .image-preview-list::-webkit-scrollbar { width: 8px; }
.nx-image-preview .image-preview-list::-webkit-scrollbar-track { background: rgba(255,255,255,.06); border-radius: 99px; }
.nx-image-preview .image-preview-list::-webkit-scrollbar-thumb { background: linear-gradient(#4facfe, #00f2fe); border-radius: 99px; }

.nx-image-preview .image-thumbnail {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1.5px solid rgba(79, 172, 254, 0.76);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(8, 14, 38, 0.72);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  transition: transform 0.22s ease, border-color 0.22s ease, opacity 0.22s ease;
  cursor: grab;
}

.nx-image-preview .image-thumbnail:active { cursor: grabbing; }
.nx-image-preview .image-thumbnail:hover { transform: translateY(-2px); border-color: #00f2fe; }
.nx-image-preview .image-thumbnail.is-drag-source { opacity: .5; }
.nx-image-preview .image-thumbnail.is-drag-over { outline: 2px solid #f5b84b; outline-offset: 2px; }

.nx-image-preview .image-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.nx-image-preview .image-order {
  position: absolute;
  left: 7px;
  top: 7px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(7, 18, 38, 0.76);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid rgba(255,255,255,.16);
  z-index: 2;
}

.nx-image-preview .fallback-text {
  color: rgba(255, 255, 255, 0.58);
  font-size: 14px;
  text-align: center;
  padding: 18px;
  border: 1px dashed rgba(255,255,255,.16);
  border-radius: 16px;
}

.nx-image-preview .shimmer {
  background: linear-gradient(90deg, rgba(30,30,47,.88) 25%, rgba(65,72,125,.88) 50%, rgba(30,30,47,.88) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.35s infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.nx-image-preview .remove-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  background: linear-gradient(135deg, #ff6868, #ff8b78);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
  transition: transform 0.18s ease, filter 0.18s ease;
  z-index: 3;
}

.nx-image-preview .remove-btn:hover {
  filter: brightness(1.08);
  transform: scale(1.08);
}

.nx-image-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #2a2a40, #1e1e2f);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 15px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.nx-image-wrapper:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.nx-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 560px) {
  .nx-image-preview .image-preview-toolbar {
    flex-direction: column;
  }
  .nx-image-preview .image-preview-toolbar small {
    text-align: left;
  }
  .nx-image-preview .image-preview-list {
    grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
    max-height: 220px;
  }
}


/* Fullscreen + existing-media management */
.nx-image-preview .fullscreen-btn {
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(7,18,38,.78);
  color: #fff;
  cursor: pointer;
  z-index: 3;
  box-shadow: 0 8px 20px rgba(0,0,0,.28);
}
.nx-image-preview .fullscreen-btn i { font-size: 16px; line-height: 1; }
.nx-image-preview .fullscreen-btn:hover { background: linear-gradient(135deg,#4facfe,#00f2fe); color:#071226; }
.gv-lightbox-slider { width: min(980px, 100%); margin: 0 auto; }
.gv-lightbox-slide { position: relative; display: grid !important; place-items: center; min-height: min(70vh, 720px); }
.gv-lightbox-slide img { max-width: 100%; max-height: min(70vh, 720px); object-fit: contain; border-radius: 18px; box-shadow: 0 20px 70px rgba(0,0,0,.38); }
.gv-lightbox-count { position:absolute; top:12px; left:12px; z-index:2; border-radius:999px; padding:7px 11px; background:rgba(7,18,38,.72); color:#fff; font-weight:900; font-size:.78rem; }
.gv-media-open-btn { position:absolute; top:10px; right:10px; width:38px; height:38px; display:grid; place-items:center; border:0; border-radius:999px; background:rgba(7,18,38,.74); color:#fff; cursor:pointer; z-index:5; box-shadow:0 10px 24px rgba(0,0,0,.25); }
.gv-media-open-btn:hover { background:linear-gradient(135deg,#4facfe,#00f2fe); color:#071226; }


/* Enterprise dedicated media lightbox - does not close parent dialogs */
body.gv-lightbox-open { overflow: hidden; }

.gv-media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 34px);
  background:
    radial-gradient(circle at 8% 12%, rgba(244,155,54,.18), transparent 22rem),
    radial-gradient(circle at 92% 88%, rgba(0,242,254,.15), transparent 28rem),
    rgba(2, 7, 24, .82);
  backdrop-filter: blur(16px) saturate(135%);
  -webkit-backdrop-filter: blur(16px) saturate(135%);
  animation: gvLightboxFade .2s ease-out;
}

.gv-media-lightbox-panel {
  width: min(1280px, calc(100vw - 28px));
  height: min(90dvh, 880px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.14);
  border-top: 3px solid rgba(0,242,254,.9);
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
    radial-gradient(circle at 24% 10%, rgba(79,172,254,.17), transparent 24rem),
    linear-gradient(145deg, rgba(31,36,85,.94), rgba(12,23,45,.96));
  background-size: 24px 24px, 24px 24px, auto, auto;
  box-shadow: 0 34px 110px rgba(0,0,0,.56);
}

.gv-media-lightbox-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

.gv-media-lightbox-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-weight: 900;
}

.gv-media-lightbox-title i { color: #4facfe; }
.gv-media-lightbox-title span {
  max-width: min(58vw, 680px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gv-media-lightbox-title small {
  color: rgba(255,255,255,.56);
  font-weight: 800;
}

.gv-media-lightbox-actions {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.gv-lightbox-tool,
.gv-lightbox-nav {
  border: 1px solid rgba(255,255,255,.13);
  background: rgba(255,255,255,.08);
  color: #fff;
  border-radius: 999px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
}

.gv-lightbox-tool {
  width: 42px;
  height: 42px;
}

.gv-lightbox-tool:hover,
.gv-lightbox-nav:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  color: #071226;
  border-color: transparent;
}

.gv-media-lightbox-stage {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 18px 68px;
}

.gv-media-lightbox-figure {
  width: 100%;
  height: 100%;
  margin: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  gap: 10px;
  min-height: 0;
}

.gv-media-lightbox-figure img {
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  object-fit: contain;
  border-radius: 18px;
  box-shadow: 0 22px 80px rgba(0,0,0,.44);
  background: rgba(0,0,0,.18);
}

.gv-media-lightbox-figure figcaption {
  width: 100%;
  text-align: center;
  color: rgba(255,255,255,.62);
  font-size: .82rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gv-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
}
.gv-lightbox-nav:hover { transform: translateY(-50%) scale(1.04); }
.gv-lightbox-nav.prev { left: 16px; }
.gv-lightbox-nav.next { right: 16px; }

.gv-media-lightbox-dots {
  min-height: 38px;
  padding: 0 18px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex-wrap: wrap;
}

.gv-media-lightbox-dots button {
  width: 7px;
  height: 7px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: rgba(255,255,255,.28);
  cursor: pointer;
}
.gv-media-lightbox-dots button.active {
  width: 22px;
  background: linear-gradient(90deg, #4facfe, #00f2fe);
}

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

@media (max-width: 720px) {
  .gv-media-lightbox { padding: 10px; }
  .gv-media-lightbox-panel {
    width: calc(100vw - 20px);
    height: min(92dvh, 760px);
    border-radius: 22px;
  }
  .gv-media-lightbox-topbar { padding: 14px; }
  .gv-media-lightbox-title span { max-width: 42vw; }
  .gv-lightbox-tool { width: 38px; height: 38px; }
  .gv-media-lightbox-stage { padding: 12px 48px; }
  .gv-lightbox-nav { width: 38px; height: 38px; }
  .gv-lightbox-nav.prev { left: 8px; }
  .gv-lightbox-nav.next { right: 8px; }
}
