/* ============================================================
   ESQUALO Agent Portal — Document viewer fullscreen fix
   Purpose: make the embedded PDF/Doc preview fill the available area
   Works with: .document-viewer__page--frame (added by JS)
   ============================================================ */

/* Give the document page a definite height so nested sizing works consistently */
.document-page {
  height: 100vh;
  min-height: 100vh;
}

/* The viewer area becomes a positioning context for an absolute "frame" */
.document-viewer {
  position: relative;
  overflow: hidden;
}

/* When a frame (iframe) is present, remove centering/padding issues */
.document-viewer:has(.document-viewer__page--frame),
.document-viewer:has(.document-viewer__page iframe) {
  display: block;
  padding: 18px;
  background-color: var(--color-border);
}

@media (max-width: 899px) {
  .document-viewer:has(.document-viewer__page--frame),
  .document-viewer:has(.document-viewer__page iframe) {
    padding: 0;
  }
}

/* The actual frame: fill the viewer area (minus padding), regardless of viewport math */
.document-viewer__page--frame,
.document-viewer__page:has(iframe) {
  position: absolute;
  inset: 18px;

  /* Undo the placeholder card styling */
  width: auto !important;
  max-width: none !important;
  height: auto !important;
  aspect-ratio: auto !important;
  padding: 0 !important;
  margin: 0 !important;

  border-radius: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  background: var(--color-white);
}

@media (max-width: 899px) {
  .document-viewer__page--frame,
  .document-viewer__page:has(iframe) {
    inset: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

/* Make the embedded PDF viewer fill the frame */
.document-viewer__page--frame iframe,
.document-viewer__page:has(iframe) iframe {
  width: 100% !important;
  height: 100% !important;
  border: 0;
  display: block;
}

/* PDF.js variant: gebruikt dezelfde "frame" positioning, maar moet kunnen scrollen */
.document-viewer__page--pdfjs {
  overflow: auto !important;
  -webkit-overflow-scrolling: touch;
  background: var(--color-white, #fff);
}

/* Stage + canvas centreren */
.document-viewer__page--pdfjs .pdfjs-stage {
  padding: 12px;
  min-height: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.document-viewer__page--pdfjs .pdfjs-canvas {
  display: block;
  /* optioneel: schaduw zoals je iframe had */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border-radius: 0;
}
@media (max-width: 899px) {
  .document-viewer__page--pdfjs .pdfjs-stage { padding: 0; }
  .document-viewer__page--pdfjs .pdfjs-canvas { border-radius: 0; box-shadow: none; }
}
/* ----- Header action buttons (Download + Send) ----- */
.document-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Ensure both look like real buttons */
.document-header__download,
.document-header__share {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border-radius: 0;
  font-size: 14px;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  line-height: 1;
}

/* Primary button = Download (keep black) */
.document-header__download {
  background: #111;
  color: #fff;
  border: 1px solid #111;
}

.document-header__download:hover {
  filter: brightness(1.05);
}

/* Secondary button = Send (make it a real button) */
.document-header__share {
  background: #fff;
  color: #111;
  border: 1px solid rgba(0,0,0,.25);
}

.document-header__share:hover {
  background: rgba(0,0,0,.04);
}

.document-header__share:active,
.document-header__download:active {
  transform: translateY(1px);
}

.document-header__share:focus-visible,
.document-header__download:focus-visible {
  outline: 3px solid rgba(0,0,0,.18);
  outline-offset: 2px;
}

/* On small screens, reduce padding a bit */
@media (max-width: 520px) {
  .document-header__download,
  .document-header__share {
    height: 40px;
    padding: 0 14px;
    border-radius: 0;
    font-size: 13px;
  }
}

/* iOS: verberg de zoom dropdown van PDF.js (alleen in de iframe-viewer) */
@supports (-webkit-touch-callout: none) {
  /* dit werkt als iOS-detectie in CSS */
  iframe.pdfjs-frame {
    /* niets */
  }
}

.document-viewer__page--frame {
  touch-action: pan-x pan-y; /* laat scroll toe */
}
.document-viewer__page--frame.pinch-captured {
  touch-action: none; /* als je later wil togglen */
}

/* iOS: voorkom dat de pagina zelf kan scrollen/zoomen; laat de viewer het werk doen */
html, body {
  height: 100%;
  overflow: hidden;
}

/* jouw layout lijkt al flex-achtig; dit maakt het hard */
.document-page {
  height: 100vh;
  overflow: hidden;
}

/* de viewer moet de beschikbare ruimte krijgen */
.document-viewer {
  flex: 1;
  min-height: 0; /* belangrijk in flex layouts, anders kan iframe niet netjes krimpen */
  overflow: hidden;
}

/* als je de pdfjs via iframe embedt: */
.document-viewer iframe,
.document-viewer__iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}