/* =========================================================================
   Modal + toast + image crop
   ========================================================================= */

.modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 1000; }
.modal-root .modal-backdrop { pointer-events: auto; }

.modal-backdrop {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(3, 7, 18, .55);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .2s ease;
}
.modal-backdrop.is-in  { opacity: 1; }
.modal-backdrop.is-out { opacity: 0; }

.modal-dialog {
  width: 100%;
  max-width: 460px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 30px 80px -20px rgba(2,6,23,.5);
  padding: 22px 22px 18px;
  transform: translateY(8px) scale(.98);
  transition: transform .22s ease;
}
.modal-backdrop.is-in .modal-dialog { transform: translateY(0) scale(1); }

.modal-head {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px; align-items: center;
  margin-bottom: 14px;
}
.modal-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #dbeafe, #cffafe);
  color: #1d4ed8;
  flex: none;
}
.modal-icon::before { content: ""; width: 22px; height: 22px; border-radius: 999px; box-shadow: inset 0 0 0 3px currentColor; }
.modal-success .modal-icon { background: linear-gradient(135deg, #dcfce7, #ccfbf1); color: #047857; }
.modal-success .modal-icon::before { content: ""; width: 20px; height: 10px; border: solid currentColor; border-width: 0 0 3px 3px; transform: rotate(-45deg) translateY(-3px); border-radius: 0; box-shadow: none; }
.modal-error .modal-icon { background: linear-gradient(135deg, #ffe4e6, #fecaca); color: #be123c; }
.modal-error .modal-icon::before { content: "!"; width: auto; height: auto; box-shadow: none; font: 700 24px/1 'Tektur', Inter, sans-serif; color: currentColor; }
.modal-danger .modal-icon { background: linear-gradient(135deg, #ffe4e6, #fecaca); color: #be123c; }
.modal-danger .modal-icon::before { content: "?"; width: auto; height: auto; box-shadow: none; font: 700 24px/1 'Tektur', Inter, sans-serif; color: currentColor; }

.modal-title {
  margin: 0 0 4px;
  font: 700 17px 'Tektur', Inter, sans-serif;
  color: #0b1220;
  letter-spacing: -.01em;
}
.modal-body {
  margin: 0;
  color: #475569;
  font-size: 14px;
  line-height: 1.55;
}

.modal-extra { margin: 4px 0 16px; }

.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px solid #eef2f7;
  margin-top: 14px;
  padding-top: 14px;
}
.modal-btn { min-width: 120px; min-height: 40px; padding: 10px 16px; }

.btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px;
  background: linear-gradient(135deg, #e11d48, #be123c);
  color: #fff; font-weight: 700; font-size: 13px;
  box-shadow: 0 10px 24px -10px rgba(225,29,72,.55);
  cursor: pointer; text-decoration: none;
  transition: transform .15s, filter .15s, box-shadow .15s;
}
.btn-danger:hover { transform: translateY(-1px); filter: brightness(1.05); box-shadow: 0 14px 30px -10px rgba(225,29,72,.7); }

/* ── Toasts (bottom-right) ────────────────────────── */
.modal-toasts {
  position: fixed; right: 18px; bottom: 18px;
  display: grid; gap: 10px;
  z-index: 1100; pointer-events: none;
}
.modal-toast {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px; align-items: center;
  padding: 12px 16px;
  background: #0b1220; color: #f1f5f9;
  border-radius: 12px;
  box-shadow: 0 22px 50px -20px rgba(2,6,23,.7);
  min-width: 240px; max-width: 360px;
  font-size: 13.5px; font-weight: 600;
  transform: translateY(10px); opacity: 0;
  transition: transform .22s, opacity .22s;
  pointer-events: auto;
}
.modal-toast.is-in { transform: translateY(0); opacity: 1; }
.modal-toast.is-out { transform: translateY(10px); opacity: 0; }
.modal-toast .mt-icon {
  width: 28px; height: 28px;
  border-radius: 999px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.08);
}
.modal-toast-success { background: linear-gradient(135deg, #047857, #0e7490); }
.modal-toast-error   { background: linear-gradient(135deg, #be123c, #9f1239); }
.modal-toast-info    { background: linear-gradient(135deg, #1d4ed8, #0e7490); }

@media (max-width: 540px) {
  .modal-toasts { left: 12px; right: 12px; bottom: 12px; }
  .modal-toast { min-width: 0; max-width: none; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .modal-btn { width: 100%; }
}

/* ── Image cropper ──────────────────────────────────── */
.crop-wrap { display: grid; gap: 14px; }
.crop-stage {
  position: relative;
  width: 100%; max-width: 360px; aspect-ratio: 1 / 1;
  margin: 0 auto;
  background: #0b1220;
  border-radius: 16px;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}
.crop-stage canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}
.crop-mask {
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, transparent 49.5%, rgba(11,18,32,.55) 50%);
}
.crop-controls {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  gap: 10px; align-items: center;
}
.crop-controls input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #06b6d4);
  cursor: pointer;
}
.crop-controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 999px; background: #fff;
  box-shadow: 0 6px 16px -4px rgba(15,23,42,.4), inset 0 0 0 2px #1d4ed8;
}
.crop-controls input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 999px; background: #fff; border: 2px solid #1d4ed8;
}
.crop-zoom {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid #e2e8f0; background: #f8fafc; color: #1e293b;
  font: 700 20px/1 'Tektur', Inter, sans-serif;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.crop-zoom:hover { background: #fff; border-color: #cbd5e1; }
.crop-hint { margin: 0; color: #64748b; font-size: 12.5px; text-align: center; }
