/* ==========================================================================
   AIRA PRESS - PASSPORT PHOTO CROPPER MODAL (3:4 ASPECT RATIO)
   Responsive, Touch-Friendly, Pure HTML5 Canvas
   ========================================================================== */

.cropper-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.cropper-modal-backdrop.active {
  display: flex;
  opacity: 1;
}

.cropper-modal-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
  width: 100%;
  max-width: 520px;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: cropperModalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cropperModalPop {
  0% {
    transform: scale(0.92);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Header */
.cropper-modal-header {
  padding: 14px 18px;
  background: linear-gradient(135deg, #1e3a8a, #1d4ed8);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cropper-modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
}

.cropper-modal-subtitle {
  font-size: 0.76rem;
  color: #bfdbfe;
  margin-top: 2px;
  font-weight: 500;
}

.cropper-modal-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
}

.cropper-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Viewport Area */
.cropper-modal-body {
  padding: 16px;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  user-select: none;
  -webkit-user-select: none;
}

.cropper-canvas-container {
  position: relative;
  width: 270px;
  height: 360px; /* Locked 3:4 aspect ratio */
  max-width: 82vw;
  max-height: 52vh;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 0 2px #38bdf8, 0 10px 25px rgba(0, 0, 0, 0.5);
  background: #000000;
  touch-action: none;
  cursor: grab;
}

.cropper-canvas-container:active {
  cursor: grabbing;
}

#cropperCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* 3:4 Viewfinder Overlay & Guide */
.cropper-viewfinder-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  border: 2px dashed rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  box-sizing: border-box;
}

/* Rule of Thirds Guide Grid */
.cropper-grid-line-h1, .cropper-grid-line-h2 {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  pointer-events: none;
}
.cropper-grid-line-h1 { top: 33.33%; }
.cropper-grid-line-h2 { top: 66.66%; }

.cropper-grid-line-v1, .cropper-grid-line-v2 {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.2);
  pointer-events: none;
}
.cropper-grid-line-v1 { left: 33.33%; }
.cropper-grid-line-v2 { left: 66.66%; }

/* Oval Face Guide (Subtle) */
.cropper-face-guide {
  position: absolute;
  top: 15%;
  left: 20%;
  width: 60%;
  height: 60%;
  border: 1px dashed rgba(56, 189, 248, 0.45);
  border-radius: 50%;
  pointer-events: none;
}

.cropper-aspect-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.75);
  color: #38bdf8;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  pointer-events: none;
  letter-spacing: 0.5px;
}

.cropper-hint-text {
  color: #94a3b8;
  font-size: 0.75rem;
  margin-top: 8px;
  text-align: center;
  line-height: 1.3;
}

/* Controls Bar */
.cropper-controls-panel {
  width: 100%;
  padding: 12px 18px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cropper-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cropper-slider-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
  min-width: 48px;
}

.cropper-zoom-btn {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #334155;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.cropper-zoom-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.cropper-zoom-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  accent-color: #2563eb;
  cursor: pointer;
}

.cropper-tools-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.cropper-tool-btn {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.cropper-tool-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

/* Action Buttons Footer */
.cropper-modal-footer {
  padding: 12px 18px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cropper-footer-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cropper-btn-crop {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #ffffff;
  border: none;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
  transition: all 0.2s;
  justify-content: center;
  white-space: nowrap;
}

.cropper-btn-crop:hover {
  background: linear-gradient(135deg, #15803d, #166534);
  transform: translateY(-1px);
}

.cropper-btn-skip {
  background: #eff6ff;
  color: #1e40af;
  border: 1.5px solid #bfdbfe;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.cropper-btn-skip:hover {
  background: #dbeafe;
}

.cropper-btn-cancel {
  background: #ffffff;
  color: #64748b;
  border: 1.5px solid #cbd5e1;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.cropper-btn-cancel:hover {
  background: #f1f5f9;
  color: #334155;
}

/* Secondary "Re-crop / Adjust" mini button on forms */
.btn-recrop-photo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 5px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  cursor: pointer;
  margin-top: 6px;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.15s;
}

.btn-recrop-photo:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

@media (max-width: 600px) {
  .cropper-modal-card {
    max-height: 98vh;
    border-radius: 12px;
  }
  .cropper-canvas-container {
    width: 225px;
    height: 300px;
  }
  .cropper-modal-footer {
    flex-direction: column;
    gap: 8px;
    padding: 10px 14px;
  }
  .cropper-btn-crop {
    width: 100%;
    order: 1;
    font-size: 0.92rem;
  }
  .cropper-footer-secondary {
    width: 100%;
    order: 2;
    display: flex;
    gap: 8px;
  }
  .cropper-btn-skip, .cropper-btn-cancel {
    flex: 1;
    text-align: center;
    justify-content: center;
  }
}
