/**
 * WpVirtualTry Frontend Styles
 * 
 * @package WpVirtualTry
 * @version 1.0.0
 * @author WpVirtualTry
 * @license GPL-2.0-or-later
 * 
 * Stylesheet for virtual try-on modal and UI elements.
 * 
 * Structure:
 * 1. CSS Variables
 * 2. Modal & Popup Base Styles
 * 3. Camera & Upload Interface
 * 4. Loading & Progress States
 * 5. Results & Before/After Slider
 * 6. Gallery Selection
 * 7. Buttons & Interactive Elements
 * 8. Animations & Transitions
 * 9. Responsive Design
 */

/* ========================================
   1. CSS Variables - Brand Customization
   ======================================== */
:root {
    --wpvirtualtry-brand: #4d4de3;                    /* Primary brand color */
    --wpvirtualtry-brand-hover: #3d3dd3;              /* Hover state color */
    --wpvirtualtry-brand-light: rgba(77, 77, 227, 0.1); /* Light background tint */
}

/* ========================================
   2. Modal & Popup Base Styles with Animations
   ======================================== */
#wpvirtualtry-popup {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    transition: visibility 0.3s, opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2147483647 !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.popup-content {
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), 
                opacity 0.3s ease-out;
}

/* This is the state when the popup is HIDDEN */
.popup-hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.popup-hidden .popup-content {
    transform: scale(0.92) translateY(-20px);
    opacity: 0;
}

/* This is the state when the popup is VISIBLE */
#wpvirtualtry-popup:not(.popup-hidden) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    animation: fadeInBackdrop 0.3s ease-out;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(0, 0, 0, 0.75) !important;
}

#wpvirtualtry-popup:not(.popup-hidden) .popup-content {
    transform: scale(1) translateY(0) !important;
    opacity: 1 !important;
    animation: popupSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Popup open animation */
@keyframes fadeInBackdrop {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes popupSlideIn {
    from {
        transform: scale(0.92) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Shimmer effect for product page button */
@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Product page "Try It On" button styling - Stronger specificity for live site */
.wpvirtualtry-button,
button.wpvirtualtry-button,
a.wpvirtualtry-button,
#wpvirtualtry-open {
    position: relative !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
}

.wpvirtualtry-button::before,
button.wpvirtualtry-button::before,
a.wpvirtualtry-button::before,
#wpvirtualtry-open::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    ) !important;
    transform: translateX(-100%) !important;
    transition: transform 0s !important;
    pointer-events: none !important;
    z-index: 1 !important;
}

.wpvirtualtry-button:hover::before,
button.wpvirtualtry-button:hover::before,
a.wpvirtualtry-button:hover::before,
#wpvirtualtry-open:hover::before {
    animation: shimmer 0.8s ease-in-out !important;
}

.wpvirtualtry-button:hover,
button.wpvirtualtry-button:hover,
a.wpvirtualtry-button:hover,
#wpvirtualtry-open:hover {
    transform: translateY(-1px) !important;
    filter: brightness(1.1) !important;
    box-shadow: 0 6px 16px -2px rgba(124, 58, 237, 0.4) !important;
}

/* Fallback styles for Tailwind classes (in case Tailwind doesn't load) */
#wpvirtualtry-popup .flex { display: flex !important; }
#wpvirtualtry-popup .inline-flex { display: inline-flex !important; }
#wpvirtualtry-popup .flex-col { flex-direction: column !important; }
#wpvirtualtry-popup .flex-row { flex-direction: row !important; }
#wpvirtualtry-popup .items-center { align-items: center !important; }
#wpvirtualtry-popup .justify-center { justify-content: center !important; }
#wpvirtualtry-popup .justify-between { justify-content: space-between !important; }
#wpvirtualtry-popup .gap-1\.5 { gap: 0.375rem !important; }
#wpvirtualtry-popup .gap-2 { gap: 0.5rem !important; }
#wpvirtualtry-popup .gap-2\.5 { gap: 0.625rem !important; }
#wpvirtualtry-popup .gap-3 { gap: 0.75rem !important; }
#wpvirtualtry-popup .gap-4 { gap: 1rem !important; }
#wpvirtualtry-popup .gap-6 { gap: 1.5rem !important; }

#wpvirtualtry-popup .hidden { display: none !important; }
#wpvirtualtry-popup .block { display: block !important; }
#wpvirtualtry-popup .relative { position: relative !important; }
#wpvirtualtry-popup .absolute { position: absolute !important; }

#wpvirtualtry-popup .w-4 { width: 1rem !important; }
#wpvirtualtry-popup .w-5 { width: 1.25rem !important; }
#wpvirtualtry-popup .w-full { width: 100% !important; }
#wpvirtualtry-popup .h-4 { height: 1rem !important; }
#wpvirtualtry-popup .h-5 { height: 1.25rem !important; }

#wpvirtualtry-popup .p-4 { padding: 1rem !important; }
#wpvirtualtry-popup .p-6 { padding: 1.5rem !important; }
#wpvirtualtry-popup .px-4 { padding-left: 1rem !important; padding-right: 1rem !important; }
#wpvirtualtry-popup .py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
#wpvirtualtry-popup .py-3 { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
#wpvirtualtry-popup .py-3\.5 { padding-top: 0.875rem !important; padding-bottom: 0.875rem !important; }
#wpvirtualtry-popup .pt-2 { padding-top: 0.5rem !important; }
#wpvirtualtry-popup .mt-4 { margin-top: 1rem !important; }
#wpvirtualtry-popup .mt-6 { margin-top: 1.5rem !important; }
#wpvirtualtry-popup .mb-1 { margin-bottom: 0.25rem !important; }
#wpvirtualtry-popup .mb-2 { margin-bottom: 0.5rem !important; }
#wpvirtualtry-popup .mb-3 { margin-bottom: 0.75rem !important; }
#wpvirtualtry-popup .mb-4 { margin-bottom: 1rem !important; }

#wpvirtualtry-popup .text-xs { font-size: 0.75rem !important; line-height: 1rem !important; }
#wpvirtualtry-popup .text-sm { font-size: 0.875rem !important; line-height: 1.25rem !important; }
#wpvirtualtry-popup .text-base { font-size: 1rem !important; line-height: 1.5rem !important; }
#wpvirtualtry-popup .text-lg { font-size: 1.125rem !important; line-height: 1.75rem !important; }
#wpvirtualtry-popup .text-xl { font-size: 1.25rem !important; line-height: 1.75rem !important; }
#wpvirtualtry-popup .font-medium { font-weight: 500 !important; }
#wpvirtualtry-popup .font-semibold { font-weight: 600 !important; }
#wpvirtualtry-popup .font-bold { font-weight: 700 !important; }
#wpvirtualtry-popup .text-center { text-align: center !important; }

#wpvirtualtry-popup .text-gray-400 { color: #9ca3af !important; }
#wpvirtualtry-popup .text-gray-500 { color: #6b7280 !important; }
#wpvirtualtry-popup .text-gray-600 { color: #4b5563 !important; }
#wpvirtualtry-popup .text-gray-700 { color: #374151 !important; }
#wpvirtualtry-popup .text-gray-800 { color: #1f2937 !important; }
#wpvirtualtry-popup .text-gray-900 { color: #111827 !important; }
#wpvirtualtry-popup .text-white { color: #ffffff !important; }

#wpvirtualtry-popup .bg-gray-50 { background-color: #f9fafb !important; }
#wpvirtualtry-popup .bg-gray-200 { background-color: #e5e7eb !important; }
#wpvirtualtry-popup .bg-white { background-color: #ffffff !important; }

#wpvirtualtry-popup .border-2 { border-width: 2px !important; }
#wpvirtualtry-popup .border-dashed { border-style: dashed !important; }
#wpvirtualtry-popup .border-gray-200 { border-color: #e5e7eb !important; }
#wpvirtualtry-popup .rounded-xl { border-radius: 0.75rem !important; }
#wpvirtualtry-popup .rounded-lg { border-radius: 0.5rem !important; }

#wpvirtualtry-popup .cursor-pointer { cursor: pointer !important; }
#wpvirtualtry-popup .transition-all { transition: all 0.3s !important; }
#wpvirtualtry-popup .transition-colors { transition: color 0.15s, background-color 0.15s !important; }
#wpvirtualtry-popup .duration-150 { transition-duration: 0.15s !important; }
#wpvirtualtry-popup .duration-300 { transition-duration: 0.3s !important; }
#wpvirtualtry-popup .shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important; }
#wpvirtualtry-popup .shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important; }

/* Progress Bar Animation */
.progress-bar-inner {
    transition: width 4s ease-in-out;
}

/* Dropzone Drag-Over State */
.dropzone.is-dragging {
    border-color: var(--wpvirtualtry-brand) !important;
    background-color: var(--wpvirtualtry-brand-light) !important;
}
.dropzone.is-dragging svg {
    transform: scale(1.1);
}

/* Before/After Slider */
.slider-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: .75rem;
    aspect-ratio: 1;
    background: #f8fafc;
}

.slider-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    transform: translateZ(0);
    will-change: auto;
}

.slider-image-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    overflow: hidden;
    transition: width .15s ease-out;
}

.slider-base {
    position: absolute;
    inset: 0;
}

.resizer {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ffffff;
    cursor: ew-resize;
    z-index: 10;
    transition: left .15s ease-out;
}

.resizer-button {
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: #ffffff;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(77,77,227,0.2);
    border: 1px solid rgba(77,77,227,0.1);
}

.resizer-button svg {
    width: 20px;
    height: 20px;
    color: #374151;
}

/* Dragging state disables transitions for precision */
/* Keep transitions active for smooth feel */

/* Loader message transitions with blur effect */
.loader-status { 
  position: relative; 
  height: 30px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  overflow: hidden;
}

.loader-message { 
  display: none !important;
  position: absolute !important; 
  top: 50% !important;
  left: 0 !important;
  right: 0 !important;
  transform: translateY(-50%) !important;
  white-space: nowrap !important;
  text-align: center !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  color: #111827 !important;
  pointer-events: none !important;
  opacity: 0 !important;
  filter: blur(0px) !important;
  transition: opacity 0.3s ease-in-out, filter 0.3s ease-in-out !important;
}

.loader-message.active {
  display: block !important;
  opacity: 1 !important;
  filter: blur(0px) !important;
}

.loader-message.exiting {
  opacity: 0 !important;
  visibility: visible !important;
  transform: translateY(calc(-50% - 10px)) !important;
  filter: blur(5px) !important;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              filter 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              visibility 0s linear 0.3s !important;
}

/* Shimmer loading bar */
.shimmer-track {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 9999px;
  background: #c7d2fe; /* indigo-200 */
  overflow: hidden;
}

.shimmer {
  position: absolute;
  top: 0;
  left: -40%;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, rgba(99,102,241,0), rgba(99,102,241,.45), rgba(99,102,241,0));
  animation: shimmer-slide 1.25s linear infinite;
}

@keyframes shimmer-slide {
  0% { left: -40%; }
  100% { left: 100%; }
}

/* Loading preview image */
.loading-image-preview {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #f9fafb;
}
.loading-preview-img {
  width: 100%;
  height: 220px;
  object-fit: contain;
  display: block;
}
.image-shimmer {
  position: absolute;
  top: 0;
  left: -40%;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.65), rgba(255,255,255,0));
  animation: shimmer-slide 1.25s linear infinite;
}

/* Single result image */
.result-image-container {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #f8fafc;
}
.result-image {
  position: relative;
  width: 100%;
  height: auto;
  display: block;
}

/* New try-on image container - Absolutely fixed size */
.tryon-image-container {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 100% !important;
  height: auto !important;
  min-height: 400px !important;
  max-height: 400px !important;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  border-radius: 16px;
  background: #eee url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" fill-opacity=".25"><rect x="200" width="200" height="200" /><rect y="200" width="200" height="200" /></svg>');
  background-size: 35px 35px;
  padding: 6px;
  position: relative;
  box-sizing: border-box !important;
  flex-shrink: 0;
  flex-grow: 0;
  box-shadow: 
    0 0 0 1px rgba(0, 0, 0, 0.04),
    0 2px 8px rgba(0, 0, 0, 0.04),
    0 4px 16px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.3s ease;
}

.tryon-image-container:hover {
  box-shadow: 
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 4px 12px rgba(0, 0, 0, 0.06),
    0 8px 24px rgba(0, 0, 0, 0.06);
}

.tryon-image-container img {
  display: block;
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  border-radius: 12px;
  transition: opacity 0.3s ease;
  opacity: 0;
  animation: fadeInImage 0.4s ease forwards;
  flex-shrink: 0;
}

@keyframes fadeInImage {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Ensure all image types respect the container */
.tryon-image-container img.portrait,
.tryon-image-container img.landscape,
.tryon-image-container img.square {
  object-fit: contain !important;
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
}

/* Loading shimmer animation for uploaded image */
.tryon-image-container.loading::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0.1) 100%
  );
  border-radius: 16px;
  z-index: 1;
}

.tryon-image-container.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.6) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmer-loading 2s infinite;
  pointer-events: none;
  z-index: 2;
}

@keyframes shimmer-loading {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Loading state image styling - subtle pulse animation without blur */
.tryon-image-container.loading img,
#wpvirtualtry-loading-preview {
  filter: brightness(0.98);
  animation: pulseRotate 3s ease-in-out infinite;
  display: block !important;
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  opacity: 1 !important;
}

@keyframes pulseRotate {
  0%, 100% {
    transform: scale(1) rotate(0deg);
    filter: brightness(0.98);
  }
  50% {
    transform: scale(1.02) rotate(0.5deg);
    filter: brightness(1);
  }
}

/* Upload button inside dropzone */
.wpvirtualtry-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--wpvirtualtry-brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(77,77,227,0.25);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}
.wpvirtualtry-upload-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(77,77,227,0.35);
}

/* Icon Toggle Styling - Button Group */
.icon-toggle-group {
    display: flex;
    gap: 0;
    justify-content: center;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(77,77,227,0.15);
    width: fit-content;
    margin: 0 auto;
}

.icon-toggle-button {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: none;
    background-color: #fff;
    transition: transform .2s ease-in-out, box-shadow .2s ease-in-out;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    border-radius: 0;
    margin: 0;
}

.icon-toggle-button:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.icon-toggle-button:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
    border-left: none;
}

.icon-toggle-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(77,77,227,0.2);
    z-index: 1;
}

.icon-toggle-button.active {
    background: var(--wpvirtualtry-brand);
    border-color: var(--wpvirtualtry-brand);
    box-shadow: none;
    z-index: 2;
}

.icon-toggle-button.active .icon-toggle-svg {
    stroke: #fff;
}

.icon-toggle-button.active .icon-toggle-label {
    color: #fff;
}

.icon-toggle-button.inactive {
    background-color: #fff;
    border-color: rgba(77,77,227,0.15);
}

.icon-toggle-button.inactive .icon-toggle-svg {
    stroke: #6B7280;
}

.icon-toggle-button.inactive .icon-toggle-label {
    color: #6B7280;
}

.icon-toggle-svg {
    width: 14px;
    height: 14px;
    transition: stroke .2s ease-in-out;
}

.icon-toggle-label {
    font-size: 11px;
    font-weight: 600;
    transition: color .2s ease-in-out;
}

/* Custom animation for scrolling blur text - with emojis */
@keyframes blur-scroll {
    0% { filter: blur(4px); transform: translateY(0); opacity: 0.5; }
    25% { filter: blur(2px); opacity: 1; }
    75% { filter: blur(2px); opacity: 1; }
    100% { filter: blur(4px); transform: translateY(-100%); opacity: 0; }
}

.blur-text-animate {
    animation: blur-scroll 2.5s infinite ease-in-out;
}
.blur-text-item {
    margin: 6px 0;
}

/* Popup Content Wrapper - Constrained Container */
#wpvirtualtry-popup-content {
  max-width: 448px !important; /* Fixed pixel width for consistency across all themes (28rem = 448px) */
  width: 100% !important;
  max-height: 95vh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

/* Scrollable content area inside popup */
#wpvirtualtry-popup-content > div[style*="overflow-y"] {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f1f5f9;
}

#wpvirtualtry-popup-content > div[style*="overflow-y"]::-webkit-scrollbar {
  width: 6px;
}

#wpvirtualtry-popup-content > div[style*="overflow-y"]::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

#wpvirtualtry-popup-content > div[style*="overflow-y"]::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

#wpvirtualtry-popup-content > div[style*="overflow-y"]::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Modal Backdrop - Legacy support */
.wpvirtualtry-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.wpvirtualtry-modal-content {
  position: relative;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow: hidden;
}

/* Close Button - Square Container */
#wpvirtualtry-close-btn {
  border: none;
  transition: all 0.2s ease;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 8px !important;
  aspect-ratio: 1 / 1 !important;
}

#wpvirtualtry-close-btn:hover {
  background: rgba(0, 0, 0, 0.05) !important;
  border: none !important;
  transform: rotate(90deg);
}

/* Main Content Area */
.wpvirtualtry-main-content {
  padding: 24px 20px;
}

/* Mode Toggle */
.wpvirtualtry-mode-toggle {
  display: flex;
  gap: 2px;
  padding: 2px;
  background-color: #f1f5f9;
  border-radius: 6px;
  margin-bottom: 20px;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

.wpvirtualtry-mode-btn {
  flex: 1;
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: 500;
  font-size: 13px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  cursor: pointer;
}

.wpvirtualtry-mode-btn.active {
  background-color: white;
  color: var(--wpvirtualtry-brand);
  box-shadow: 0 1px 3px rgba(77,77,227,0.2);
}

.wpvirtualtry-mode-btn.inactive {
  color: #64748b;
  background-color: transparent;
}

.wpvirtualtry-mode-btn.inactive:hover {
  transform: translateY(-1px);
}

/* Camera Container - Same size as try-on container */
.wpvirtualtry-camera-container {
  position: relative;
  background: #f8fafc;
  border-radius: 16px;
  overflow: hidden;
  width: 100% !important;
  height: 400px !important;
  min-height: 400px !important;
  max-height: 400px !important;
  margin-bottom: 20px;
  border: 1px solid rgba(77,77,227,0.15);
  display: flex;
  justify-content: center;
  align-items: center;
}

.wpvirtualtry-camera-video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 0.75rem; /* Match parent rounded-xl */
  display: block !important;
  background: #000;
  position: absolute;
  top: 0;
  left: 0;
}

/* Upload Area */
.wpvirtualtry-upload-area {
  border: 1px dashed rgba(77,77,227,0.25);
  border-radius: 8px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #f8fafc;
  aspect-ratio: 4/3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.wpvirtualtry-upload-area:hover {
  border-color: var(--wpvirtualtry-brand);
  background-color: var(--wpvirtualtry-brand-light);
}

.wpvirtualtry-upload-area.dragover {
  border-color: var(--wpvirtualtry-brand);
  background-color: var(--wpvirtualtry-brand-light);
}

.wpvirtualtry-upload-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  background: #e0e7ff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wpvirtualtry-upload-title {
  font-size: 16px;
  font-weight: 600;
  color: #334155;
  margin: 0 0 6px 0;
}

.wpvirtualtry-upload-desc {
  color: #64748b;
  font-size: 13px;
  margin: 0 0 4px 0;
}

.wpvirtualtry-upload-formats {
  font-size: 12px;
  color: #94a3b8;
  margin: 0;
}

/* Terms */
.wpvirtualtry-terms {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid rgba(77,77,227,0.15);
}

.wpvirtualtry-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--wpvirtualtry-brand);
  margin-top: 2px;
}

.wpvirtualtry-terms-text {
  flex: 1;
}

.wpvirtualtry-terms-label {
  color: #475569;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin: 0 0 2px 0;
  line-height: 1.4;
}

.wpvirtualtry-terms-privacy {
  font-size: 12px;
  color: #64748b;
  margin: 0;
  line-height: 1.3;
}

.wpvirtualtry-terms-link {
  color: var(--wpvirtualtry-brand);
  text-decoration: underline;
  font-weight: 500;
}

.wpvirtualtry-terms-link:hover {
  color: #6d28d9;
}

/* Primary Button */
.wpvirtualtry-btn-primary {
  padding: 12px 24px;
  background: var(--wpvirtualtry-brand);
  color: white;
  font-weight: 500;
  font-size: 14px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(77,77,227,0.25);
  transform: scale(1);
  transition: transform 0.2s, box-shadow 0.2s;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wpvirtualtry-btn-primary:hover {
  box-shadow: 0 4px 12px rgba(77,77,227,0.35);
  transform: translateY(-1px);
}

.wpvirtualtry-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: scale(1);
  background: #94a3b8;
}

/* Result Container */
.wpvirtualtry-result-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  .wpvirtualtry-result-container {
    grid-template-columns: 1fr 1fr;
  }
}

.wpvirtualtry-image-container {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #f1f5f9;
  aspect-ratio: 4/3;
  border: 1px solid rgba(77,77,227,0.15);
}

.wpvirtualtry-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}

.wpvirtualtry-image-container:hover .wpvirtualtry-image {
  transform: scale(1.02);
}

.wpvirtualtry-image-label {
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 6px;
  text-align: center;
}

/* Coupon Container */
.wpvirtualtry-coupon-container {
  background: linear-gradient(135deg, var(--wpvirtualtry-brand-light), rgba(255, 255, 255, 0.95)) !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  padding: 18px 24px !important;
  margin: 0 !important;
  gap: 0 !important;
  border-radius: 14px !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05) !important;
  transition: all 0.3s ease !important;
}

.wpvirtualtry-coupon-container:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
  transform: translateY(-1px) !important;
}

/* Coupon Header Section */
.wpvirtualtry-coupon-container .flex.items-center.gap-2.mb-1 {
  margin-bottom: 4px !important; /* Reduced gap between title and subtitle */
}

/* Coupon Icon */
.wpvirtualtry-coupon-icon {
  color: var(--wpvirtualtry-brand) !important;
  stroke: var(--wpvirtualtry-brand) !important;
  width: 16px !important;
  height: 16px !important;
}

/* Coupon Title */
.wpvirtualtry-coupon-container h5 {
  font-size: 17px !important; /* 16-18px range */
  font-weight: 700 !important; /* Bold */
  color: #1f2937 !important;
  margin: 0 !important;
  line-height: 1.2 !important;
}

/* Coupon Subtitle */
.wpvirtualtry-coupon-container p {
  font-size: 13px !important; /* 13-14px range */
  font-weight: 400 !important; /* Regular */
  color: #6b7280 !important;
  margin: 0 !important;
  line-height: 1.3 !important;
}

/* Coupon Code and Button Container */
.wpvirtualtry-coupon-container .flex.items-center.gap-3 {
  gap: 12px !important; /* Consistent spacing */
  align-items: center !important;
}

/* Coupon Code Styling */
.wpvirtualtry-coupon-code {
  background: white !important;
  border: 2px dashed var(--wpvirtualtry-brand) !important;
  color: #1f2937 !important;
  padding: 10px 16px !important;
  margin: 0 !important;
  border-radius: 10px !important;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  letter-spacing: 1px !important;
  line-height: 1 !important;
  height: auto !important;
  min-height: 38px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 0 !important;
  flex-shrink: 0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
  transition: all 0.2s ease !important;
  cursor: text !important;
  user-select: all !important;
}

.wpvirtualtry-coupon-code:hover {
  transform: scale(1.02) !important;
  box-shadow: 0 4px 12px rgba(77, 77, 227, 0.15) !important;
  border-color: var(--wpvirtualtry-brand-dark, #4f46e5) !important;
}

/* Copy Coupon Button */
.wpvirtualtry-copy-btn {
  background: var(--wpvirtualtry-brand) !important;
  color: white !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  padding: 10px 18px !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 10px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  height: auto !important;
  min-height: 38px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  min-width: 90px !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  box-shadow: 0 4px 12px rgba(77, 77, 227, 0.25) !important;
}

.wpvirtualtry-copy-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(77, 77, 227, 0.4) !important;
  background: var(--wpvirtualtry-brand-dark, #4f46e5) !important;
}

.wpvirtualtry-copy-btn:active {
  transform: translateY(0) scale(0.98) !important;
  box-shadow: 0 2px 8px rgba(77, 77, 227, 0.3) !important;
}

/* Copy button icon */
.wpvirtualtry-copy-btn svg {
  width: 14px !important;
  height: 14px !important;
  flex-shrink: 0 !important;
}

/* Generic Brand Button */
.wpvirtualtry-brand-btn {
  background: var(--wpvirtualtry-brand) !important;
  color: white !important;
  transition: transform 0.2s, box-shadow 0.2s !important;
}

.wpvirtualtry-brand-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(77,77,227,0.3) !important;
}

/* Initial State Content - Reduce spacing from header */
#wpvirtualtry-initial-state .p-6.pt-2,
#wpvirtualtry-camera-view.p-6.pt-2 {
  padding-top: 0.5rem !important; /* Reduced from pt-2 (0.5rem) to 0.5rem */
  padding-bottom: 1rem !important; /* Reduced from p-6 (1.5rem) */
}

#wpvirtualtry-initial-state > div:first-child {
  padding-top: 0.75rem !important; /* Reduce spacing of toggle buttons from header */
  padding-bottom: 0.75rem !important;
}

/* Result State - No Scrollbar */
#wpvirtualtry-result-state {
  overflow: hidden !important;
  -ms-overflow-style: none !important;  /* IE and Edge */
  scrollbar-width: none !important;  /* Firefox */
}

#wpvirtualtry-result-state::-webkit-scrollbar {
  display: none !important;  /* Chrome, Safari and Opera */
}

/* Action Buttons Container - Reduce spacing from top button */
#wpvirtualtry-result-state .flex.items-center.justify-center.gap-6.mt-4 {
  margin-top: 12px !important; /* Reduced from mt-4 (16px) */
}

/* Clean Action Buttons - Download, Share, Try Again */
#wpvirtualtry-download,
#wpvirtualtry-share,
#wpvirtualtry-try-again {
  background: transparent !important;
  border: none !important;
  color: #6b7280 !important;
  padding: 6px 4px !important;
  margin: 0 !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  transition: all 0.2s ease !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  cursor: pointer !important;
  border-radius: 0 !important;
}

#wpvirtualtry-download:hover,
#wpvirtualtry-share:hover,
#wpvirtualtry-try-again:hover {
  color: var(--wpvirtualtry-brand) !important;
  transform: translateY(-1px) !important;
}

#wpvirtualtry-download svg,
#wpvirtualtry-share svg,
#wpvirtualtry-try-again svg {
  width: 14px !important;
  height: 14px !important;
  transition: color 0.2s ease !important;
}

/* Add to Cart Button */
.wpvirtualtry-add-to-cart-btn {
  width: 100%;
  background: var(--wpvirtualtry-brand) !important;
  color: white !important;
  font-weight: 500;
  font-size: 15px;
  padding: 14px 20px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(77,77,227,0.25);
  transform: scale(1);
  transition: transform 0.2s, box-shadow 0.2s !important;
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.wpvirtualtry-add-to-cart-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(77,77,227,0.3) !important;
  color: white !important;
}

.wpvirtualtry-add-to-cart-btn span {
  color: white !important;
}


/* Trust Message */
.wpvirtualtry-trust-message {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
  background-color: #f1f5f9;
  border-radius: 20px;
  padding: 6px 12px;
  margin-top: 16px;
}


/* Loading States */
.wpvirtualtry-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #64748b;
}

.wpvirtualtry-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #e2e8f0;
  border-top: 2px solid var(--wpvirtualtry-brand);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Try It On Button */
.wpvirtualtry-wrapper {
  margin: 15px 0;
}

.wpvirtualtry-button {
  background: var(--wpvirtualtry-brand);
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
  box-shadow: 0 4px 12px rgba(77,77,227,0.3);
  position: relative;
  overflow: hidden;
}

.wpvirtualtry-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(77,77,227,0.4);
}

.wpvirtualtry-button:active {
  transform: translateY(0);
}

.wpvirtualtry-arrow {
  transition: transform 0.2s;
}

.wpvirtualtry-button:hover .wpvirtualtry-arrow {
  transform: translateX(2px);
}

/* Camera Enable Container - Copies dropzone CSS styling only */
#wpvirtualtry-upload-view,
#wpvirtualtry-camera-view {
  /* Ensure both views are centered */
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.dropzone,
.wpvirtualtry-camera-enable-container {
  /* Both containers should have identical sizing */
  height: 300px;
  min-height: 300px;
  max-height: 300px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.wpvirtualtry-camera-enable-container {
  /* Layout */
  position: relative !important; /* Essential for video wrapper positioning */
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  padding: 2rem !important;
  text-align: center !important;
  
  /* Behavior - NOT clickable (buttons inside are clickable) */
  cursor: default;
}

.wpvirtualtry-camera-enable-container > * {
  flex-shrink: 0; /* Prevent content from shrinking */
}

.wpvirtualtry-camera-enable-container * {
  pointer-events: auto; /* Child elements (buttons, video) are interactive */
}

/* Video wrapper inside camera enable container */
#wpvirtualtry-video-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 0.75rem; /* Match parent rounded-xl */
  overflow: hidden;
  background: #000;
  z-index: 10;
}

/* Give Permission Button - Now uses same styling as upload button via wpvirtualtry-upload-btn class */

/* Capture Photo Button */
.wpvirtualtry-capture-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--wpvirtualtry-brand);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(77,77,227,0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wpvirtualtry-capture-btn:hover {
  /* Don't change background on hover - keep same brand color */
  background: var(--wpvirtualtry-brand);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(77,77,227,0.4);
}

.wpvirtualtry-capture-btn:active {
  transform: translateY(0);
}

.wpvirtualtry-capture-btn svg {
  flex-shrink: 0;
}

/* Switch Camera Button - Overlay on Video (Mobile Only) */
#wpvirtualtry-switch-camera {
  display: none !important;
}

/* Show switch camera button only on mobile/tablet devices */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  #wpvirtualtry-switch-camera {
    display: flex !important;
  }
}

#wpvirtualtry-switch-camera:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2) !important;
  background: rgba(255,255,255,1) !important;
}

#wpvirtualtry-switch-camera:active {
  transform: scale(0.98);
}

/* Powered By */
.wpvirtualtry-powered-by {
  display: flex;
  align-items: center;
  margin-top: 10px;
  gap: 6px;
}

.wpvirtualtry-powered-by span {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}

.wpvirtualtry-powered-by a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.wpvirtualtry-powered-by a:hover {
  opacity: 0.7;
}

.wpvirtualtry-powered-by img {
  height: 18px;
  width: auto;
  display: block;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

@media (max-width: 640px) {
  .wpvirtualtry-powered-by {
    justify-content: flex-start;
  }
}


/* Responsive */
@media (max-width: 640px) {
  .wpvirtualtry-modal-backdrop {
    padding: 4px;
  }

  .wpvirtualtry-modal-content {
    max-width: 100%;
    max-height: 95vh;
    padding: 20px 16px !important;
  }
  
  /* Mobile Coupon Block - Compact horizontal layout */
  .wpvirtualtry-coupon-container {
    padding: 12px 14px !important;
    background: linear-gradient(135deg, var(--wpvirtualtry-brand-light), rgba(255, 255, 255, 0.95)) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
  }
  
  .wpvirtualtry-coupon-container .flex.items-center.justify-between {
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    text-align: left !important;
  }
  
  .wpvirtualtry-coupon-container .flex-1 {
    width: auto !important;
    flex: 0 1 auto !important;
  }
  
  /* Header section compact on mobile */
  .wpvirtualtry-coupon-container .flex.items-center.gap-2.mb-1 {
    justify-content: flex-start !important;
    margin-bottom: 2px !important;
    gap: 6px !important;
  }
  
  /* Mobile Coupon Title */
  .wpvirtualtry-coupon-container h5 {
    font-size: 13px !important;
    font-weight: 700 !important;
  }
  
  /* Mobile Coupon Subtitle */
  .wpvirtualtry-coupon-container p {
    font-size: 11px !important;
    text-align: left !important;
  }
  
  /* Code and button container - horizontal on mobile */
  .wpvirtualtry-coupon-container > div > div:last-child {
    width: auto !important;
    flex-direction: row !important;
    gap: 8px !important;
    align-items: center !important;
    flex-shrink: 0 !important;
  }
  
  /* Mobile Coupon Code - Compact */
  .wpvirtualtry-coupon-code {
    font-size: 12px !important;
    padding: 8px 12px !important;
    height: 32px !important;
    width: auto !important;
    min-width: 80px !important;
    text-align: center !important;
    letter-spacing: 0.8px !important;
    font-weight: 700 !important;
    background: white !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08) !important;
    border: 2px dashed var(--wpvirtualtry-brand) !important;
    display: flex !important;
    justify-content: center !important;
  }
  
  /* Mobile Copy Button - Compact */
  .wpvirtualtry-copy-btn {
    font-size: 11px !important;
    font-weight: 600 !important;
    padding: 8px 12px !important;
    height: 32px !important;
    min-height: 32px !important;
    width: auto !important;
    min-width: 70px !important;
    gap: 4px !important;
    justify-content: center !important;
    box-shadow: 0 2px 8px rgba(77, 77, 227, 0.2) !important;
    border-radius: 8px !important;
  }
  
  .wpvirtualtry-copy-btn svg {
    width: 12px !important;
    height: 12px !important;
  }
  
  /* Icon styling on mobile */
  .wpvirtualtry-coupon-icon {
    width: 14px !important;
    height: 14px !important;
  }
  
  /* Mobile Action Buttons - Prevent text wrapping */
  #wpvirtualtry-download,
  #wpvirtualtry-share,
  #wpvirtualtry-try-again {
    font-size: 0.8125rem !important; /* 13px */
    gap: 0.375rem !important; /* 6px */
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
  
  #wpvirtualtry-download svg,
  #wpvirtualtry-share svg,
  #wpvirtualtry-try-again svg {
    width: 14px !important;
    height: 14px !important;
    flex-shrink: 0 !important;
  }
  
  /* Mobile Action Buttons Container */
  .flex.items-center.justify-center.gap-6 {
    gap: 1rem !important; /* 16px instead of 24px */
    flex-wrap: nowrap !important;
    padding: 0 4px !important;
  }

  .wpvirtualtry-main-content {
    padding: 20px 16px;
  }

  .wpvirtualtry-mode-toggle {
    flex-direction: column;
    max-width: 100%;
  }

  .wpvirtualtry-mode-btn {
    justify-content: center;
    padding: 10px 16px;
  }
  
  /* Responsive container on mobile - Fixed size */
  .tryon-image-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    height: 280px !important;
    min-height: 280px !important;
    max-height: 280px !important;
  }
  
  .tryon-image-container img {
    max-width: 100% !important;
    max-height: 100% !important;
  }
  
  /* Camera container same size as try-on container on mobile */
  .wpvirtualtry-camera-container {
    width: 100% !important;
    height: 280px !important;
    min-height: 280px !important;
    max-height: 280px !important;
  }
  
  /* Camera enable container same size as try-on container on mobile */
  .wpvirtualtry-camera-enable-container {
    height: 240px;
    min-height: 240px;
    max-height: 240px;
  }
  
  /* Dropzone same size on mobile */
  .dropzone {
    height: 240px !important;
    min-height: 240px !important;
    max-height: 240px !important;
  }
  
  
  .wpvirtualtry-notification {
    right: 12px !important;
    left: 12px !important;
    top: 12px !important;
    max-width: calc(100% - 24px) !important;
  }
  
  .wpvirtualtry-notification > div {
    min-width: 0 !important;
    font-size: 13px !important;
  }
}
