/* ===== Explorer base ===== */
.explorer { --border:#e6e7ea; --hover:#f6f7f9; --text:#333; }

/* Make Bootstrap elements crisp */
.explorer .btn, .explorer .form-control, .explorer .form-select, .explorer .card,
.explorer .badge, .explorer .alert, .explorer .breadcrumb,
.explorer .dropdown-menu, .explorer .modal-content {
  border-radius: 0 !important;
}

/* ===== Toolbar (mobile-first grid) ===== */
.explorer-toolbar{
  display:grid; gap:10px 12px; align-items:center;
  grid-template-columns: 1fr;
  grid-template-areas:
    "nav"
    "crumbs"
    "search";
}
@media (min-width: 992px){
  .explorer-toolbar{
    grid-template-columns: auto 1fr minmax(260px, 420px);
    grid-template-areas: "nav crumbs search";
  }
}
.explorer-toolbar .tb-nav{ grid-area:nav; display:flex; gap:8px; flex-wrap:wrap; }
.explorer-toolbar .tb-crumbs{ grid-area:crumbs; overflow:auto; }
.explorer-toolbar .tb-crumbs .breadcrumb{ flex-wrap:wrap; gap:6px; margin:0; }
.explorer-toolbar .tb-search{ grid-area:search; }

/* ===== Cards grid (thumbnail view) ===== */
.explorer-grid.cards-grid {
  display:grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap:14px;
}
@media (max-width:575.98px) {
  .explorer-grid.cards-grid { grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap:12px; }
}
.explorer-card { display:flex; flex-direction:column; text-decoration:none; color:inherit; border:1px solid var(--border); background:#fff; }
.explorer-card:hover { box-shadow:0 1px 8px rgba(0,0,0,.07); border-color:#d9dbe0; }
.card-thumb { aspect-ratio:1/1; background:#f6f7f9; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.card-thumb img { max-width:100%; max-height:100%; object-fit:contain; display:block; background:#fff; }
.thumb-fallback { font-size:44px; line-height:1; }
.card-name { padding:10px; font-weight:600; font-size:.96rem; line-height:1.25; word-break:break-word; white-space:normal; }

/* File icons */
.file-icon { display:inline-flex; align-items:center; justify-content:center; min-width:44px; padding:6px 10px; font-weight:700; font-size:12px; color:#fff; border-radius:6px; background:#6b7280; }
.file-icon-img { max-width: 48px; max-height: 48px; object-fit: contain; display:block; }

/* ===== Pagination (Bootstrap numbered; single version) ===== */
.explorer .pagination { flex-wrap: wrap; gap: 6px; }
.explorer .page-link { padding: 6px 10px; line-height: 1.25; }
@media (max-width: 480px) {
  .explorer .page-link { padding: 6px 8px; }
}

/* ===== Search modal (mobile-friendly) ===== */
.modal-full-mobile .modal-content{ border-radius:0; }
@media (max-width: 575.98px) {
  .modal-full-mobile { margin:0; width:100%; max-width:none; height:100%; }
  .modal-full-mobile .modal-content{ min-height:100%; }
}

/* ===== Lightbox (files only) ===== */
.lb-overlay {
  position: fixed;
  inset: 0;
  display: none;
  opacity: 0;
  pointer-events: none;
  align-items: center;
  justify-content: center;
  flex-direction: column; /* stack vertically */
  background: rgba(0,0,0,.9);
  z-index: 1200;
  transition: opacity .15s ease;
}
.lb-overlay.is-open {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

/* Stage with media centered */
.lb-stage {
  max-width: min(96vw, 1400px);
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 6px 30px rgba(0,0,0,.3);
}
.lb-stage img,
.lb-stage video {
  max-width: 100%;
  max-height: 76vh;
  height: auto;
  width: auto;
  display: block;
  object-fit: contain;
}
/* PDF iframe adopts same stage sizing */
#lb-pdf {
  width: 90vw;
  height: 80vh;
  max-width: min(96vw, 1400px);
  border: 0;
}

/* Footer below media */
.lb-footer {
  margin-top: 12px;
  max-width: min(96vw, 1400px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.lb-caption { color: #fff; font-weight: 600; }
.lb-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.lb-actions .btn { border-radius: 0 !important; }

/* Dark round close button */
.lb-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  line-height: 36px;
  text-align: center;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 22px;
}
.lb-close:hover { background: rgba(0,0,0,0.8); }

/* Small screens */
@media (max-width:575.98px){
  .lb-stage{ max-height: 65vh; }
  .lb-stage img, .lb-stage video{ max-height: 60vh; }
  #lb-pdf { height: 65vh; width: 96vw; }
}
