.jtg-unduhan-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-family: Inter, Arial, sans-serif;
  color: #222;
}

.jtg-unduhan-modal[hidden] {
  display: none !important;
}

.jtg-unduhan-modal.is-open {
  display: flex;
}

.jtg-unduhan-modal--download {
  z-index: 100002;
}

.jtg-unduhan-modal--preview {
  z-index: 100003;
  padding: 0;
}

.jtg-unduhan-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
}

.jtg-unduhan-modal__panel {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}

.jtg-unduhan-list-panel {
  width: min(720px, 92vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 18px 18px 16px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.jtg-unduhan-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.jtg-unduhan-list-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  color: #37475c;
}

.jtg-unduhan-list-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  max-height: calc(90vh - 92px);
  padding-right: 2px;
}

.jtg-unduhan-icon-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: #eef1f8;
  color: #353d97;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.jtg-unduhan-icon-close:hover,
.jtg-unduhan-icon-close:focus-visible {
  background: #353d97;
  color: #fff;
}

.jtg-unduhan-download-panel {
  width: min(420px, 92vw);
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px 22px;
  text-align: center;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.jtg-unduhan-spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 14px;
  border: 3px solid #d9def5;
  border-top-color: #353d97;
  border-radius: 50%;
  animation: jtg-unduhan-spin 0.8s linear infinite;
}

.jtg-unduhan-spinner[hidden] {
  display: none !important;
}

.jtg-unduhan-download-label {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #37475c;
}

.jtg-unduhan-download-name,
.jtg-unduhan-download-error {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: #5c6570;
  word-break: break-word;
}

.jtg-unduhan-download-error {
  color: #9b2c2c;
}

.jtg-unduhan-download-error[hidden] {
  display: none !important;
}

.jtg-unduhan-progress {
  height: 6px;
  margin-top: 16px;
  overflow: hidden;
  background: #e6e9f5;
  border-radius: 999px;
}

.jtg-unduhan-progress[hidden] {
  display: none !important;
}

.jtg-unduhan-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: #353d97;
}

.jtg-unduhan-progress.is-indeterminate span {
  width: 40%;
  animation: jtg-unduhan-indeterminate 1s ease-in-out infinite;
}

.jtg-unduhan-download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.jtg-unduhan-download-actions:not(:has(:not([hidden]))) {
  display: none;
}

.jtg-unduhan-text-btn,
.jtg-unduhan-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
}

.jtg-unduhan-text-btn[hidden],
.jtg-unduhan-fallback[hidden] {
  display: none !important;
}

.jtg-unduhan-text-btn {
  border: 1px solid #353d97;
  background: #fff;
  color: #353d97;
}

.jtg-unduhan-fallback {
  border: 0;
  background: #353d97;
  color: #fff;
}

.jtg-unduhan-preview-panel {
  display: flex;
  flex-direction: column;
  width: 90vw;
  height: 90vh;
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  background: #0f172a;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.jtg-unduhan-preview-bar {
  display: flex;
  flex: 0 0 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 48px;
  padding: 0 12px 0 16px;
  background: #1e293b;
  color: #fff;
}

.jtg-unduhan-preview-title {
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jtg-unduhan-preview-bar .jtg-unduhan-icon-close {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.jtg-unduhan-viewer {
  flex: 1 1 auto;
  min-height: 0;
  background: #111;
}

.jtg-unduhan-viewer.is-pdf {
  background: #525659;
}

.jtg-unduhan-viewer.is-video {
  background: #111;
}

.jtg-unduhan-viewer iframe,
.jtg-unduhan-viewer img,
.jtg-unduhan-viewer video {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  object-fit: contain;
}

.jtg-unduhan-viewer iframe[hidden],
.jtg-unduhan-viewer img[hidden],
.jtg-unduhan-viewer video[hidden] {
  display: none !important;
}

html.jtg-unduhan-lock,
html.jtg-unduhan-lock body {
  overflow: hidden;
}

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

@keyframes jtg-unduhan-indeterminate {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(280%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .jtg-unduhan-spinner,
  .jtg-unduhan-progress.is-indeterminate span {
    animation: none;
  }
}
