/* ================================================
   SportHub Image Editor Modal
   ================================================ */

body.image-cropper-open {
  overflow: hidden;
}

.image-cropper-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.62);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.image-cropper-panel {
  width: min(920px, 100%);
  max-height: min(92vh, 860px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 18px;
  background: var(--bg-card, #ffffff);
  background: color-mix(in srgb, var(--bg-card, #ffffff) 92%, transparent);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.35);
  color: var(--text-primary, #0f172a);
}

.image-cropper-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border, rgba(148, 163, 184, 0.28));
}

.image-cropper-heading {
  min-width: 0;
}

.image-cropper-title {
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 800;
}

.image-cropper-subtitle {
  margin-top: 4px;
  color: var(--text-muted, #64748b);
  font-size: 0.78rem;
  line-height: 1.45;
}

.image-cropper-icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid var(--border, rgba(148, 163, 184, 0.35));
  border-radius: 50%;
  background: var(--bg-elevated, #f8fafc);
  color: var(--text-secondary, #475569);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.image-cropper-workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background:
    linear-gradient(45deg, rgba(148, 163, 184, 0.14) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, 0.14) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.14) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.14) 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}

.image-cropper-loading {
  min-width: 180px;
  padding: 14px 18px;
  border-radius: var(--radius-sm, 8px);
  background: var(--bg-card, #ffffff);
  color: var(--text-muted, #64748b);
  font-size: 0.82rem;
  text-align: center;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.16);
}

.image-cropper-frame-meta {
  width: min(100%, 760px);
  padding: 6px 10px;
  border: 1px solid var(--border, rgba(148, 163, 184, 0.35));
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-card, #ffffff) 88%, transparent);
  color: var(--text-secondary, #475569);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.1);
}

.image-cropper-viewport {
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: var(--radius-sm, 8px);
  background-color: rgba(148, 163, 184, 0.16);
  background-image:
    linear-gradient(45deg, rgba(100, 116, 139, 0.2) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(100, 116, 139, 0.2) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(100, 116, 139, 0.2) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(100, 116, 139, 0.2) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.28);
  cursor: grab;
  touch-action: none;
}

.image-cropper-viewport:active {
  cursor: grabbing;
}

.image-cropper-image {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  max-height: none;
  transform-origin: 0 0;
  will-change: transform;
  opacity: 1;
  pointer-events: none;
  -webkit-user-drag: none;
}

.image-cropper-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background:
    linear-gradient(to right, transparent 33.333%, rgba(255, 255, 255, 0.42) 33.333%, rgba(255, 255, 255, 0.42) calc(33.333% + 1px), transparent calc(33.333% + 1px), transparent 66.666%, rgba(255, 255, 255, 0.42) 66.666%, rgba(255, 255, 255, 0.42) calc(66.666% + 1px), transparent calc(66.666% + 1px)),
    linear-gradient(to bottom, transparent 33.333%, rgba(255, 255, 255, 0.42) 33.333%, rgba(255, 255, 255, 0.42) calc(33.333% + 1px), transparent calc(33.333% + 1px), transparent 66.666%, rgba(255, 255, 255, 0.42) 66.666%, rgba(255, 255, 255, 0.42) calc(66.666% + 1px), transparent calc(66.666% + 1px));
}

.image-cropper-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 18px 6px;
  border-top: 1px solid var(--border, rgba(148, 163, 184, 0.28));
}

.image-cropper-tool-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.image-cropper-tool-row--secondary {
  justify-content: center;
}

.image-cropper-tool,
.image-cropper-btn {
  border: 1px solid var(--border, rgba(148, 163, 184, 0.35));
  border-radius: var(--radius-sm, 8px);
  background: var(--bg-elevated, #f8fafc);
  color: var(--text-primary, #0f172a);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease, border-color 0.12s ease;
}

.image-cropper-tool {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.image-cropper-tool--wide {
  width: auto;
  min-width: 72px;
  padding: 0 12px;
}

.image-cropper-tool:hover,
.image-cropper-btn:hover,
.image-cropper-icon-btn:hover {
  border-color: var(--primary, #2563eb);
}

.image-cropper-tool:active,
.image-cropper-btn:active,
.image-cropper-icon-btn:active {
  transform: translateY(1px);
  opacity: 0.82;
}

.image-cropper-zoom-slider {
  flex: 1;
  min-width: 0;
  height: 5px;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary, #2563eb), #22c55e);
  outline: none;
}

.image-cropper-zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--primary, #2563eb);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.38);
  cursor: pointer;
}

.image-cropper-zoom-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--primary, #2563eb);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.38);
  cursor: pointer;
}

.image-cropper-zoom-value {
  width: 52px;
  flex: 0 0 auto;
  color: var(--text-muted, #64748b);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: right;
}

.image-cropper-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px 18px;
}

.image-cropper-btn {
  min-width: 94px;
  padding: 10px 18px;
}

.image-cropper-btn:disabled {
  opacity: 0.62;
  cursor: wait;
}

.image-cropper-btn--cancel {
  background: var(--bg-elevated, #f8fafc);
  color: var(--text-secondary, #475569);
}

.image-cropper-btn--confirm {
  border-color: var(--primary, #2563eb);
  background: var(--primary, #2563eb);
  color: #fff;
}

@media (max-width: 520px) {
  .image-cropper-overlay {
    padding: 10px;
  }

  .image-cropper-panel {
    max-height: 94vh;
    border-radius: 14px;
  }

  .image-cropper-header {
    padding: 14px 14px 10px;
  }

  .image-cropper-subtitle {
    font-size: 0.74rem;
  }

  .image-cropper-workspace {
    padding: 12px;
  }

  .image-cropper-frame-meta {
    width: 100%;
    font-size: 0.68rem;
  }

  .image-cropper-controls {
    padding: 10px 14px 4px;
  }

  .image-cropper-actions {
    padding: 10px 14px 14px;
  }

  .image-cropper-btn {
    flex: 1;
    min-width: 0;
  }
}
