/* ==========================================================================
   multicrop.css — multi-shape crop tool (circles / rectangles, each with
   its own invert toggle). On-canvas preview uses simple borders; the PNG
   export composites the actual masking.
   ========================================================================== */

.view-multicrop {
  display: flex;
  background: #0a1220;
  color: #f1f5f9;
  height: 100%;
  overflow: hidden;
}

/* -------- sidebar -------- */

.view-multicrop .multicrop-sidebar {
  width: 360px;
  flex-shrink: 0;
  padding: 28px 22px 22px;
  background: linear-gradient(180deg, #111a29 0%, #09111f 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  overflow-y: auto;
}

.view-multicrop .badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: rgba(255, 255, 255, 0.92);
  flex-shrink: 0;
  align-self: flex-start;
}

.view-multicrop .multicrop-sidebar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.4px;
  flex-shrink: 0;
}

.view-multicrop .multicrop-sidebar .desc {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12.5px;
  line-height: 1.65;
  flex-shrink: 0;
}

.view-multicrop .section-title {
  margin: 8px 0 -2px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: rgba(255, 255, 255, 0.52);
  flex-shrink: 0;
}

.view-multicrop .hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  margin: 0;
  line-height: 1.45;
}

/* -------- upload zone -------- */

.view-multicrop .mc-upload-zone {
  display: block;
  position: relative;
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  padding: 22px 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  transition: 0.2s ease;
  cursor: pointer;
  flex-shrink: 0;
}

.view-multicrop .mc-upload-zone:hover,
.view-multicrop .mc-upload-zone.dragover {
  border-color: rgba(138, 180, 255, 0.9);
  background: linear-gradient(180deg, rgba(138, 180, 255, 0.12), rgba(255, 255, 255, 0.05));
  box-shadow: 0 0 0 4px rgba(138, 180, 255, 0.10);
}

.view-multicrop .mc-upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.view-multicrop .mc-upload-content {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 8px;
  pointer-events: none;
}

.view-multicrop .mc-upload-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  font-size: 20px;
}

.view-multicrop .mc-upload-title {
  font-weight: 700;
  font-size: 13.5px;
}

.view-multicrop .mc-upload-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.55;
}

/* -------- buttons -------- */

.view-multicrop button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
  font-family: inherit;
}

.view-multicrop .btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 18px rgba(123, 31, 31, 0.35);
}

.view-multicrop .btn-primary:hover:not(:disabled) {
  background: #921f1f;
  box-shadow: 0 8px 22px rgba(123, 31, 31, 0.45);
}

.view-multicrop .btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.view-multicrop .btn-export {
  width: 100%;
}

.view-multicrop .add-row {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.view-multicrop .add-row button {
  flex: 1;
  font-size: 12px;
  padding: 9px 10px;
}

/* -------- shape list — sidebar itself handles scrolling, list sizes
   to its content so the whole sidebar scrolls as one on small viewports */

.view-multicrop .card-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.view-multicrop .mc-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  user-select: none;
  transition: 0.15s ease;
}

.view-multicrop .mc-list-item.is-selected {
  border-color: rgba(138, 180, 255, 0.9);
  background: rgba(138, 180, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(138, 180, 255, 0.10);
}

.view-multicrop .mc-list-item.is-inverted {
  border-color: rgba(255, 100, 100, 0.55);
}

.view-multicrop .mc-list-item.mc-dragging {
  opacity: 0.5;
}

.view-multicrop .mc-list-item.mc-drop-before {
  border-top: 2px solid rgba(138, 180, 255, 0.95);
}

.view-multicrop .mc-list-grip {
  color: rgba(255, 255, 255, 0.4);
  font-size: 12px;
  cursor: grab;
  flex-shrink: 0;
  letter-spacing: -2px;
}

.view-multicrop .mc-list-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
}

.view-multicrop .mc-list-label {
  flex: 1;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-multicrop .mc-list-invert {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.78);
  user-select: none;
  flex-shrink: 0;
}

.view-multicrop .mc-list-invert input[type='checkbox'] {
  cursor: pointer;
  accent-color: rgba(255, 80, 80, 0.95);
}

.view-multicrop .mc-list-delete {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  background: rgba(196, 55, 55, 0.14);
  color: #ffd2d2;
  border: 1px solid rgba(196, 55, 55, 0.18);
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.15s ease;
  flex-shrink: 0;
}

.view-multicrop .mc-list-delete:hover {
  background: rgba(196, 55, 55, 0.28);
  color: #fff;
}

/* -------- bottom bar -------- */

.view-multicrop .bottom-bar {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* -------- canvas area -------- */

.view-multicrop .canvas-wrap {
  flex: 1;
  min-width: 0;
  height: 100%;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.025), transparent 60%),
    linear-gradient(180deg, #0d1422 0%, #060b14 100%);
  overflow: auto;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-multicrop .canvas-stage {
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  border-radius: 4px;
  background-color: #2c3850;
  background-image:
    linear-gradient(45deg, #1e2940 25%, transparent 25%),
    linear-gradient(-45deg, #1e2940 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1e2940 75%),
    linear-gradient(-45deg, transparent 75%, #1e2940 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.view-multicrop #multicrop-canvas {
  position: relative;
  /* shapes can extend beyond the image bounds — keep them visible and
     clickable. The image itself is sized to fill this box exactly so it
     never overflows. */
  overflow: visible;
}

.view-multicrop .mc-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  text-align: center;
  padding: 20px;
  pointer-events: none;
}

.view-multicrop .mc-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* SVG overlay sitting on top of the image, below the shape control divs.
   Renders a mask that dims the "to be hidden" regions so the user can see
   which areas will keep image content vs. become transparent. */
.view-multicrop .mc-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.view-multicrop .mc-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none; /* the children re-enable pointer events */
}

/* -------- shape overlays (on canvas) -------- */

.view-multicrop .mc-shape {
  position: absolute;
  top: 0;
  left: 0;
  cursor: move;
  border: 2px solid rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.05);
  box-sizing: border-box;
  touch-action: none;
  transform-origin: 50% 50%;
  pointer-events: auto;
}

.view-multicrop .mc-shape--circle {
  border-radius: 50%;
}

.view-multicrop .mc-shape.is-inverted {
  border-color: rgba(255, 80, 80, 0.95);
  background: rgba(255, 80, 80, 0.18);
}

/* -------- responsive -------- */

@media (max-width: 768px) {
  .view-multicrop {
    flex-direction: column;
  }
  .view-multicrop .multicrop-sidebar {
    order: 2;
    width: 100%;
    height: 45%;
    flex-shrink: 0;
    border-right: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 16px;
    gap: 10px;
  }
  .view-multicrop .multicrop-sidebar h1,
  .view-multicrop .multicrop-sidebar .desc {
    display: none;
  }
  .view-multicrop .canvas-wrap {
    order: 1;
    flex: 1;
    height: 55%;
    padding: 12px;
  }
}

@media (max-width: 768px) and (orientation: landscape) {
  .view-multicrop {
    flex-direction: row;
  }
  .view-multicrop .multicrop-sidebar {
    order: 0;
    width: 280px;
    height: 100%;
    border-top: none;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
  }
  .view-multicrop .canvas-wrap {
    height: 100%;
  }
}
