/* Above student edit modal (2147482300) and hover cards (2147482400) when ProfileLayerStack is absent */
.sls-smart-photo-modal {
  display: none !important;
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  z-index: 2147483647 !important;
  overflow: hidden !important;
  box-sizing: border-box;
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.72);
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
}

.sls-smart-photo-modal.sls-smart-photo-modal--open {
  display: flex !important;
}

.sls-smart-photo-modal.hidden {
  display: none !important;
}

.sls-smart-photo-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: #ffffff;
  z-index: 0;
  pointer-events: none;
}

.sls-smart-photo-modal.sls-smart-photo-immersive.sls-smart-photo-modal--open .sls-smart-photo-scrim {
  display: block;
}

.sls-smart-photo-panel {
  isolation: isolate;
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 64rem;
  margin: auto;
  max-height: min(100dvh - 1rem, 920px);
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  box-shadow: 0 25px 50px rgba(15, 23, 42, 0.28);
}

.sls-smart-photo-crop-host {
  min-height: 140px;
  max-height: min(34vh, 280px);
  max-height: min(34dvh, 280px);
  position: relative;
  overflow: hidden;
}

.sls-smart-photo-crop-host .cropper-container,
.sls-smart-photo-crop-host .cropper-wrap-box,
.sls-smart-photo-crop-host .cropper-canvas {
  max-height: min(34vh, 280px);
  max-height: min(34dvh, 280px);
}

.sls-smart-photo-hint {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sls-smart-photo-foot {
  padding-bottom: max(0.65rem, env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -6px 16px rgba(15, 23, 42, 0.06);
  position: relative;
  z-index: 2;
}

@media (min-width: 640px) {
  .sls-smart-photo-crop-host {
    min-height: 220px;
    max-height: min(52vh, 480px);
  }

  .sls-smart-photo-crop-host .cropper-container,
  .sls-smart-photo-crop-host .cropper-wrap-box,
  .sls-smart-photo-crop-host .cropper-canvas {
    max-height: min(52vh, 480px);
  }

  .sls-smart-photo-hint {
    display: block;
    -webkit-line-clamp: unset;
  }

  .sls-smart-photo-foot {
    box-shadow: none;
    padding-bottom: 0.75rem;
  }
}

/* Phone: compact preview so Cancel / Use this photo stay on screen */
@media (max-width: 639px) {
  .sls-smart-photo-preview-aside {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
  }

  .sls-smart-photo-preview-label {
    flex: 1 1 auto;
    margin-bottom: 0;
  }

  .sls-smart-photo-preview-scroll {
    flex: 0 0 auto;
    overflow: visible;
  }

  .sls-smart-photo-preview-student .sls-student-photo-preview-wrap {
    width: 72px;
    max-width: 72px;
    height: auto;
    aspect-ratio: 3 / 4;
    margin-inline: 0;
    border-radius: 10px;
    padding: 0;
  }

  .sls-smart-photo-preview-student .sls-student-photo-preview-img {
    position: static;
    inset: auto;
    width: 100%;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
  }

  .sls-smart-photo-circle-wrap {
    width: 72px;
    max-width: 72px;
  }

  .sls-smart-photo-preview-circle {
    padding: 0;
  }

  .sls-smart-photo-preview-cover-wrap {
    height: 2.75rem;
  }

  .sls-smart-photo-preview-avatar-wrap {
    width: 2.75rem;
    height: 2.75rem;
  }

  .sls-smart-photo-preview-identity {
    margin-top: -0.85rem;
    padding-bottom: 0.5rem !important;
  }

  .sls-smart-photo-preview-name,
  .sls-smart-photo-preview-handle {
    display: none;
  }
}

.sls-smart-photo-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.25rem;
  padding: 0.35rem 0.65rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sls-smart-photo-tool:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

.sls-smart-photo-tool i {
  font-size: 0.85rem;
}

.sls-smart-photo-tool--icon {
  min-width: 2.25rem;
  padding-inline: 0.5rem;
}

.sls-smart-photo-zoom-bar {
  padding: 0.15rem 0.1rem;
}

.sls-smart-photo-zoom-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 9999px;
  background: linear-gradient(90deg, #cbd5e1 0%, #0d9488 100%);
  outline: none;
  cursor: pointer;
}

.sls-smart-photo-zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #0f766e;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.35);
  cursor: grab;
}

.sls-smart-photo-zoom-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #0f766e;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.35);
  cursor: grab;
}

html[data-theme="dark"] .sls-smart-photo-zoom-slider {
  background: linear-gradient(90deg, #475569 0%, #14b8a6 100%);
}

.sls-smart-photo-preview-aside {
  display: flex;
  flex-direction: column;
}

.sls-smart-photo-preview-label {
  margin-bottom: 0.5rem;
}

.sls-smart-photo-preview-scroll {
  flex: 1 1 auto;
}

.sls-smart-photo-preview-cover-wrap {
  height: 5.5rem;
  background: linear-gradient(135deg, #0f172a 0%, #115e59 55%, #1e3a8a 100%);
}

.sls-smart-photo-preview-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  display: block;
  transform: scale(1.06);
  transform-origin: center center;
}

.sls-smart-photo-preview-cover.is-placeholder {
  opacity: 0;
}

.sls-smart-photo-preview-cover-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.06) 0%, rgba(15, 23, 42, 0.35) 72%, rgba(255, 255, 255, 0.98) 100%);
}

.sls-smart-photo-preview-identity {
  position: relative;
  margin-top: -1.65rem;
}

.sls-smart-photo-preview-avatar-wrap {
  width: 4.25rem;
  height: 4.25rem;
  border-radius: 9999px;
  border: 3px solid #fff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
  overflow: hidden;
  background: #f1f5f9;
}

.sls-smart-photo-preview-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sls-smart-photo-preview-student .sls-student-photo-preview-wrap {
  width: min(100%, 220px);
  height: auto;
  aspect-ratio: 3 / 4;
  margin-inline: auto;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  background: #f1f5f9;
  padding: 0;
}

.sls-smart-photo-preview-student .sls-student-photo-preview-img {
  position: static;
  inset: auto;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0;
  box-shadow: none;
}

.sls-smart-photo-preview-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0 16px;
}

.sls-smart-photo-preview-circle.hidden,
.sls-smart-photo-preview-profile.hidden,
.sls-smart-photo-preview-student.hidden {
  display: none !important;
}

.sls-smart-photo-mode-student #slsSmartPhotoPreviewCircle {
  display: none !important;
}

.sls-smart-photo-circle-wrap {
  width: min(100%, 200px);
  aspect-ratio: 1;
  border-radius: 9999px;
  overflow: hidden;
  border: 4px solid #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  background: #f1f5f9;
}

.sls-smart-photo-circle-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

html[data-theme="dark"] .sls-smart-photo-panel {
  background: var(--sls-dark-surface, #111827) !important;
  border-color: var(--sls-dark-border, #334155) !important;
}

html[data-theme="dark"] .sls-smart-photo-head,
html[data-theme="dark"] .sls-smart-photo-foot,
html[data-theme="dark"] .sls-smart-photo-preview-aside {
  background: var(--sls-dark-surface-raised, #1e293b) !important;
  border-color: var(--sls-dark-border, #334155) !important;
}

html[data-theme="dark"] .sls-smart-photo-head h3,
html[data-theme="dark"] .sls-smart-photo-preview-name {
  color: #f1f5f9 !important;
}

html[data-theme="dark"] .sls-smart-photo-tool {
  background: var(--sls-dark-surface, #111827);
  border-color: var(--sls-dark-border, #334155);
  color: #e2e8f0;
}

.sls-smart-photo-tool--enhance.is-active {
  background: #ecfdf5;
  border-color: #14b8a6;
  color: #0f766e;
}

html[data-theme="dark"] .sls-smart-photo-tool--enhance.is-active {
  background: rgba(20, 184, 166, 0.15);
  border-color: #14b8a6;
  color: #5eead4;
}

html[data-theme="dark"] .sls-smart-photo-preview-card {
  background: var(--sls-dark-surface, #111827) !important;
  border-color: var(--sls-dark-border, #334155) !important;
}

html[data-theme="dark"] .sls-smart-photo-preview-avatar-wrap {
  border-color: var(--sls-dark-surface-raised, #1e293b);
}

/* One-step upload: smart crop runs automatically — no manual editor for end users */
.sls-smart-photo-modal.sls-smart-photo-auto .sls-smart-photo-body,
.sls-smart-photo-modal.sls-smart-photo-auto .sls-smart-photo-foot {
  display: none !important;
}

.sls-smart-photo-modal.sls-smart-photo-auto .sls-smart-photo-panel {
  max-width: 22rem;
}

.sls-smart-photo-modal.sls-smart-photo-auto .sls-smart-photo-head {
  padding-bottom: 1.25rem;
}

.sls-smart-photo-modal.sls-smart-photo-auto .sls-smart-photo-head::after {
  content: '';
  display: block;
  width: 2rem;
  height: 2rem;
  margin: 0.85rem auto 0;
  border: 3px solid #e2e8f0;
  border-top-color: #0d9488;
  border-radius: 50%;
  animation: sls-smart-photo-spin 0.7s linear infinite;
}

@keyframes sls-smart-photo-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Hide parent module (e.g. Edit Student) while the photo editor is active */
#studentModal.sls-smart-photo-host-suppressed,
.sls-student-modal.sls-smart-photo-host-suppressed {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.sls-smart-photo-editor-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
}

html.sls-smart-photo-editor-open {
  overflow: hidden !important;
  height: 100% !important;
}

body.sls-smart-photo-editor-open > .ff-zoom-wrap {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.sls-smart-photo-editor-open #studentModal:not(.hidden) {
  display: none !important;
}

/* Site uses 90% html zoom on Chromium — counter-zoom so editor fills the visual viewport */
html.dm-chromium-page-zoom #slsSmartPhotoModal.sls-smart-photo-modal--open {
  zoom: calc(1 / var(--site-zoom, 1));
}

/* Mobile student photo editor: true edge-to-edge fullscreen */
@media (max-width: 639px) {
  #slsSmartPhotoModal.sls-smart-photo-modal--open.sls-smart-photo-mode-student,
  #slsSmartPhotoModal.sls-smart-photo-modal--open.sls-smart-photo-immersive {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    background: #ffffff !important;
    padding: 0 !important;
  }

  #slsSmartPhotoModal.sls-smart-photo-modal--open.sls-smart-photo-mode-student .sls-smart-photo-panel,
  #slsSmartPhotoModal.sls-smart-photo-modal--open.sls-smart-photo-immersive .sls-smart-photo-panel {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
  }

  #slsSmartPhotoModal.sls-smart-photo-modal--open.sls-smart-photo-mode-student .sls-smart-photo-body,
  #slsSmartPhotoModal.sls-smart-photo-modal--open.sls-smart-photo-immersive .sls-smart-photo-body {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }

  #slsSmartPhotoModal.sls-smart-photo-modal--open.sls-smart-photo-mode-student .sls-smart-photo-workspace,
  #slsSmartPhotoModal.sls-smart-photo-modal--open.sls-smart-photo-immersive .sls-smart-photo-workspace {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  #slsSmartPhotoModal.sls-smart-photo-modal--open.sls-smart-photo-mode-student .sls-smart-photo-crop-host,
  #slsSmartPhotoModal.sls-smart-photo-modal--open.sls-smart-photo-immersive .sls-smart-photo-crop-host {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: hidden !important;
    position: relative !important;
  }

  #slsSmartPhotoModal.sls-smart-photo-modal--open.sls-smart-photo-mode-student .sls-smart-photo-crop-host .cropper-container,
  #slsSmartPhotoModal.sls-smart-photo-modal--open.sls-smart-photo-immersive .sls-smart-photo-crop-host .cropper-container,
  #slsSmartPhotoModal.sls-smart-photo-modal--open.sls-smart-photo-mode-student .sls-smart-photo-crop-host .cropper-wrap-box,
  #slsSmartPhotoModal.sls-smart-photo-modal--open.sls-smart-photo-immersive .sls-smart-photo-crop-host .cropper-wrap-box,
  #slsSmartPhotoModal.sls-smart-photo-modal--open.sls-smart-photo-mode-student .sls-smart-photo-crop-host .cropper-canvas,
  #slsSmartPhotoModal.sls-smart-photo-modal--open.sls-smart-photo-immersive .sls-smart-photo-crop-host .cropper-canvas {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    height: 100% !important;
  }

  #slsSmartPhotoModal.sls-smart-photo-modal--open.sls-smart-photo-mode-student .sls-smart-photo-foot,
  #slsSmartPhotoModal.sls-smart-photo-modal--open.sls-smart-photo-immersive .sls-smart-photo-foot {
    flex: 0 0 auto !important;
    margin-top: auto !important;
  }
}

.sls-smart-photo-modal.sls-smart-photo-immersive.sls-smart-photo-modal--open {
  background: #ffffff !important;
  padding: 0 !important;
}

.sls-smart-photo-modal.sls-smart-photo-immersive.sls-smart-photo-modal--open .sls-smart-photo-panel {
  width: 100% !important;
  max-width: none !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
}

.sls-smart-photo-modal.sls-smart-photo-immersive .sls-smart-photo-body {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

.sls-smart-photo-modal.sls-smart-photo-immersive .sls-smart-photo-workspace {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

.sls-smart-photo-modal.sls-smart-photo-immersive .sls-smart-photo-crop-host {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: hidden !important;
  position: relative !important;
}

.sls-smart-photo-modal.sls-smart-photo-immersive .sls-smart-photo-crop-host .cropper-container,
.sls-smart-photo-modal.sls-smart-photo-immersive .sls-smart-photo-crop-host .cropper-wrap-box,
.sls-smart-photo-modal.sls-smart-photo-immersive .sls-smart-photo-crop-host .cropper-canvas {
  max-height: none !important;
  height: 100% !important;
}

.sls-smart-photo-modal.sls-smart-photo-immersive .sls-smart-photo-foot {
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
  margin-top: auto !important;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
}

.sls-smart-photo-modal.sls-smart-photo-immersive .sls-smart-photo-head {
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
  padding-top: max(0.65rem, env(safe-area-inset-top, 0px));
}

@media (max-width: 639px) {
  .sls-smart-photo-modal.sls-smart-photo-immersive .sls-smart-photo-preview-aside {
    flex-shrink: 0;
  }

  .sls-smart-photo-modal.sls-smart-photo-immersive .sls-smart-photo-preview-student .sls-student-photo-preview-wrap {
    width: 56px;
    max-width: 56px;
    border-radius: 8px;
    aspect-ratio: 3 / 4;
  }
}

@media (min-width: 640px) {
  .sls-smart-photo-modal.sls-smart-photo-immersive {
    background: rgba(15, 23, 42, 0.97);
    padding: 1rem !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .sls-smart-photo-modal.sls-smart-photo-immersive .sls-smart-photo-panel {
    height: auto !important;
    min-height: 0 !important;
    max-height: min(100dvh - 2rem, 920px) !important;
    border-radius: 1rem !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 25px 50px rgba(15, 23, 42, 0.35) !important;
  }

  .sls-smart-photo-modal.sls-smart-photo-immersive .sls-smart-photo-crop-host {
    min-height: 220px;
    max-height: min(52vh, 480px) !important;
    flex: 0 1 auto;
  }
}

/* Touch-friendly crop handles — never override crop-box size (Cropper sets it inline) */
.sls-smart-photo-crop-host,
.sls-smart-photo-crop-host .cropper-container,
.sls-smart-photo-crop-host .cropper-wrap-box,
.sls-smart-photo-crop-host .cropper-canvas {
  overflow: hidden !important;
}

.sls-smart-photo-crop-host .cropper-crop-box,
.sls-smart-photo-crop-host .cropper-drag-box {
  max-height: none !important;
  flex: none !important;
}

.sls-smart-photo-crop-host .cropper-view-box {
  max-height: none !important;
  flex: none !important;
  outline-width: 2px;
  outline-color: rgba(51, 153, 255, 0.92);
}

.sls-smart-photo-crop-host .cropper-face {
  opacity: 0.08 !important;
  cursor: move;
}

.sls-smart-photo-crop-host .cropper-line {
  opacity: 0.45 !important;
  background-color: rgba(51, 153, 255, 0.75) !important;
}

.sls-smart-photo-crop-host .cropper-point {
  opacity: 1 !important;
  background-color: #39f !important;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(51, 153, 255, 0.65);
  width: 18px !important;
  height: 18px !important;
  margin: -9px !important;
}

@media (min-width: 640px) {
  .sls-smart-photo-crop-host .cropper-point {
    width: 12px !important;
    height: 12px !important;
    margin: -6px !important;
  }
}
