/* =========================================================
   Optional bike-photo upload
   - the modal that opens after a quote is submitted
   - the phone page reached from that modal's QR code
   Both share .photo-uploader (resources/views/partials/photo-uploader.blade.php).
   ========================================================= */

[x-cloak] { display: none !important; }

/* Stop the page behind the modal scrolling - toggled by js/photo-upload.js. */
body.has-photo-modal { overflow: hidden; }

/* ---------- Modal shell ---------- */
.photo-modal {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  /* Let the success animation and confetti land first. */
  animation: photo-modal-in 0.4s var(--ease-out-soft) 0.55s both;
}

@keyframes photo-modal-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.photo-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(var(--color-secondary-rgb), 0.62);
  backdrop-filter: blur(4px);
}

.photo-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 880px;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: clamp(1.35rem, 4vw, 2.25rem);
  animation: photo-dialog-in 0.45s var(--ease-out-back) 0.55s both;
}

@keyframes photo-dialog-in {
  from { opacity: 0; transform: translateY(22px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .photo-modal,
  .photo-modal-dialog { animation-duration: 0.01s; animation-delay: 0s; }
}

.photo-modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}
.photo-modal-close:hover {
  background: var(--color-border);
  color: var(--color-secondary);
  transform: rotate(90deg);
}

.photo-modal-head { text-align: center; margin-bottom: 1.5rem; padding-right: 2rem; padding-left: 2rem; }
.photo-modal-head h3 {
  font-size: clamp(1.25rem, 3.6vw, 1.6rem);
  margin: 0.65rem 0 0.5rem;
}
.photo-modal-head p {
  color: var(--color-text-muted);
  font-size: 0.94rem;
  margin: 0 auto;
  max-width: 540px;
}

.photo-benefits {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}
.photo-benefits span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--color-primary-dark);
  background: var(--color-primary-soft);
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.8rem;
}
.photo-benefits span i { color: var(--color-accent); }

.photo-modal-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.photo-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
}
.photo-modal-foot .btn-back {
  background: none;
  border: none;
  padding: 0;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.photo-modal-foot .btn-back:hover { color: var(--color-primary); }

/* ---------- Drop zone ---------- */
.photo-dropzone {
  display: block;
  position: relative;
  cursor: pointer;
  border: 2px dashed var(--color-gray-300);
  border-radius: var(--radius-lg);
  background: var(--color-gray-50);
  padding: clamp(1.5rem, 5vw, 2.25rem) 1rem;
  text-align: center;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast);
}
.photo-dropzone:hover,
.photo-dropzone.is-dragover {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  transform: translateY(-2px);
}
.photo-dropzone.is-busy {
  pointer-events: none;
  opacity: 0.6;
}
.photo-dropzone:focus-within {
  outline: 3px solid rgba(var(--color-primary-rgb), 0.45);
  outline-offset: 2px;
}

/* Visually hidden but still focusable + clickable through the label. */
.photo-dropzone-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.photo-dropzone-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.photo-dropzone-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--color-primary);
  margin-bottom: 0.35rem;
}
.photo-dropzone-title {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--color-secondary);
  font-size: 0.98rem;
}
.photo-dropzone-hint { font-size: 0.82rem; color: var(--color-text-muted); }

.photo-camera-btn { cursor: pointer; }

.photo-full-note {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-success-soft);
  color: var(--color-success);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
}

/* ---------- Upload progress ---------- */
.upload-progress { margin-top: 1rem; }
.upload-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 0.4rem;
}
.upload-progress-value { color: var(--color-primary); font-variant-numeric: tabular-nums; }
.upload-progress-track {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  overflow: hidden;
}
.upload-progress-fill {
  height: 100%;
  width: 0;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  transition: width 0.25s var(--ease-out-soft);
}
/* Server -> image server: no measurable progress, so keep it moving instead. */
.upload-progress-fill.is-indeterminate {
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent), var(--color-primary));
  background-size: 200% 100%;
  animation: upload-shimmer 1.1s linear infinite;
}
@keyframes upload-shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

/* ---------- Saved photo grid ---------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 0.6rem;
}
.photo-thumb {
  position: relative;
  margin: 0;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  animation: pop-in 0.4s var(--ease-out-back) both;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb-badge {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-success);
  color: #fff;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.photo-count {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-success);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.photo-count .text-muted-soft { font-weight: 500; }

.photo-waiting {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.photo-waiting-dot {
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-primary);
  animation: photo-waiting-pulse 1.9s infinite;
}
@keyframes photo-waiting-pulse {
  0% { box-shadow: 0 0 0 0 rgba(var(--color-primary-rgb), 0.5); }
  70% { box-shadow: 0 0 0 12px rgba(var(--color-primary-rgb), 0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--color-primary-rgb), 0); }
}

/* ---------- QR hand-off panel (desktop only) ---------- */
.photo-modal-qr { display: none; }

@media (min-width: 992px) {
  .photo-modal-body { grid-template-columns: 1.25fr 0.85fr; align-items: start; }

  .photo-modal-qr {
    display: block;
    text-align: center;
    background: linear-gradient(160deg, var(--color-primary-soft), #fff 75%);
    border: 1px solid rgba(var(--color-primary-rgb), 0.22);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.1rem;
  }
}

.photo-qr-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--color-secondary);
  margin-bottom: 0.9rem;
}
.photo-qr-title i { color: var(--color-primary); }

.photo-qr-code {
  width: 168px;
  height: 168px;
  margin: 0 auto 0.9rem;
  padding: 8px;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-qr-code canvas,
.photo-qr-code img { width: 100%; height: 100%; display: block; }

/* Shown until the QR renders, and left in place if it can't. */
.photo-qr-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--color-text-muted);
}
.photo-qr-fallback i { font-size: 1.8rem; color: var(--color-gray-300); }
.photo-qr-code.is-rendered .photo-qr-fallback { display: none; }

.photo-qr-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}

.photo-qr-copy {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.photo-qr-copy:hover { color: var(--color-primary-dark); }
.photo-qr-copy.is-copied { color: var(--color-success); text-decoration: none; }

/* ---------- Success step nudge ---------- */
.photo-nudge {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-align: left;
  max-width: 520px;
  margin: 0 auto 1.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(var(--color-accent-rgb), 0.28);
  background: var(--color-accent-soft);
  border-radius: var(--radius-lg);
}
.photo-nudge-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--color-accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}
.photo-nudge-text { flex-grow: 1; min-width: 0; }
.photo-nudge-text strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.94rem;
  color: var(--color-secondary);
}
.photo-nudge-text span { font-size: 0.82rem; color: var(--color-text-muted); }

@media (max-width: 575.98px) {
  .photo-nudge { flex-wrap: wrap; }
  .photo-nudge .btn { width: 100%; }
}

/* ---------- Phone upload page ---------- */
.photo-page { max-width: 620px; margin: 0 auto; }

.photo-tips {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--color-border);
}
.photo-tips-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--color-secondary);
  margin-bottom: 0.5rem;
}
.photo-tips-title i { color: var(--color-warning); }
.photo-tips ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--color-text-muted);
  font-size: 0.87rem;
}
.photo-tips li { margin-bottom: 0.25rem; }

.photo-done-note {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--color-success-soft);
}
.photo-done-note i { color: var(--color-success); font-size: 1.2rem; line-height: 1.3; }
.photo-done-note strong { display: block; font-family: var(--font-heading); font-size: 0.94rem; color: var(--color-secondary); }
.photo-done-note span { font-size: 0.84rem; color: var(--color-text-muted); }
