/* ==========================================================
   NARI NIKETAN — AI Virtual Try-On Studio CSS
   Theme: Royal Maroon (#8B1A4A), Regal Gold (#D4AF37), Dark Luxury (#0E0714)
   ========================================================== */

/* ===== TRY-ON MODAL BACKDROP ===== */
#nari-tryon-modal {
  position: fixed;
  inset: 0;
  background: rgba(14, 7, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 99995;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 1;
  transition: opacity 0.3s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: #F8F4E6;
}

#nari-tryon-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Modal Box */
.tryon-box {
  background: #160D20;
  border: 1.5px solid rgba(212, 175, 55, 0.35);
  border-radius: 20px;
  width: 900px;
  max-width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(212, 175, 55, 0.2);
  overflow: hidden;
  animation: tryonScaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tryonScaleIn {
  from { transform: scale(0.94) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

/* Modal Header */
.tryon-header {
  padding: 14px 20px;
  background: linear-gradient(135deg, rgba(139, 26, 74, 0.9), rgba(22, 13, 32, 0.95));
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tryon-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.tryon-header-title span {
  background: linear-gradient(135deg, #D4AF37, #FFE082);
  color: #0E0714;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 800;
}

.tryon-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #F8F4E6;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.tryon-close-btn:hover {
  background: #8B1A4A;
  border-color: #D4AF37;
  color: #fff;
}

/* Modal Body: 2-Column Grid */
.tryon-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

/* Left Column: Interactive Comparison Canvas Viewport */
.tryon-viewport-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tryon-compare-container {
  position: relative;
  width: 100%;
  height: 480px;
  max-height: 55vh;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid rgba(212, 175, 55, 0.3);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  background: #0E0714;
  user-select: none;
  touch-action: none;
}

/* Before (Original) Layer */
.tryon-layer-before {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.tryon-layer-before img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

/* After (Virtual Try-On Composite) Layer */
.tryon-layer-after {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  clip-path: inset(0 0 0 50%); /* Controlled by JS slider */
}

.tryon-layer-after img, .tryon-layer-after canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

/* Draggable Split Handle */
.tryon-split-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: #D4AF37;
  box-shadow: 0 0 12px #D4AF37;
  cursor: ew-resize;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tryon-split-button {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #D4AF37, #FFE082);
  border: 2px solid #0E0714;
  border-radius: 50%;
  color: #0E0714;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.tryon-tag {
  position: absolute;
  bottom: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  z-index: 5;
  pointer-events: none;
}

.tryon-tag.before {
  left: 12px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.tryon-tag.after {
  right: 12px;
  background: rgba(139, 26, 74, 0.85);
  color: #FFE082;
  border: 1px solid #D4AF37;
}

/* Viewport Instructions & Tips */
.tryon-slider-tip {
  font-size: 0.76rem;
  color: #BFAEA4;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Right Column: Photo Select, Product Details & Controls */
.tryon-controls-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Selected Product Summary Card */
.tryon-product-card {
  background: #1E122B;
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.tryon-product-thumb {
  width: 56px;
  height: 70px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #D4AF37;
}

.tryon-product-info {
  flex: 1;
}

.tryon-product-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: #F8F4E6;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tryon-product-price {
  font-size: 0.95rem;
  font-weight: 700;
  color: #D4AF37;
}

/* Upload Photo or Pick Avatar */
.tryon-section-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #D4AF37;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Upload Button / Dropzone */
.tryon-upload-btn {
  width: 100%;
  background: rgba(139, 26, 74, 0.35);
  border: 1.5px dashed #D4AF37;
  color: #F8F4E6;
  padding: 12px;
  border-radius: 12px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.tryon-upload-btn:hover {
  background: rgba(139, 26, 74, 0.6);
  border-color: #FFE082;
  transform: translateY(-1px);
}

/* Sample Model Avatars Carousel */
.tryon-avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.tryon-avatar-item {
  aspect-ratio: 3/4;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.tryon-avatar-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tryon-avatar-item:hover, .tryon-avatar-item.active {
  border-color: #D4AF37;
  box-shadow: 0 0 12px #D4AF37;
  transform: scale(1.04);
}

.tryon-avatar-item span {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  background: rgba(0, 0, 0, 0.7);
  font-size: 0.65rem;
  text-align: center;
  padding: 2px 0;
  font-weight: 600;
}

/* Drape Fit Sliders (Scale, Position, Opacity) */
.tryon-adjustments {
  background: #1E122B;
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tryon-slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: #BFAEA4;
}

.tryon-slider-row input[type=range] {
  width: 140px;
  accent-color: #D4AF37;
}

/* Action Buttons */
.tryon-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.tryon-btn-cart {
  background: linear-gradient(135deg, #8B1A4A, #5C0E30);
  border: 1.5px solid #D4AF37;
  color: #fff;
  padding: 12px;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(139, 26, 74, 0.4);
  transition: all 0.2s ease;
}

.tryon-btn-cart:hover {
  background: #D4AF37;
  color: #0E0714;
  box-shadow: 0 4px 20px #D4AF37;
}

.tryon-btn-share {
  background: #25D366;
  border: none;
  color: #fff;
  padding: 10px;
  border-radius: 12px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.tryon-btn-share:hover {
  background: #1EBE5D;
  transform: translateY(-1px);
}

/* Product Page Try-On Launch Button */
.btn-tryon-launch {
  background: linear-gradient(135deg, rgba(139, 26, 74, 0.9), #5C0E30);
  border: 1.5px solid #D4AF37;
  color: #FFE082;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.25);
  transition: all 0.25s ease;
  width: 100%;
  margin: 10px 0;
}

.btn-tryon-launch:hover {
  background: #D4AF37;
  color: #0E0714;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(212, 175, 55, 0.45);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .tryon-body {
    grid-template-columns: 1fr;
  }
  .tryon-compare-container {
    height: 380px;
  }
}
