/* ============================================================
   DIPON STUDIO NEXT-GEN — Canvas & Paper Sheet Styles
   Realistic physical paper card with millimeter layers
   ============================================================ */

.studio-paper-sheet {
  position: relative;
  background-color: var(--bg-paper);
  box-shadow: var(--shadow-paper);
  overflow: visible;
  user-select: none;
}

/* Paper Corner Dimension Tag */
.paper-specs-badge {
  position: absolute;
  top: -28px;
  left: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  pointer-events: none;
}

/* Layer: Millimeter Grid */
.layer-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.85;
}

/* Layer: Hardware Safe Margins */
.layer-safe-margins {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.safe-boundary-box {
  position: absolute;
  border: 1px dashed rgba(239, 68, 68, 0.7);
  background: transparent;
  pointer-events: none;
}

.safe-roller-deadzone {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: repeating-linear-gradient(
    -45deg,
    rgba(239, 68, 68, 0.05),
    rgba(239, 68, 68, 0.05) 6px,
    rgba(239, 68, 68, 0.12) 6px,
    rgba(239, 68, 68, 0.12) 12px
  );
  border-top: 1.5px dashed rgba(239, 68, 68, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.safe-roller-deadzone.has-active-alert {
  background: repeating-linear-gradient(
    -45deg,
    rgba(239, 68, 68, 0.12),
    rgba(239, 68, 68, 0.12) 6px,
    rgba(239, 68, 68, 0.22) 6px,
    rgba(239, 68, 68, 0.22) 12px
  );
  border-top-color: var(--accent-danger);
  border-top-width: 2px;
  animation: pulseDeadzone 2s infinite ease-in-out;
}

@keyframes pulseDeadzone {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.65; }
}

.roller-tag {
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #e2e8f0;
  padding: 5px 12px;
  border-radius: var(--radius-xs);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.roller-tag.danger {
  background: rgba(225, 29, 72, 0.95);
  border-color: #f43f5e;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(225, 29, 72, 0.4);
}

.btn-roller-fix {
  background: #ffffff;
  color: #881337;
  font-weight: 700;
  border: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  pointer-events: auto;
}

.btn-roller-fix:hover {
  background: #ffe4e6;
  transform: translateY(-1px);
}

/* Paper Scrap Cutline (Penghemat Kertas Studio) */
.paper-scrap-cutline {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-top: 1.5px dashed #10b981;
  pointer-events: none;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scrap-pill {
  background: rgba(6, 78, 59, 0.92);
  border: 1px solid #10b981;
  color: #a7f3d0;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
  pointer-events: auto;
  white-space: nowrap;
  transform: translateY(-50%);
}

/* Layer: Guillotine Crop Marks */
.layer-crop-marks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Continuous Guillotine Straight Cut Lines */
.guillotine-line {
  position: absolute;
  pointer-events: none;
  z-index: 5;
}

.guillotine-line.vert {
  top: 0;
  bottom: 0;
  width: 1px;
  border-left: 1px dashed rgba(71, 85, 105, 0.45);
}

.guillotine-line.horiz {
  left: 0;
  right: 0;
  height: 1px;
  border-top: 1px dashed rgba(71, 85, 105, 0.45);
}

.crop-mark-group {
  position: absolute;
  pointer-events: none;
}

.crop-corner {
  position: absolute;
  width: 9px;
  height: 9px;
}

.crop-corner.top-left {
  top: -6px;
  left: -6px;
  border-top: 1px solid #1a1a1a;
  border-left: 1px solid #1a1a1a;
}
.crop-corner.top-right {
  top: -6px;
  right: -6px;
  border-top: 1px solid #1a1a1a;
  border-right: 1px solid #1a1a1a;
}
.crop-corner.bottom-left {
  bottom: -6px;
  left: -6px;
  border-bottom: 1px solid #1a1a1a;
  border-left: 1px solid #1a1a1a;
}
.crop-corner.bottom-right {
  bottom: -6px;
  right: -6px;
  border-bottom: 1px solid #1a1a1a;
  border-right: 1px solid #1a1a1a;
}

/* Layer: Items */
.layer-items {
  position: absolute;
  inset: 0;
}

.canvas-item {
  position: absolute;
  cursor: move;
  touch-action: none;
  transition: box-shadow 0.15s;
}

.canvas-item .item-content-box {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.canvas-item .item-content-box.has-pas-border {
  background: #ffffff;
  box-sizing: border-box;
}

.canvas-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.empty-item-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  padding: 6px;
}

.empty-item-placeholder small {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #cbd5e1;
}

/* Item Selection Frame */
.canvas-item.is-selected {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 1px;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.4);
}

/* Dimension Pill Overlay */
.item-dim-pill {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  box-shadow: var(--shadow-sm);
  z-index: 20;
}

.canvas-item:hover .item-dim-pill,
.canvas-item.is-selected .item-dim-pill {
  opacity: 1;
}

/* Safe Margin Violation Alert */
.canvas-item.has-margin-violation {
  outline: 2px solid var(--accent-danger) !important;
}

.item-warn-badge {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-danger);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
  z-index: 20;
}

/* Transform Handles */
.item-handles-wrap {
  position: absolute;
  inset: -5px;
  pointer-events: none;
}

.handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #ffffff;
  border: 2px solid var(--accent-cyan);
  border-radius: 2px;
  pointer-events: auto;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.handle-nw { top: -5px; left: -5px; cursor: nwse-resize; }
.handle-n  { top: -5px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.handle-ne { top: -5px; right: -5px; cursor: nesw-resize; }
.handle-e  { top: 50%; right: -5px; transform: translateY(-50%); cursor: ew-resize; }
.handle-se { bottom: -5px; right: -5px; cursor: nwse-resize; }
.handle-s  { bottom: -5px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.handle-sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.handle-w  { top: 50%; left: -5px; transform: translateY(-50%); cursor: ew-resize; }

.handle-rotate {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 16px;
  background: var(--bg-surface-elevated);
  border: 2px solid var(--accent-cyan);
  border-radius: 50%;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: grab;
  pointer-events: auto;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.handle-rotate:hover {
  background: var(--accent-cyan);
  color: #000;
}
