/* Try-On Styles */

/* Try-On Button */
.xero-tryon-container {
  margin: 20px 0;
}

.xero-tryon-button {
  display: flex;
  align-items: center;
  background-color: #6366f1;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(99, 102, 241, 0.3);
}

.xero-tryon-button svg {
  margin-right: 8px;
  width: 16px;
  height: 16px;
}

.xero-tryon-button:hover {
  background-color: #4f46e5;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(99, 102, 241, 0.4);
}

.xero-tryon-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.4);
}

.xero-tryon-button-text {
  margin-left: 5px;
}

/* Try-On Modal */
.xero-tryon-modal {
  display: none;
  position: fixed;
  z-index: 999999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(17, 24, 39, 0);
  backdrop-filter: blur(0px);
  transition:
    background-color 0.3s ease,
    backdrop-filter 0.3s ease;
}

.xero-tryon-modal.active {
  background-color: rgba(17, 24, 39, 0.8);
  backdrop-filter: blur(4px);
}

@keyframes xero-tryon-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.xero-tryon-modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 20px;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.2),
    0 8px 10px -6px rgba(0, 0, 0, 0.1);
  position: relative;
  transform: translateY(-30px);
  opacity: 0;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
  border: 1px solid rgba(229, 231, 235, 1);
}

.xero-tryon-modal.active .xero-tryon-modal-content {
  transform: translateY(0);
  opacity: 1;
}

.xero-tryon-close {
  position: absolute;
  top: 12px;
  right: 15px;
  color: #6b7280;
  font-size: 24px;
  font-weight: 300;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  z-index: 10;
}

.xero-tryon-close:hover {
  color: #111827;
  background-color: #f3f4f6;
}

.xero-tryon-modal h2 {
  margin-top: 0;
  margin-bottom: 15px;
  color: #111827;
  font-size: 1.4rem;
  text-align: center;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.xero-tryon-modal h3 {
  color: #111827;
  font-size: 1.1rem;
  margin-bottom: 12px;
  font-weight: 600;
}

/* Product Info */
.xero-tryon-product-info {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.xero-tryon-product-image {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  margin-right: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.xero-tryon-product-details {
  flex: 1;
}

.xero-tryon-product-details p {
  color: #4b5563;
  margin-top: 4px;
  font-size: 0.85rem;
  line-height: 1.4;
}

.xero-tryon-product-name {
  font-size: 1.05rem;
  margin: 0;
  color: #111827;
  font-weight: 600;
}

/* Tabs */
.xero-tryon-tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 15px;
}

.xero-tryon-tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  color: #6b7280;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.xero-tryon-tab:hover {
  color: #4f46e5;
}

.xero-tryon-tab.active {
  color: #4f46e5;
  border-bottom-color: #4f46e5;
  font-weight: 600;
}

/* Upload Area */
.xero-tryon-upload-area {
  margin-bottom: 0;
  background-color: #f9fafb;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  transition: all 0.3s ease;
}

.xero-tryon-upload-area.dragging {
  background-color: #f0f9ff;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

#xero-tryon-upload {
  display: block;
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  border: 2px dashed #d1d5db;
  border-radius: 6px;
  background-color: #ffffff;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  font-size: 0.9rem;
}

#xero-tryon-upload:hover {
  border-color: #6366f1;
  background-color: #f5f5ff;
}

.xero-tryon-preview {
  display: none;
  margin-top: 15px;
  text-align: center;
  animation: xero-tryon-fade-in 0.5s ease;
}

.xero-tryon-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.xero-tryon-preview img:hover {
  transform: scale(1.02);
}

/* Result Area */
.xero-tryon-result-area {
  margin-bottom: 0;
  text-align: center;
  background-color: #f9fafb;
  padding: 15px;
  border-radius: 8px;
  animation: xero-tryon-fade-in 0.5s ease;
  transition: opacity 0.3s ease;
  border: 1px solid #e5e7eb;
}

.xero-tryon-result img {
  max-width: 100%;
  max-height: 250px;
  border-radius: 6px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.xero-tryon-result img:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Controls */
.xero-tryon-controls {
  display: flex;
  justify-content: center;
  margin-top: 15px;
  gap: 12px;
}

.xero-tryon-controls button {
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.xero-tryon-controls button svg {
  width: 14px;
  height: 14px;
  margin-right: 6px;
}

#xero-tryon-generate {
  background-color: #6366f1;
  color: white;
  border: none;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

#xero-tryon-generate:hover:not(:disabled) {
  background-color: #4f46e5;
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(99, 102, 241, 0.4);
}

#xero-tryon-generate:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#xero-tryon-reset {
  background-color: #ffffff;
  color: #4b5563;
  border: 1px solid #d1d5db;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#xero-tryon-reset:hover {
  background-color: #f3f4f6;
  color: #111827;
  border-color: #9ca3af;
}

/* Loader */
.xero-tryon-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 20px 0;
  animation: xero-tryon-fade-in 0.3s ease;
}

.xero-tryon-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top: 3px solid #6366f1;
  border-radius: 50%;
  animation: xero-tryon-spin 1s linear infinite;
  margin-bottom: 10px;
}

@keyframes xero-tryon-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.xero-tryon-loader p {
  color: #4b5563;
  font-size: 0.95rem;
  font-weight: 500;
}

/* Error Message */
.xero-tryon-error {
  color: #b91c1c;
  background-color: #fee2e2;
  padding: 12px;
  border-radius: 6px;
  margin-top: 15px;
  text-align: center;
  font-size: 0.9rem;
  border-left: 3px solid #ef4444;
  animation: xero-tryon-fade-in 0.3s ease;
}

/* Footer */
.xero-tryon-footer {
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
  text-align: center;
}

.xero-tryon-footer p {
  color: #6b7280;
  font-size: 0.8rem;
  margin: 0;
}

/* Scrollbar Styling */
.xero-tryon-modal-content::-webkit-scrollbar {
  width: 6px;
}

.xero-tryon-modal-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.xero-tryon-modal-content::-webkit-scrollbar-thumb {
  background: #c7c7c7;
  border-radius: 10px;
}

.xero-tryon-modal-content::-webkit-scrollbar-thumb:hover {
  background: #a0a0a0;
}

/* Responsive Adjustments */
@media screen and (max-width: 768px) {
  .xero-tryon-modal-content {
    margin: 0;
    padding: 16px;
    width: 100%;
    height: 100%;
    border-radius: 0;
    max-height: 100vh;
  }

  .xero-tryon-product-info {
    flex-direction: row;
    text-align: left;
    align-items: center;
  }

  .xero-tryon-product-image {
    margin-right: 12px;
    margin-bottom: 0;
    width: 50px;
    height: 50px;
  }

  .xero-tryon-upload-area,
  .xero-tryon-result-area {
    padding: 12px;
  }

  .xero-tryon-modal h2 {
    font-size: 1.2rem;
  }
}

/* Compact View for Small Screens */
@media screen and (max-height: 700px) {
  .xero-tryon-modal-content {
    margin: 2% auto;
    padding: 16px;
    max-height: 96vh;
  }

  .xero-tryon-product-info {
    margin-bottom: 12px;
    padding-bottom: 10px;
  }

  .xero-tryon-product-image {
    width: 50px;
    height: 50px;
  }

  .xero-tryon-preview img {
    max-height: 180px;
  }

  .xero-tryon-result img {
    max-height: 200px;
  }

  .xero-tryon-modal h2 {
    margin-bottom: 12px;
    font-size: 1.2rem;
  }
}

/* ========================================
   V2.0 — Session, Compare, Bulk, Share
   ======================================== */

/* Session Photo Notice */
.xero-tryon-session-notice {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.xero-tryon-session-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.xero-tryon-session-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid #86efac;
}

.xero-tryon-session-text {
  margin: 0 0 4px;
  color: #166534;
  font-size: 0.85rem;
  font-weight: 500;
}

.xero-tryon-link-btn {
  background: none;
  border: none;
  color: #4f46e5;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.xero-tryon-link-btn:hover {
  color: #3730a3;
}

/* Usage Meter */
.xero-tryon-usage-bar {
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.xero-tryon-usage-text {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 4px;
}

.xero-tryon-usage-track {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.xero-tryon-usage-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* Result Action Buttons */
.xero-tryon-result-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.xero-tryon-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #fff;
  color: #4b5563;
  border: 1px solid #d1d5db;
  text-decoration: none;
}

.xero-tryon-action-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
  color: #111827;
}

.xero-tryon-action-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

a.xero-tryon-action-btn {
  text-decoration: none;
}

/* Social Sharing */
.xero-tryon-share {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.xero-tryon-share-label {
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 500;
}

.xero-tryon-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.xero-tryon-share-btn:hover {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
}

.xero-tryon-share-btn svg {
  width: 14px;
  height: 14px;
}

/* Toast Notification */
.xero-tryon-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e293b;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 9999999;
  opacity: 0;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  pointer-events: none;
}

.xero-tryon-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Comparison Mode ─── */
.xero-tryon-compare-area {
  background: #f9fafb;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.xero-tryon-compare-modes {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  justify-content: center;
}

.xero-tryon-compare-mode {
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 20px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
}

.xero-tryon-compare-mode.active {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
}

/* Slider Comparison */
.xero-tryon-compare-slider {
  position: relative;
}

.xero-tryon-compare-container {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  line-height: 0;
}

.xero-tryon-compare-img {
  width: 100%;
  max-height: 350px;
  object-fit: contain;
  display: block;
}

.xero-tryon-compare-after-wrap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  clip-path: inset(0 0 0 50%);
  transition: none;
}

.xero-tryon-compare-after-wrap .xero-tryon-compare-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.xero-tryon-compare-handle {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
  z-index: 5;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
}

.xero-tryon-compare-label {
  position: absolute;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  z-index: 4;
  pointer-events: none;
}

.xero-tryon-compare-label-before {
  left: 8px;
}

.xero-tryon-compare-label-after {
  right: 8px;
}

/* Side by Side Comparison */
.xero-tryon-compare-sbs {
  display: flex;
  gap: 12px;
}

.xero-tryon-sbs-col {
  flex: 1;
  text-align: center;
}

.xero-tryon-sbs-col img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.xero-tryon-sbs-col span {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 500;
}

/* ─── Bulk Products Grid ─── */
.xero-tryon-more-products {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.xero-tryon-more-products h4 {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: #374151;
  font-weight: 600;
}

.xero-tryon-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}

.xero-tryon-product-card {
  cursor: pointer;
  text-align: center;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 6px;
  background: #fff;
  transition: all 0.2s ease;
}

.xero-tryon-product-card:hover {
  border-color: #6366f1;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
  transform: translateY(-2px);
}

.xero-tryon-product-card img {
  width: 100%;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}

.xero-tryon-product-card span {
  display: block;
  font-size: 0.7rem;
  color: #4b5563;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Pro Upgrade Notice */
.xero-tryon-pro-notice {
  text-align: center;
  padding: 12px;
  background: #fefce8;
  border: 1px solid #fef08a;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #854d0e;
}

.xero-tryon-pro-notice a {
  color: #6366f1;
  font-weight: 600;
  text-decoration: underline;
}

/* ─── Responsive V2 ─── */
@media screen and (max-width: 768px) {
  .xero-tryon-compare-sbs {
    flex-direction: column;
  }

  .xero-tryon-result-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .xero-tryon-action-btn {
    justify-content: center;
  }

  .xero-tryon-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  }

  .xero-tryon-share {
    flex-wrap: wrap;
  }
}

@media screen and (max-width: 480px) {
  .xero-tryon-session-info {
    flex-direction: column;
    text-align: center;
  }

  .xero-tryon-compare-modes {
    flex-direction: column;
    align-items: stretch;
  }

  .xero-tryon-compare-mode {
    text-align: center;
  }
}
