/* Story Builder - Canvas/Stage Styles */

.stage {
  position: relative;
  background: #ffffff;
  border-radius: 20px;
  border: var(--stage-border);
  box-shadow: var(--stage-shadow);
  overflow: hidden;
  transition: all 0.3s ease;
}

/* Drag over state */
.stage.drag-over {
  background: rgba(220, 38, 38, 0.05);
  border: 2px dashed var(--accent);
}

.stage.drag-over::before {
  content: "Drop image here";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
  pointer-events: none;
  z-index: 100;
}

/* Empty state */
.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  font-size: 16px;
  font-weight: 500;
  pointer-events: none;
}

/* Slide Thumbnails */
.thumb {
  position: relative;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  border: 2px solid transparent;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Ensure all thumb children don't interfere with dragging */
.thumb * {
  pointer-events: none;
  user-select: none;
}

.thumb:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

.thumb.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.thumb-number {
  position: absolute;
  left: 8px;
  top: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  z-index: 1;
  pointer-events: none;
  user-select: none;
}

.thumb.active .thumb-number {
  background: var(--accent);
  color: white;
}

/* Thumbnail image */
.thumb-image {
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,.08);
  display: block;
  object-fit: contain;
  background: #f8f8f8;
  pointer-events: none;
  user-select: none;
}

/* Resize Handles for Aspect Ratio Testing */
.resize-handle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 60px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
  cursor: pointer;
  opacity: 0;
  transition: none; /* No transition initially */
  z-index: 1000;
  user-select: none;
  pointer-events: auto;
}

/* Enable transitions after initialization */
.resize-handle.initialized {
  transition: all 0.2s ease;
}

.stage-wrap:hover .resize-handle.initialized {
  opacity: 1;
}

.resize-handle:hover {
  background: rgba(0, 0, 0, 0.25);
  transform: translateY(-50%) scale(1.1);
}

.resize-handle.dragging {
  background: var(--accent);
  opacity: 1;
}

.resize-handle-left {
  left: 0; /* Will be positioned dynamically */
}

.resize-handle-right {
  right: 0; /* Will be positioned dynamically */
}

/* Stage wrap needs relative positioning for handles */
.stage-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Disable transitions during drag for smooth experience */
.stage.resizing {
  transition: none;
}

/* Snap Guides */
/* Note: Colors and opacity are configured in js/snap-guides.js */
.snap-guides-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

.snap-guide {
  position: absolute;
  pointer-events: none;
  /* Colors, opacity, and box-shadow are set dynamically via JavaScript */
}

/* Responsive canvas sizing */
@media (max-width: 820px) {
  .thumb-number {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }

  /* Hide resize handles on small screens */
  .resize-handle {
    display: none;
  }
}