/* profile-photo.css: the crop tool, the photo viewer and the toast (profile-photo.js) */

/* ---- Crop tool ---- */
.pp-crop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: calc(64px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
  opacity: 0;
  transition: opacity 0.25s ease;
  font-family: var(--font-primary, 'Poppins', sans-serif);
  -webkit-user-select: none;
  user-select: none;
}
.pp-crop.visible { opacity: 1; }

.pp-crop-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
}
.pp-crop-title { font-size: 14px; font-weight: 600; color: #fff; letter-spacing: 0.02em; }
.pp-crop-spacer { width: 60px; }
.pp-crop-cancel {
  width: 60px;
  background: none; border: none; padding: 8px 0;
  color: rgba(255, 255, 255, 0.7);
  font: inherit; font-size: 13px; text-align: left;
  cursor: pointer;
}
.pp-crop-cancel:hover { color: #fff; }
.pp-crop-cancel:disabled { opacity: 0.4; cursor: default; }

/* Only what's inside the circle shows */
.pp-crop-circle {
  position: relative;
  width: min(300px, calc(100vw - 48px));
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #fff;
  touch-action: none;
  cursor: grab;
  flex-shrink: 0;
}
.pp-crop-circle.dragging { cursor: grabbing; }
.pp-crop-img {
  position: absolute;
  top: 0; left: 0;
  max-width: none;
  transform-origin: 0 0;
  pointer-events: none;
  -webkit-user-drag: none;
}
.pp-crop.busy .pp-crop-circle { opacity: 0.6; cursor: default; }

/* +/− only where there's a mouse; phones pinch */
.pp-crop-zoom { display: none; gap: 16px; }
@media (hover: hover) and (pointer: fine) {
  .pp-crop-zoom { display: flex; }
}
.pp-crop-zoom-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: inherit; font-size: 20px; line-height: 1;
  cursor: pointer;
}
.pp-crop-zoom-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.18); }
.pp-crop-zoom-btn:disabled { opacity: 0.3; cursor: default; }

.pp-crop-footer { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pp-crop-msg {
  min-height: 18px;
  max-width: 300px;
  text-align: center;
  color: #fca5a5;
  font-size: 13px;
  line-height: 1.4;
}
.pp-crop-apply {
  background: var(--gradient-primary, linear-gradient(135deg, #6D28D9, #14B8A6));
  color: #fff;
  border: none;
  padding: 12px 40px;
  border-radius: 999px;
  font: inherit; font-size: 12px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer;
  min-width: 160px;
}
.pp-crop-apply:disabled { opacity: 0.7; cursor: default; }

/* ---- Viewer: just the circle, big ---- */
.pp-viewer {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.2s ease;
  font-family: var(--font-primary, 'Poppins', sans-serif);
  cursor: zoom-out;
}
.pp-viewer.visible { opacity: 1; }
.pp-viewer-img {
  width: min(420px, calc(100vw - 48px), calc(100vh - 200px));
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  transform: scale(0.94);
  transition: transform 0.2s ease;
  cursor: default;
}
.pp-viewer.visible .pp-viewer-img { transform: scale(1); }
.pp-viewer-who { text-align: center; color: #fff; }
.pp-viewer-name { font-size: 17px; font-weight: 700; }
.pp-viewer-handle { font-size: 14px; color: rgba(255, 255, 255, 0.65); margin-top: 2px; }
.pp-viewer-close {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: 16px;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.pp-viewer-close:hover { background: rgba(255, 255, 255, 0.22); }

/* Profile page photo: tap to open the viewer */
.pp-viewable { cursor: zoom-in; }

/* ---- Change photo / Adjust / Cancel ---- */
.pp-options {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.2s ease;
  font-family: var(--font-primary, 'Poppins', sans-serif);
}
.pp-options.visible { opacity: 1; }
.pp-options-box {
  width: min(300px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}
.pp-options.visible .pp-options-box { transform: scale(1); }
.pp-options-title { font-size: 16px; font-weight: 700; color: #18181b; text-align: center; margin-bottom: 8px; }
.pp-options-btn {
  width: 100%;
  padding: 12px;
  border-radius: 999px;
  border: 1px solid #e4e4e7;
  background: #fff;
  color: #18181b;
  font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer;
}
.pp-options-btn:hover { background: #f4f4f5; }
.pp-options-btn.primary { background: #6D28D9; border-color: #6D28D9; color: #fff; }
.pp-options-btn.primary:hover { background: #5B21B6; }
.pp-options-btn.quiet { border-color: transparent; color: #71717a; }

/* ---- Toast ---- */
.pp-toast {
  position: fixed;
  left: 50%;
  bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 12px);
  z-index: 3100;
  max-width: min(420px, calc(100vw - 32px));
  background: #18181b;
  color: #fff;
  font-family: var(--font-primary, 'Poppins', sans-serif);
  font-size: 13px; font-weight: 600; line-height: 1.4;
  text-align: center;
  padding: 10px 18px;
  border-radius: 16px;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
.pp-toast.visible { opacity: 1; transform: translate(-50%, 0); }
