/* File preview overlay (js/file-preview.js) and the standalone resource page. */

html.fp-open,
html.fp-open body {
  overflow: hidden;
}

.fp-overlay {
  position: fixed;
  inset: 0;
  /* above bootstrap modals (1055) and the fancybox lightbox (99992) it may be opened from */
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  background: rgba(13, 20, 31, 0.97);
  color: #f3f6fa;
  font-size: 14px;
  outline: none;
  animation: fp-fade 0.14s ease-out;
}

@keyframes fp-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fp-spin {
  to { transform: rotate(360deg); }
}

.fp-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 12px 8px 18px;
  background: #0b1420;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.fp-meta {
  flex: 1 1 auto;
  min-width: 0;
}

.fp-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fp-sub {
  font-size: 12px;
  line-height: 1.4;
  color: #9fb0c4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fp-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.fp-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding-right: 8px;
  margin-right: 4px;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}

.fp-count {
  margin-right: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fp-overlay [hidden] {
  display: none !important;
}

.fp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 38px;
  height: 38px;
  padding: 0 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #e6edf5;
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.fp-btn:hover,
.fp-btn:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.fp-btn:focus-visible,
.fp-action:focus-visible {
  outline: 2px solid #6db3ff;
  outline-offset: 1px;
}

.fp-btn:disabled {
  opacity: 0.35;
  cursor: default;
  background: transparent;
}

.fp-zoom-label {
  min-width: 56px;
  font-variant-numeric: tabular-nums;
}

.fp-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.fp-content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
}

.fp-content-fill {
  padding: 0;
  overflow: hidden;
  align-items: stretch;
}

.fp-nav {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 64px;
  margin-top: -32px;
  background: rgba(11, 20, 32, 0.72);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.fp-nav:hover,
.fp-nav:focus-visible {
  background: rgba(11, 20, 32, 0.95);
}

.fp-nav:disabled {
  display: none;
}

.fp-prev {
  left: 12px;
}

.fp-next {
  right: 12px;
}

.fp-canvas {
  position: relative;
  flex: 1 1 auto;
  margin: 16px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.fp-canvas-pannable {
  cursor: grab;
}

.fp-canvas-pannable:active {
  cursor: grabbing;
}

.fp-image {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: none;
  background: #fff;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%);
}

.fp-pdf {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  background: #d4d4d7;
}

.fp-frame {
  flex: 1 1 auto;
  width: 100%;
  border: 0;
}

.fp-media {
  max-width: 100%;
  max-height: 100%;
}

.fp-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fp-spin 0.8s linear infinite;
}

.fp-pdf .fp-spinner {
  border-color: rgba(5, 56, 97, 0.2);
  border-top-color: #053861;
}

.fp-notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 420px;
  padding: 32px 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  text-align: center;
}

.fp-notice-icon svg {
  width: 44px;
  height: 44px;
  color: #9fb0c4;
}

.fp-notice-text {
  font-size: 15px;
  line-height: 1.5;
}

.fp-action {
  display: inline-block;
  padding: 8px 18px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: #0b1420;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.fp-action:hover {
  background: #dfe8f2;
  color: #0b1420;
}

@media (max-width: 640px) {
  /* the name and the close button keep the first row; the tools take a row of their own */
  .fp-bar {
    flex-wrap: wrap;
    gap: 4px 8px;
    padding: 6px 8px 6px 12px;
  }

  .fp-meta {
    flex: 1 1 0;
    order: 1;
  }

  .fp-close {
    order: 2;
  }

  .fp-tools {
    flex: 1 1 100%;
    order: 3;
    justify-content: center;
  }

  .fp-btn-text {
    display: none;
  }

  .fp-count {
    margin-right: 2px;
  }

  .fp-group {
    padding-right: 4px;
  }

  .fp-canvas {
    margin: 8px;
  }

  .fp-nav {
    width: 36px;
    height: 52px;
    margin-top: -26px;
  }

  .fp-prev {
    left: 4px;
  }

  .fp-next {
    right: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fp-overlay {
    animation: none;
  }
}

/* ---------- a file shown on a page of its own (resource/view) ---------- */

.file-preview-inline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 10px;
}

.file-preview-inline-name {
  font-weight: 600;
  word-break: break-word;
}

.file-preview-inline-meta {
  font-size: 12px;
  color: #6c757d;
}

.file-preview-inline-body {
  text-align: center;
  background: #f1f3f6;
  border-radius: 8px;
  overflow: hidden;
}

.file-preview-inline-body img {
  max-width: 100%;
  max-height: 78vh;
  cursor: zoom-in;
}

.file-preview-inline-body video,
.file-preview-inline-body audio {
  max-width: 100%;
  margin: 16px 0;
}

.file-preview-inline-empty {
  padding: 40px 16px;
  color: #6c757d;
}
