/* SEDTRACKER Online — Attachment viewer modal */

.cp-attachment-viewer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  z-index: 10040;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 12, 0.72);
  padding: 26px;
}

.cp-attachment-viewer-card {
  width: min(1100px, 94vw);
  height: calc(100vh - 52px);
  height: calc(100dvh - 52px);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(to bottom, #2b3036, #1a1d21);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55);
}

.cp-attachment-viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(to bottom, #16191d, #0b0d0f);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.cp-attachment-viewer-head h3 {
  font-size: 12px;
  font-weight: 800;
  color: #f2f5f8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cp-attachment-viewer-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #f2f5f8;
  font-size: 18px;
  cursor: pointer;
}

.cp-attachment-viewer-close:hover {
  background: rgba(217, 83, 79, 0.4);
}

.cp-attachment-viewer-body {
  flex: 1;
  min-height: 0;
  display: flex;
  background: #101214;
}

.cp-attachment-viewer-image-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px 56px;
}

.cp-attachment-viewer-image-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

.cp-attachment-viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 72px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 2;
}

.cp-attachment-viewer-nav::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55));
}

.cp-attachment-viewer-nav-prev {
  left: 8px;
}

.cp-attachment-viewer-nav-next {
  right: 8px;
}

.cp-attachment-viewer-nav-prev::before {
  border-top: 16px solid transparent;
  border-bottom: 16px solid transparent;
  border-right: 22px solid rgba(242, 245, 248, 0.88);
}

.cp-attachment-viewer-nav-next::before {
  border-top: 16px solid transparent;
  border-bottom: 16px solid transparent;
  border-left: 22px solid rgba(242, 245, 248, 0.88);
}

.cp-attachment-viewer-nav-prev:hover::before {
  border-right-color: #59b7de;
}

.cp-attachment-viewer-nav-next:hover::before {
  border-left-color: #59b7de;
}

.cp-attachment-viewer-nav:focus-visible {
  outline: 2px solid #59b7de;
  outline-offset: 4px;
  border-radius: 6px;
}

.cp-attachment-viewer-pdf-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  background: #101214;
}

.cp-attachment-viewer-pdf-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  background: #1a1d21;
}

.cp-attachment-viewer-pdf {
  flex: 1;
  border: none;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #ffffff;
}

.cp-attachment-viewer-pdf-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  pointer-events: none;
  background: rgba(16, 18, 20, 0.78);
  color: #f2f5f8;
  transition: opacity 180ms ease;
}

.cp-attachment-viewer-pdf-loading[hidden] {
  display: none !important;
}

.cp-attachment-viewer-pdf-loading.is-leaving {
  opacity: 0;
}

.cp-attachment-viewer-pdf-loading p {
  margin: 0;
  max-width: 320px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  color: rgba(242, 245, 248, 0.88);
}

.cp-attachment-viewer-pdf-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(159, 215, 239, 0.22);
  border-top-color: #59b7de;
  animation: cp-attachment-pdf-spin 0.8s linear infinite;
}

@keyframes cp-attachment-pdf-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .cp-attachment-viewer-pdf-spinner {
    animation: none;
    border-top-color: rgba(159, 215, 239, 0.22);
    border-color: #59b7de;
  }

  .cp-attachment-viewer-pdf-loading {
    transition: none;
  }
}

.cp-attachment-viewer-pdf-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(to bottom, #16191d, #0b0d0f);
  color: rgba(242, 245, 248, 0.72);
  font-size: 11px;
}

.cp-attachment-viewer-pdf-actions a {
  color: #9fd7ef;
  font-weight: 800;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(89, 183, 222, 0.55);
  background: rgba(89, 183, 222, 0.12);
}

.cp-attachment-viewer-pdf-actions a:hover {
  background: rgba(89, 183, 222, 0.28);
  color: #ffffff;
}

.cp-attachment-viewer-fallback {
  flex: 1;
  display: grid;
  place-content: center;
  gap: 12px;
  color: rgba(242, 245, 248, 0.7);
  text-align: center;
  padding: 24px;
}

.cp-attachment-viewer-fallback a {
  color: #9fd7ef;
  font-weight: 700;
}
