/**
 * Stuv Virtual Try-On Frontend Styles
 */

:root {
  --stuv-font-family: inherit;
  --stuv-font-serif: inherit;
  --stuv-font-sans: inherit;
  --stuv-btn-bg: var(--wp--preset--color--primary, #023047);
  --stuv-btn-fg: var(--wp--preset--color--contrast, #ffffff);
  --stuv-btn-radius: var(--wp--custom--button--border-radius, 10px);
  --stuv-primary: var(--wp--preset--color--primary, #023047);
  --stuv-surface: #ffffff;
  --stuv-border: rgba(2, 48, 71, 0.14);
  --stuv-text-muted: #678391;
}

/* Button & Triggers */
.stuv-tryon-wrapper {
  display: inline-block;
  margin: 8px 0;
}

.stuv-tryon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--stuv-font-family, inherit);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: inherit;
  border-radius: var(--stuv-btn-radius);
  background-color: var(--stuv-btn-bg);
  color: var(--stuv-btn-fg);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  text-decoration: none;
  line-height: 1.25;
}

.stuv-tryon-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.stuv-tryon-btn:active {
  transform: translateY(0);
}

.stuv-btn-icon svg {
  vertical-align: middle;
}

/* Floating Launcher */
#stuv-tryon-entry-point {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999998;
}

.stuv-entry-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 9999px;
  font-family: var(--stuv-font-family, inherit);
  background-color: var(--stuv-entry-bg, #111827);
  color: var(--stuv-entry-fg, #ffffff);
  border: 1px solid var(--stuv-entry-border, transparent);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stuv-entry-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}

/* Modals & Dialogs */
.stuv-modal,
.stuv-drawer-container {
  font-family: var(--stuv-font-family, inherit);
}

.stuv-modal button,
.stuv-modal input,
.stuv-modal textarea,
.stuv-modal select,
.stuv-drawer-container button,
.stuv-drawer-container input,
.stuv-drawer-container textarea,
.stuv-drawer-container select {
  font-family: var(--stuv-font-family, inherit);
}

.stuv-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.stuv-modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(2px);
}

.stuv-modal-panel {
  position: relative;
  background-color: var(--stuv-surface);
  border-radius: 12px;
  padding: 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  z-index: 10;
}

.stuv-modal-panel h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
}

.stuv-modal-panel p {
  color: #4b5563;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.stuv-privacy-note {
  font-size: 13px !important;
  color: var(--stuv-text-muted);
}

.stuv-privacy-note a {
  color: var(--stuv-primary);
  text-decoration: underline;
}

.stuv-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

/* Drawer UI */
.stuv-drawer-container {
  position: fixed;
  inset: 0;
  z-index: 999999;
  pointer-events: none;
}

.stuv-drawer-container.is-open {
  pointer-events: auto;
}

.stuv-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stuv-drawer-container.is-open .stuv-drawer-overlay {
  opacity: 1;
}

.stuv-drawer-sheet {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 460px;
  background: #ffffff;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.stuv-drawer-container.is-open .stuv-drawer-sheet {
  transform: translateX(0);
}

.stuv-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--stuv-border);
}

.stuv-drawer-header h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.stuv-drawer-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
}

.stuv-drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.stuv-drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--stuv-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--stuv-text-muted);
}

.stuv-btn-primary {
  background-color: var(--stuv-primary);
  color: #ffffff !important;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stuv-btn-secondary {
  background-color: #f3f4f6;
  color: #374151 !important;
  border: 1px solid #d1d5db;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   Full Result & Lead Generation Modal
   ========================================================================== */

.stuv-result-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147483600;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.stuv-result-modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.stuv-result-modal-dialog {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  max-width: 1200px;
  width: 95vw;
  max-height: min(94vh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: stuvModalFadeIn 0.2s ease-out;
}

.stuv-result-modal-dialog.no-lead {
  max-width: 960px;
}

.stuv-result-modal-dialog.no-lead .stuv-result-modal-preview {
  flex: 1;
}

@keyframes stuvModalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.stuv-result-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.stuv-result-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

.stuv-result-modal-close {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.stuv-result-modal-close:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.stuv-result-modal-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.stuv-result-modal-preview {
  flex: 1.4;
  min-width: 0;
  background: #0f1115;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

.stuv-fullscreen-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #111827;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  user-select: none;
}

.stuv-fullscreen-btn:hover {
  background: #ffffff;
  color: #000000;
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.stuv-fullscreen-btn:active {
  transform: scale(0.95);
}

.stuv-fullscreen-btn svg {
  display: block;
}

.stuv-result-modal-preview img,
.stuv-result-modal-preview video {
  max-width: 100%;
  max-height: min(75vh, 660px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  display: block;
}

/* Bottom Actions Chip Container (Shopify-style) */
.stuv-preview-bottom-actions {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 10;
  pointer-events: auto;
}

.stuv-action-chip {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.18s ease;
  user-select: none;
}

.stuv-action-chip:hover:not(:disabled) {
  background: #ffffff;
  color: #000000;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.stuv-action-chip:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Video Generation Overlay */
.stuv-video-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 15;
  padding: 20px;
}

/* Fullscreen Mode */
.stuv-result-modal-dialog.is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  z-index: 2147483647 !important;
}

.stuv-result-modal-dialog.is-fullscreen .stuv-result-modal-preview {
  flex: 1 !important;
  height: 100% !important;
  padding: 12px !important;
}

.stuv-result-modal-dialog.is-fullscreen .stuv-result-modal-preview img,
.stuv-result-modal-dialog.is-fullscreen .stuv-result-modal-preview video {
  max-height: calc(100vh - 120px) !important;
  max-width: 100% !important;
}

.stuv-result-modal-dialog.is-fullscreen .stuv-result-modal-lead {
  display: none !important;
}

.stuv-result-modal-lead {
  flex: 0.95;
  min-width: 300px;
  padding: 28px 24px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  border-left: 1px solid #f0f0f0;
}

.stuv-result-modal-lead h4 {
  margin: 0 0 6px 0;
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
}

.stuv-result-modal-lead p.stuv-lead-desc {
  margin: 0 0 20px 0;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.45;
}

.stuv-lead-form-group {
  margin-bottom: 14px;
}

.stuv-lead-form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
}

.stuv-lead-form-group input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  color: #111827;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.stuv-lead-form-group input:focus {
  border-color: var(--stuv-primary);
  box-shadow: 0 0 0 2px rgba(18, 18, 18, 0.1);
}

.stuv-lead-error {
  display: none;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 12px;
}

.stuv-result-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid #f0f0f0;
  background: #ffffff;
  flex-shrink: 0;
  font-size: 12px;
  color: #6b7280;
}

.stuv-result-modal-footer a {
  color: inherit;
  text-decoration: underline;
}

.stuv-result-modal-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

#stuv-result-download-btn {
  background-color: var(--stuv-primary) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  padding: 8px 18px !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1.4 !important;
}

#stuv-result-download-btn:hover {
  filter: brightness(1.1);
  color: #ffffff !important;
}

@media (max-width: 768px) {
  .stuv-result-modal-body {
    flex-direction: column;
  }
  .stuv-result-modal-preview {
    flex: none;
    max-height: 45vh;
  }
  .stuv-result-modal-lead {
    border-left: none;
    border-top: 1px solid #f0f0f0;
    padding: 20px 16px;
  }
}

/* ==========================================================================
   Generating Experience & Progress Bar (Shopify-matching)
   ========================================================================== */

.stuv-generating-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
}

.stuv-spinner {
  display: inline-block;
  animation: stuv-pulse 1.8s ease-in-out infinite;
}

@keyframes stuv-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.85;
  }
}

.stuv-generating-progress {
  height: 8px;
  width: 100%;
  max-width: 300px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
  margin: 0 auto 12px auto;
}

.stuv-generating-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #111827 0%, #374151 100%);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.stuv-generating-caption {
  margin: 0;
  font-size: 12px;
  color: #9ca3af;
}

.stuv-generating-lead-card {
  width: 100%;
  box-sizing: border-box;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
  text-align: left;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.stuv-generating-lead-card h4 {
  margin: 0 0 6px 0;
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
}

/* Standalone Lead Capture Modal (Before Generation Popup) */
.stuv-lead-modal-dialog {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  max-width: 440px;
  width: 90vw;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: stuvModalFadeIn 0.2s ease-out;
  padding: 0;
  position: relative;
}

.stuv-lead-modal-content {
  padding: 28px 24px 24px 24px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.stuv-lead-modal-content h4 {
  margin: 0 0 6px 0;
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
}

.stuv-lead-modal-content p.stuv-lead-desc {
  margin: 0 0 18px 0;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.45;
}


