/* ==========================================================================
   circlecrop.css — circular crop tool. Single image + single circle overlay,
   exported as a square PNG with everything outside the circle transparent.
   ========================================================================== */

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

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

.view-circlecrop .circlecrop-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: auto;
}

.view-circlecrop .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-circlecrop .circlecrop-sidebar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.4px;
  flex-shrink: 0;
}

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

.view-circlecrop .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-circlecrop .hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  margin: 0;
  line-height: 1.45;
}

/* -------- upload zone (cc-prefix to avoid colliding with article tool) -------- */

.view-circlecrop .cc-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-circlecrop .cc-upload-zone:hover,
.view-circlecrop .cc-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-circlecrop .cc-upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

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

.view-circlecrop .cc-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-circlecrop .cc-upload-title {
  font-weight: 700;
  font-size: 13.5px;
}

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

/* -------- buttons + bottom bar -------- */

.view-circlecrop 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-circlecrop .btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 18px rgba(123, 31, 31, 0.35);
}

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

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

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

.view-circlecrop .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);
  margin-top: auto;
}

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

.view-circlecrop .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-circlecrop .canvas-stage {
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  border-radius: 4px;
  /* checkerboard so the user can see transparency around the loaded image
     during interaction (matches other tools) */
  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-circlecrop #circlecrop-canvas {
  position: relative;
  overflow: hidden;
}

.view-circlecrop .cc-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-circlecrop .cc-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  pointer-events: none;
  -webkit-user-drag: none;
}

.view-circlecrop .cc-mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* background set inline via JS as a radial-gradient */
}

.view-circlecrop .cc-shape {
  position: absolute;
  top: 0;
  left: 0;
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  box-sizing: border-box;
  cursor: move;
  touch-action: none;
  /* width / height / transform set inline */
}

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

@media (max-width: 768px) {
  .view-circlecrop {
    flex-direction: column;
  }
  .view-circlecrop .circlecrop-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-circlecrop .circlecrop-sidebar h1,
  .view-circlecrop .circlecrop-sidebar .desc {
    display: none;
  }
  .view-circlecrop .canvas-wrap {
    order: 1;
    flex: 1;
    height: 55%;
    padding: 12px;
  }
}

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