/* ─────────────────────────────────────────────────────────────
   WooCommerce Virtual Try-On AI – Frontend Styles v2.0
   ───────────────────────────────────────────────────────────── */

/* ── Utility ──────────────────────────────────────────────── */
.wvf-hidden {
  display: none !important;
}

/* ── Try-On Button ────────────────────────────────────────── */
.wvf-tryon-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.wvf-tryon-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}
.wvf-tryon-btn:active {
  transform: translateY(0);
}
.wvf-tryon-btn:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* ── Overlay (with animation) ─────────────────────────────── */
#wvf-overlay {
  position: fixed;
  inset: 0;
  z-index: 999998;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
#wvf-overlay.wvf-fade-in {
  opacity: 1;
}
#wvf-overlay.wvf-fade-out {
  opacity: 0;
}

/* ── Modal (with animation) ───────────────────────────────── */
#wvf-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 999999;
  width: 94vw;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
  /* Animation defaults */
  transform: translate(-50%, -50%) scale(0.92);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}
#wvf-modal.wvf-slide-in {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}
#wvf-modal.wvf-slide-out {
  transform: translate(-50%, -50%) scale(0.92);
  opacity: 0;
}

body.wvf-modal-open {
  overflow: hidden;
}

/* ── Modal Header ─────────────────────────────────────────── */
.wvf-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 4px;
}

.wvf-modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
}

#wvf-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #94a3b8;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
#wvf-close-btn:hover {
  color: #334155;
  background: #f1f5f9;
}
#wvf-close-btn:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* ── Progress Steps ───────────────────────────────────────── */
.wvf-progress-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 12px 24px 8px;
}
.wvf-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 60px;
}
.wvf-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid #cbd5e1;
  color: #94a3b8;
  background: #fff;
  transition: all 0.2s;
}
.wvf-step-active .wvf-step-num {
  border-color: #6366f1;
  background: #6366f1;
  color: #fff;
}
.wvf-step-done .wvf-step-num {
  border-color: #22c55e;
  background: #22c55e;
  color: #fff;
}
.wvf-step-label {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}
.wvf-step-active .wvf-step-label {
  color: #6366f1;
  font-weight: 600;
}
.wvf-step-done .wvf-step-label {
  color: #22c55e;
}
.wvf-step-line {
  flex: 1;
  height: 2px;
  background: #e2e8f0;
  min-width: 30px;
  margin: 0 4px;
  margin-bottom: 18px;
  transition: background 0.2s;
}
.wvf-step-line.wvf-step-done {
  background: #22c55e;
}

/* ── Modal Body ───────────────────────────────────────────── */
.wvf-modal-body {
  padding: 0 24px 24px;
}

/* ── Dropzone ─────────────────────────────────────────────── */
#wvf-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 32px 20px;
  cursor: pointer;
  text-align: center;
  color: #64748b;
  transition: border-color 0.15s, background 0.15s;
}
#wvf-dropzone:hover,
#wvf-dropzone.wvf-dragover {
  border-color: #6366f1;
  background: #f8fafc;
}
#wvf-dropzone .wvf-drop-icon {
  font-size: 40px;
  line-height: 1;
}
#wvf-dropzone .wvf-drop-text {
  font-size: 14px;
}
#wvf-dropzone .wvf-drop-hint {
  font-size: 12px;
  color: #94a3b8;
}

/* ── Camera Button ────────────────────────────────────────── */
.wvf-camera-row {
  text-align: center;
  margin: 10px 0 4px;
}
#wvf-camera-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  color: #6366f1;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
#wvf-camera-btn:hover {
  background: #e0e7ff;
}

/* ── Preview ──────────────────────────────────────────────── */
#wvf-preview {
  text-align: center;
}
#wvf-preview-img {
  max-width: 100%;
  max-height: 240px;
  border-radius: 10px;
  object-fit: contain;
  margin-bottom: 8px;
  border: 1px solid #e2e8f0;
}
#wvf-change-photo {
  display: inline-block;
  font-size: 13px;
  color: #6366f1;
  cursor: pointer;
  text-decoration: underline;
  background: none;
  border: none;
  margin-bottom: 12px;
}

/* ── GDPR Consent ─────────────────────────────────────────── */
.wvf-gdpr {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0;
  font-size: 13px;
  color: #475569;
  line-height: 1.45;
}
.wvf-gdpr input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: #6366f1;
}

/* ── Generate Button ──────────────────────────────────────── */
#wvf-generate-btn {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
#wvf-generate-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
#wvf-generate-btn:not(:disabled):hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
#wvf-generate-btn:not(:disabled):active {
  transform: translateY(0);
}
#wvf-generate-btn:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* ── Status / Spinner ─────────────────────────────────────── */
#wvf-status {
  text-align: center;
  padding: 16px 0;
  font-size: 14px;
  color: #475569;
}

.wvf-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #e2e8f0;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: wvf-spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes wvf-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Error ────────────────────────────────────────────────── */
#wvf-error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin: 12px 0;
  animation: wvf-shake 0.35s ease;
}

@keyframes wvf-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

/* ── Remaining Counter ────────────────────────────────────── */
#wvf-remaining {
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  margin-top: 8px;
}

/* ── Result Step ──────────────────────────────────────────── */
#wvf-step-result {
  text-align: center;
}
#wvf-result-img {
  max-width: 100%;
  max-height: 480px;
  border-radius: 10px;
  object-fit: contain;
  object-position: top center;
  margin-bottom: 12px;
  border: 1px solid #e2e8f0;
  animation: wvf-fadeIn 0.4s ease;
}

@keyframes wvf-fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.wvf-result-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.wvf-result-actions a,
.wvf-result-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  border: none;
}
.wvf-result-actions a:hover,
.wvf-result-actions button:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

#wvf-download-btn {
  background: #22c55e;
  color: #fff;
}
#wvf-compare-toggle {
  background: #eef2ff;
  color: #6366f1;
  border: 1px solid #c7d2fe;
}
#wvf-retry-btn {
  background: #f1f5f9;
  color: #334155;
}

/* ── Before/After Comparison Slider ───────────────────────── */
.wvf-compare {
  position: relative;
  width: 100%;
  max-height: 520px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  margin-bottom: 12px;
  cursor: col-resize;
  user-select: none;
  -webkit-user-select: none;
}
.wvf-compare-before,
.wvf-compare-after {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.wvf-compare-after {
  z-index: 1;
}
.wvf-compare-before {
  z-index: 2;
  clip-path: inset(0 50% 0 0);
}
.wvf-compare img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: top center;
  display: block;
}
.wvf-compare-label {
  position: absolute;
  bottom: 10px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 3;
}
.wvf-label-before {
  left: 10px;
  background: rgba(99, 102, 241, 0.85);
}
.wvf-label-after {
  right: 10px;
  background: rgba(34, 197, 94, 0.85);
}
.wvf-compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
}
.wvf-handle-line {
  flex: 1;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 4px rgba(0,0,0,0.3);
}
.wvf-handle-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #6366f1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #6366f1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  flex-shrink: 0;
}

/* ── Share Buttons ────────────────────────────────────────── */
#wvf-share-wrap {
  margin-top: 12px;
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
}
.wvf-share-title {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  text-align: center;
  margin: 0 0 8px;
}
.wvf-share-buttons {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
.wvf-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  color: #fff;
  transition: opacity 0.15s;
}
.wvf-share-btn:hover {
  opacity: 0.8;
}
.wvf-share-fb  { background: #1877f2; color: #fff; }
.wvf-share-tw  { background: #000; color: #fff; }
.wvf-share-wa  { background: #25d366; color: #fff; }
.wvf-share-pin { background: #e60023; color: #fff; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
  #wvf-modal {
    width: 98vw;
    max-width: none;
    border-radius: 12px;
    max-height: 95vh;
  }
  .wvf-modal-body {
    padding: 0 16px 20px;
  }
  .wvf-modal-header {
    padding: 16px 16px 4px;
  }
  .wvf-progress-steps {
    padding: 8px 16px 4px;
  }
  .wvf-step { min-width: 50px; }
  .wvf-step-label { font-size: 10px; }
  #wvf-preview-img {
    max-height: 180px;
  }
  #wvf-result-img {
    max-height: 360px;
  }
  .wvf-result-actions {
    flex-direction: column;
  }
  .wvf-result-actions a,
  .wvf-result-actions button {
    width: 100%;
    justify-content: center;
  }
  .wvf-share-buttons {
    gap: 4px;
  }
  .wvf-share-btn {
    flex: 1;
    justify-content: center;
    min-width: 0;
    padding: 6px 8px;
    font-size: 11px;
  }
  .wvf-compare {
    max-height: 400px;
  }
}
