/* Rotate and Flip Image: styles for this tool only. Shared styles live in /tools/shared/tools.css. */

/* The dropzone shows its own file card; this tool shows the editor instead once an image is added */
.rf-has-file .dropzone-root {
  display: none;
}

.rf-editor {
  display: none;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: var(--stage-pad);
}
.rf-has-file .rf-editor {
  display: flex;
}
.rf-area {
  position: relative;
  padding: 8px;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}
.rf-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.rf-loading[hidden] {
  display: none;
}

/* The picture, on a checkerboard so transparent areas are visible */
.rf-frame {
  position: relative;
  flex: none;
  border-radius: var(--radius-md);
  background-color: var(--color-field);
  background-image:
    linear-gradient(45deg, rgba(128, 128, 128, 0.18) 25%, transparent 25%, transparent 75%, rgba(128, 128, 128, 0.18) 75%),
    linear-gradient(45deg, rgba(128, 128, 128, 0.18) 25%, transparent 25%, transparent 75%, rgba(128, 128, 128, 0.18) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
  user-select: none;
  -webkit-user-select: none;
}
.rf-frame canvas {
  display: block;
  border-radius: var(--radius-md);
  width: 100%;
  height: 100%;
}
.rf-hint {
  flex: none;
  margin-top: var(--space-3);
  text-align: center;
}

/* ---------- settings panel ---------- */

.panel-body > * {
  flex-shrink: 0; /* long settings scroll instead of squashing the controls */
}
.rf-tools {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}
.rf-tools .btn {
  padding: 0;
}
.rf-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.rf-group[hidden] {
  display: none;
}
.rf-group .field-label {
  padding-bottom: 0.25rem; /* the group's own 0.5rem gap adds the rest, like a label directly in the panel */
}
.rf-group p {
  margin: 0;
}
.rf-field-unit {
  flex: none;
  margin-left: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-muted);
}
.panel-body .slider {
  margin-top: 1.75rem; /* room for the value bubble above the thumb */
}
#rf-quality-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
#rf-quality-row .slider {
  margin-top: 0; /* the "Quality" label sits right above, like the Format label above its menu */
}
.rf-stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-1) var(--space-3);
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--color-field);
  font-size: var(--text-sm);
}
.rf-stats dt {
  color: var(--color-muted);
}
.rf-stats dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--color-ink);
}
.rf-stats dd.is-result {
  font-weight: var(--weight-bold);
}

@media (max-width: 860px) {
  /* The picture comes first and the settings follow it, instead of a sheet covering the picture */
  body.panel-open .panel {
    position: static;
    box-shadow: none;
  }
  .panel-body {
    max-height: none;
  }
  .panel-foot > .rf-stats {
    flex: 1 1 100%;
  }
  .rf-area {
    min-height: 55vh;
  }
}
