#canvas-container {
  width: 90%;
  height: 400px;
  position: relative;
  margin: 0 auto;
  perspective: 1000px;
}
#canvas-container canvas {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  margin: auto;
}
#preview-container {
  border: 1px solid #ddd;
  padding: 15px;
  margin-top: 20px;
  background-color: #f8f9fa;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.15);
}
.color-picker {
  width: 40px;
  height: 30px;
  padding: 0;
  border: none;
  margin-left: 10px;
}
#aspect-ratio-warning {
  display: none;
  color: #dc3545;
  margin-top: 10px;
  padding: 8px;
  border-radius: 5px;
  background-color: #f8d7da;
  border: 1px solid #f5c2c7;
}

.file-input-container {
  position: relative;
}
.file-input-label {
  background-color: #f8f9fa;
  border: 1px solid #ced4da;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-input-label {
  transition: all 0.3s ease;
}
.file-input-label:hover {
  background-color: #1d773b;
  color: #ffffff;
  border-color: #096a16 !important;
}
#background-file {
  display: none;
}
.clear-file-btn {
  position: absolute;
  right: 15px;
  top: 40%;
  transform: translateY(-50%);
  z-index: 10;
  cursor: pointer;
  font-size: 18px;
  color: #6c757d;
}
.clear-file-btn:hover {
  color: #dc3545;
}

/* Пояснення зон */
.info-list {
  max-width: 700px;
  margin: 1rem auto;
  padding: 0;
}
.info-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.icon {
  flex: 0 0 24px;
  height: 24px;
  margin-right: 0.75rem;
  box-sizing: border-box;
}
.icon.bleed {
  border: 2px solid #6b6b6b;
}
.icon.trim {
  border: 2px solid #2e7d32;
}
.icon.safe {
  border: 2px solid #558b2f;
}
.info-content {
  flex: 1;
}
.info-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.info-text {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #333;
}
/* Zoom cursor on hover */
#pdf-preview {
  cursor: zoom-in;
}

/* Fullscreen overlay for zoomed preview */
.fullscreen-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  justify-content: center;
  align-items: center;
  z-index: 1050;
}
.fullscreen-overlay.active {
  display: flex;
}
.fullscreen-overlay canvas {
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.7);
  width: auto;
  height: auto;
}
/* Close button inside overlay */
.fullscreen-overlay .close-btn {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
  z-index: 1060;
}

.tooltip-inner {
  max-width: 400px; /* максимальна ширина */
  width: auto;
}
.dots-container {
  text-align: center;
  margin-top: 8px;
}
.page-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 4px;
  border-radius: 50%;
  background: #ccc;
  cursor: pointer;
}
.page-dot.active {
  background: #333;
}

.fade-out {
  opacity: 0;
}
.fade-in {
  opacity: 1;
}

#pdf-preview {
  /* Increase fade duration to 0.8s */
  transition: opacity 0.8s ease !important;
}
#pdf-preview.fade-out {
  opacity: 0 !important;
}

@keyframes flip {
  0% {
    transform: rotateY(0deg) scaleX(1);
  }
  50% {
    transform: rotateY(90deg) scaleX(1);
  }
  51% {
    /* Start mirroring after the halfway point */
    transform: rotateY(90deg) scaleX(-1);
  }
  100% {
    transform: rotateY(180deg) scaleX(-1);
  }
}

/* Apply flip animation when toggled */
#pdf-preview.flip {
  /* Slow flip to 1s */
  animation: flip 1s ease-in-out;
  /* ensure 3D rendering context */
  transform-style: preserve-3d;
  backface-visibility: visible;
  transform-origin: center center; /* pivot flip around center */
}
