/* Image crop modal for the Graphic form (controllers/image_crop_controller.js).
   Plain classes on purpose: the modal is also exercised outside Tailwind's build. */

.crop-modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; }
.crop-modal.hidden { display: none; }
.crop-scrim { position: absolute; inset: 0; background: rgba(23, 26, 28, 0.55); }
.crop-dialog { position: relative; width: min(980px, 100%); max-height: calc(100vh - 48px); background: #fff; border-radius: 12px; box-shadow: 0 24px 64px rgba(0,0,0,.35); display: flex; flex-direction: column; overflow: hidden; }

.crop-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; border-bottom: 1px solid #E2E8F0; }
.crop-header h2 { margin: 0; font-size: 18px; font-weight: 600; color: #171A1C; }
.crop-header p { margin: 4px 0 0; font-size: 13px; color: #4A5459; }
.crop-ratio { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: #F5DCD8; color: #7A2219; font-size: 12px; font-weight: 600; white-space: nowrap; }
.crop-close { width: 36px; height: 36px; border: 0; background: transparent; border-radius: 8px; color: #4A5459; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.crop-close:hover { background: #F8F9FA; color: #171A1C; }

.crop-warning { display: flex; align-items: flex-start; gap: 12px; padding: 12px 24px; font-size: 13px; line-height: 1.45; border-bottom: 1px solid transparent; }
.crop-warning.hidden { display: none; }
.crop-warning strong { display: block; font-weight: 600; margin-bottom: 2px; }
.crop-warning svg { flex-shrink: 0; margin-top: 1px; }
.crop-warn-0 { background: #F8F9FA; border-color: #E2E8F0; color: #171A1C; }
.crop-warn-1 { background: #F8F9FA; border-color: #E2E8F0; color: #171A1C; }
.crop-warn-2 { background: #FEF3C7; border-color: #FDE68A; color: #92400E; }
.crop-warn-3 { background: #FDECEA; border-color: #F5C2BA; color: #7A2219; }

.crop-body { display: flex; min-height: 0; flex: 1; }
.crop-stage { flex: 1; min-width: 0; background: #171A1C; position: relative; display: flex; align-items: center; justify-content: center; }
.crop-stage img { display: block; max-width: 100%; max-height: 60vh; }
.crop-stage .cropper-view-box { outline: 2px solid #FBD210; }
.crop-stage .cropper-line, .crop-stage .cropper-point { background-color: #FBD210; }
.crop-stage .cropper-modal { background-color: #171A1C; opacity: .7; }

.crop-fill { width: 320px; flex-shrink: 0; border-left: 1px solid #E2E8F0; padding: 16px 20px; display: flex; flex-direction: column; gap: 16px; overflow: auto; }
.crop-fill.hidden { display: none; }
.crop-fill h3 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .05em; color: #4A5459; text-transform: uppercase; }
.crop-fill p { margin: 0; font-size: 12px; color: #4A5459; }
.crop-fill-intro { font-size: 13px !important; color: #171A1C !important; }
.crop-swatches { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.crop-swatch { width: 100%; aspect-ratio: 1; border-radius: 8px; border: 0; cursor: pointer; box-shadow: 0 0 0 1px rgba(0,0,0,.12); padding: 0; }
.crop-swatch-selected { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #922B21; }
.crop-custom { display: flex; align-items: center; gap: 10px; }
.crop-custom input[type=color] { width: 44px; height: 36px; padding: 0; border: 1px solid #CBD5E0; border-radius: 8px; background: #fff; cursor: pointer; }
.crop-custom input[type=text] { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid #CBD5E0; border-radius: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.crop-preview { width: 100%; aspect-ratio: 16 / 9; border: 1px solid #CBD5E0; border-radius: 4px; background: #171A1C; display: block; }
.crop-fill-label { font-size: 12px; color: #4A5459; }

.crop-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; border-top: 1px solid #E2E8F0; flex-wrap: wrap; }
.crop-zoom { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 240px; font-size: 12px; color: #4A5459; }
.crop-zoom input[type=range] { flex: 1; max-width: 280px; accent-color: #922B21; }
.crop-zoom output { width: 44px; }
.crop-actions { display: flex; gap: 8px; }

.crop-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; background: #F8F9FA; border-top: 1px solid #E2E8F0; flex-wrap: wrap; }
.crop-footer-note { font-size: 12px; color: #4A5459; }
.crop-footer .crop-actions { margin-left: auto; }

.crop-result { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 10px 12px; border: 1px solid #E2E8F0; border-radius: 8px; background: #F8F9FA; }
.crop-result.hidden { display: none; }
.crop-result-thumb { position: relative; padding: 0; border: 0; background: transparent; cursor: pointer; border-radius: 4px; flex-shrink: 0; }
.crop-result-thumb img { width: 128px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; border: 1px solid #CBD5E0; background: #171A1C; display: block; }
.crop-result-thumb span { position: absolute; inset: auto 4px 4px auto; padding: 2px 6px; border-radius: 4px; background: rgba(23,26,28,.75); color: #fff; font-size: 11px; font-weight: 600; opacity: 0; transition: opacity .15s; }
.crop-result-thumb:hover span, .crop-result-thumb:focus-visible span { opacity: 1; }
.crop-result-thumb:hover img { outline: 2px solid #922B21; }
.crop-result p a { color: #922B21; font-weight: 600; font-size: 12px; }
.crop-result p { margin: 0; font-size: 12px; color: #4A5459; }
.crop-result strong { display: block; font-size: 13px; color: #171A1C; }

@media (max-width: 860px) {
  .crop-body { flex-direction: column; }
  .crop-fill { width: auto; border-left: 0; border-top: 1px solid #E2E8F0; }
  .crop-stage img { max-height: 42vh; }
}
