/* pr420_doc_viewer.css — PR420 Document Viewer Engine */
/* Full-screen takeover, mobile + desktop, z-index above all overlays */

/* ── Overlay base ── */
.tr420-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  background: #1a1a2e;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  font-family: 'Barlow', 'Barlow Condensed', sans-serif;
  box-sizing: border-box;
}

.tr420-overlay.tr420-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.tr420-overlay.tr420-closing {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

/* ── Header ── */
.tr420-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #141310;
  padding: 12px 16px;
  border-bottom: 2px solid #FF6B00;
  flex-shrink: 0;
  min-height: 56px;
  box-sizing: border-box;
}

.tr420-header-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.tr420-title {
  font-family: 'Barlow Condensed', 'Barlow', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.tr420-project-tag {
  font-size: 11px;
  font-weight: 600;
  color: #aaaaaa;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tr420-project-tag:empty {
  display: none;
}

.tr420-type-chip {
  font-size: 10px;
  font-weight: 700;
  color: #FF6B00;
  background: rgba(255, 107, 0, 0.15);
  border: 1px solid rgba(255, 107, 0, 0.4);
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
  letter-spacing: 0.04em;
}

/* ── Close button ── */
.tr420-close-btn {
  background: none;
  border: 1px solid #444444;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Barlow', sans-serif;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
  margin-left: 12px;
  padding: 0;
}

.tr420-close-btn:hover,
.tr420-close-btn:focus {
  background: rgba(255, 107, 0, 0.2);
  border-color: #FF6B00;
  outline: none;
}

/* ── Body ── */
.tr420-body {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: #0d0c0a;
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-height: 0;
}

/* ── PDF iframe ── */
.tr420-pdf-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #ffffff;
}

/* ── Image viewer ── */
.tr420-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  margin: auto;
}

/* ── Download-only message (DOCX/XLSX) ── */
.tr420-download-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  color: #cccccc;
  gap: 12px;
  width: 100%;
}

.tr420-dl-icon {
  font-size: 48px;
  font-weight: 700;
  color: #FF6B00;
  font-family: 'Barlow Condensed', monospace;
  line-height: 1;
  border: 3px solid #FF6B00;
  border-radius: 8px;
  padding: 8px 16px;
  margin-bottom: 8px;
}

.tr420-download-msg p {
  font-size: 15px;
  color: #cccccc;
  margin: 0;
}

.tr420-dl-sub {
  font-size: 13px;
  color: #888888;
}

/* ── Action bar ── */
.tr420-action-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 16px;
  background: #141310;
  border-top: 1px solid #2a2a3e;
  flex-shrink: 0;
  min-height: 56px;
  box-sizing: border-box;
}

.tr420-action-bar:empty {
  display: none;
}

/* ── Action buttons ── */
.tr420-action-btn {
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.tr420-action-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.tr420-btn-download {
  background: #2a2a3e;
  color: #ffffff;
  border: 1px solid #444466;
}

.tr420-btn-download:hover {
  background: #333355;
}

.tr420-btn-approve {
  background: #1a7a3a;
  color: #ffffff;
}

.tr420-btn-approve:hover {
  background: #218f44;
}

/* Confirming state */
.tr420-btn-approve[data-confirming="true"],
.tr420-btn-sendback[data-confirming="true"] {
  background: #FF6B00;
  color: #ffffff;
  font-size: 11px;
  padding: 8px 12px;
}

.tr420-btn-sendback {
  background: #6a2a2a;
  color: #ffffff;
}

.tr420-btn-sendback:hover {
  background: #882222;
}

/* ── Mobile overrides (max 768px) ── */
@media (max-width: 768px) {
  .tr420-header {
    padding: 10px 12px;
    min-height: 52px;
  }

  .tr420-title {
    font-size: 13px;
    max-width: 160px;
  }

  .tr420-project-tag {
    display: none;
  }

  .tr420-type-chip {
    font-size: 9px;
    padding: 2px 5px;
  }

  .tr420-close-btn {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }

  .tr420-action-bar {
    padding: 8px 12px;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .tr420-action-btn {
    flex: 1;
    min-width: 80px;
    font-size: 12px;
    padding: 9px 10px;
    text-align: center;
  }

  .tr420-dl-icon {
    font-size: 36px;
    padding: 6px 12px;
  }

  .tr420-download-msg p {
    font-size: 14px;
  }
}

/* ── Small phones (max 375px) ── */
@media (max-width: 375px) {
  .tr420-title {
    max-width: 120px;
    font-size: 12px;
  }

  .tr420-type-chip {
    display: none;
  }

  .tr420-action-btn {
    font-size: 11px;
    padding: 8px 8px;
  }
}

/* ── Large desktop (min 1280px) ── */
@media (min-width: 1280px) {
  .tr420-title {
    max-width: 420px;
    font-size: 16px;
  }

  .tr420-header {
    padding: 14px 24px;
  }

  .tr420-action-bar {
    padding: 12px 24px;
    gap: 12px;
  }

  .tr420-action-btn {
    font-size: 14px;
    padding: 10px 20px;
  }
}
