.fileviewer {
  border-radius: 8px;
  padding: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  background-color: #fff;
  box-shadow: none;
  color: black;
  min-width: 800px;
  overflow-x: auto;
  position: relative;
}

.fileviewer--loading {
  background: transparent;
  padding: 0;
  min-width: unset;
}

.fileviewer .content {
  box-shadow: none;
  position: relative;
  z-index: 1;
  max-width: 900px;
  width: 100%;
}

@media (min-width: 901px) {
  .fileviewer {
    max-width: 1080px;
  }
}

@media (max-width: 900px) {
  .fileviewer {
    min-width: unset;
    padding: 42px 12px 20px;
    align-items: flex-start;
    overflow-x: auto;
  }

  .fileviewer .content {
    max-width: 100%;
    width: 100%;
  }

  .fileviewer-zoom-btn {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  .fileviewer-zoom-reset {
    width: auto;
    padding: 0 12px;
  }

}

.fileviewer .content img {
  width: 100%;
}

.fileviewer .preview {
  max-width: 100%;
  max-height: 100%;
}

.fileviewer .unsupported {
  color: #e7515a; 
  font-weight: bold;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fileviewer .unsupported span {
  color: #191e3a;
  font-weight: bolder;
}

.fileviewer-loader {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.fileviewer-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0e6ed;
  border-top-color: #d60000;
  border-radius: 50%;
  animation: fileviewer-spin 0.8s linear infinite;
}

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

@keyframes fv-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0);   }
}

@keyframes fv-toast-out {
  from { opacity: 1; transform: translateX(-50%) translateY(0);   }
  to   { opacity: 0; transform: translateX(-50%) translateY(8px); }
}

.fileviewer-toast {
  position: fixed;
  bottom: calc(6dvh + 64px);
  left: 50%;
  transform: translateX(-50%) translateY(0);
  z-index: 10002;
  padding: 8px 18px;
  background: #45464b;
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 13px;
  border-radius: 20px;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
}

.fileviewer-toast.is-visible {
  animation: fv-toast-in 0.2s ease both;
}

.fileviewer-toast.is-hiding {
  animation: fv-toast-out 0.2s ease both;
}

@keyframes fv-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fv-backdrop-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes fv-card-in {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

@keyframes fv-card-out {
  from { opacity: 1; transform: translateY(0)    scale(1);    }
  to   { opacity: 0; transform: translateY(24px) scale(0.97); }
}

#viewer-modal.is-opening {
  animation: fv-backdrop-in 0.22s ease both;
}

#viewer-modal.is-closing {
  animation: fv-backdrop-out 0.18s ease both;
  pointer-events: none;
}

#viewer-modal.is-opening .fileviewer {
  animation: fv-card-in 0.26s ease both;
}

#viewer-modal.is-closing .fileviewer {
  animation: fv-card-out 0.18s ease both;
}

.fileviewer .unsupported span a {
  color: #4361ee;
  cursor: pointer;
  text-decoration: underline;
}

.fileviewer-toolbar {
  position: fixed;
  bottom: 6dvh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  border: 1px solid #e0e6ed;
  border-radius: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.fileviewer-zoom-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #e0e6ed;
  border-radius: 6px;
  background: #fff;
  color: #333;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.fileviewer-zoom-btn:hover {
  background: #eff4ff;
}

.fileviewer-zoom-reset {
  font-size: 12px;
  width: auto;
  padding: 0 10px;
}

.fileviewer-zoom-label {
  min-width: 44px;
  text-align: center;
  font-size: 13px;
  color: #515365;
}

#viewer-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 9999;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  justify-content: center;
  align-items: flex-start;
  min-height: 0;
}

.fileviewer-close {
  position: fixed;
  top: 3dvh;
  right: 16px;
  z-index: 10001;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  border: 1px solid #e0e6ed;
  border-radius: 6px;
  color: #515365;
  cursor: pointer;
  transition: background 0.15s;
}

.fileviewer-close:hover {
  background: #eff4ff;
}