/* Attendee icon upload/crop editor (/profile). Loaded only there -- see
   TicketLayout. Builds on the shared .button / .field-help / .inline-status
   rules in /styles/app.css and profile.css rather than repeating them. */

.icon-editor {
  display: grid;
  gap: 16px;
}

/* The crop editor/preview goes in a right column next to the file/URL/
   GitHub inputs on desktop (stacked below them on mobile, the grid's
   default single column above this breakpoint). #icon-current (the
   already-saved icon + remove button) and #icon-status (the live region)
   stay full-width -- neither belongs to one side or the other. */
@media (min-width: 768px) {
  .icon-editor {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }

  .icon-current,
  #icon-status {
    grid-column: 1 / -1;
  }
}

.icon-current {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-current-image {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, .125);
}

/* ---- source picker ------------------------------------------------- */

.icon-source-picker {
  display: grid;
  gap: 12px;
}

.icon-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 96px;
  padding: 16px;
  border: 2px dashed #ced4da;
  border-radius: .5rem;
  color: var(--muted, #495057);
  cursor: pointer;
}

.icon-dropzone:focus-visible {
  outline: 2px solid var(--purple, #7952b3);
  outline-offset: 2px;
}

.icon-import-row {
  display: grid;
  gap: 4px;
}

.icon-import-controls {
  display: flex;
  gap: 8px;
}

.icon-import-controls input {
  flex: 1;
  min-width: 0;
  border: 1px solid #ced4da;
  border-radius: .375rem;
  padding: 8px 12px;
  font: inherit;
}

/* ---- crop editor ----------------------------------------------------- */

.icon-crop-panel {
  display: grid;
  gap: 20px;
  padding: 16px;
  border: 1px solid rgba(0, 0, 0, .125);
  border-radius: .5rem;
  background: #fff;
}

/* Side by side on very wide viewports only: editor left, requirements +
   how-it-will-look preview right. This panel already lives in
   .icon-editor's own right column from 768px up (see above), so splitting
   it internally too needs real room to spare -- 1100px keeps it stacked
   (canvas above requirements) through ordinary desktop widths, where a
   second nested split would squeeze the crop canvas down to a quarter of
   the page. */
@media (min-width: 1100px) {
  .icon-crop-panel { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}

.icon-crop-editor,
.icon-crop-result {
  display: grid;
  gap: 12px;
  align-content: start;
}

.icon-crop-canvas {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: .5rem;
  background: #e9ecef;
  cursor: grab;
  touch-action: none;
}

.icon-crop-canvas:active { cursor: grabbing; }

.icon-crop-canvas:focus-visible {
  outline: 2px solid var(--purple, #7952b3);
  outline-offset: 2px;
}

.icon-zoom-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-zoom-row input[type="range"] { flex: 1; }

.icon-requirements {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  font-size: .9rem;
}

.requirement-ok { color: #146c43; }
.requirement-bad { color: #b02a37; }

.icon-preview-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}

.icon-preview-item { text-align: center; }

/* Canvas elements don't shrink to fit a narrow container the way an <img>
   does -- without this, a squeezed .icon-crop-result column (e.g. the
   desktop two-column crop panel at ~1280px) lets the 96x96 swatches
   overflow instead of wrapping/shrinking. */
.icon-preview-circle,
.icon-preview-square {
  max-width: 100%;
  height: auto;
}

.icon-preview-circle {
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, .125);
}

.icon-preview-square {
  border-radius: .25rem;
  border: 1px solid rgba(0, 0, 0, .125);
}

.icon-crop-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- mobile: stack, keep the crop canvas full-width ------------------- */

@media (max-width: 600px) {
  .icon-import-controls { flex-direction: column; align-items: stretch; }
  .icon-preview-row { flex-wrap: wrap; }
}
