@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400..900;1,400..900&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --bg-sand: #f5f2ec;
  --bg-sand-dark: #e8e2d8;
  --text-noir: #171615;
  --accent-terra: #a64b38;
  --accent-terra-hover: #8f3e2d;
  --accent-rose: #c77962;
  --border-subtle: rgba(23, 22, 21, 0.12);
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-sand);
  color: var(--text-noir);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .font-serif {
  font-family: var(--font-serif);
  letter-spacing: -0.02em;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-sand);
}
::-webkit-scrollbar-thumb {
  background: rgba(23, 22, 21, 0.2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(23, 22, 21, 0.4);
}

/* Subtle Film Grain */
.noise-overlay {
  background-image: radial-gradient(rgba(0,0,0,0.03) 1px, transparent 0);
  background-size: 8px 8px;
}

/* Product Detail Image Stage */
.product-image-stage {
  position: relative;
  overflow: hidden;
  user-select: none;
}

/* Look Builder Staging Canvas */
.outfit-stage {
  background: linear-gradient(145deg, #eee8de, #fdfbf7);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.04);
}

.mannequin-slot {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.mannequin-slot:hover {
  transform: translateY(-2px);
}

/* Animated pulsing markers for map */
@keyframes pulse-ring {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}

.rider-pulse-dot {
  position: relative;
}
.rider-pulse-dot::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: var(--accent-terra);
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  z-index: -1;
}

/* Leaflet dark custom tiles */
.custom-map .leaflet-tile {
  filter: brightness(0.96) contrast(1.08) saturate(0.85) sepia(0.15);
}

/* Drawer animations */
@keyframes slide-in-right {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-slide-in {
  animation: slide-in-right 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-fade-up {
  animation: fade-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Luxury hover effect */
.editorial-hover {
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.editorial-hover:hover {
  transform: scale(1.03);
}

/* Button pulse subtle */
.btn-primary {
  background-color: var(--text-noir);
  color: #f5f2ec;
  transition: all 0.25s ease;
}
.btn-primary:hover {
  background-color: #2b2927;
  transform: translateY(-1px);
}

.btn-accent {
  background-color: var(--accent-terra);
  color: #ffffff;
  transition: all 0.25s ease;
}
.btn-accent:hover {
  background-color: var(--accent-terra-hover);
  transform: translateY(-1px);
}

/* ==================== COLOUR PALETTE & SWATCH STYLES ==================== */
.swatch-circle {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
  flex-shrink: 0;
}
.swatch-circle:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.swatch-circle.active-swatch {
  transform: scale(1.15);
  outline: 2px solid var(--accent-terra);
  outline-offset: 2px;
  box-shadow: 0 4px 12px rgba(166, 75, 56, 0.35);
}

/* Duotone / Gradient Swatch Circle */
.swatch-duotone {
  background: linear-gradient(135deg, var(--col1) 50%, var(--col2) 50%);
}

/* Luxury Swatch Tooltip (Desktop Hover Only) */
.swatch-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #171615;
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 7px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .swatch-circle:hover .swatch-tooltip,
  .group:hover .swatch-tooltip,
  .color-card:hover .swatch-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
  }
}

@media (hover: none), (pointer: coarse) {
  .swatch-tooltip {
    display: none !important;
  }
}

/* ==================== MOBILE OPTIMIZATION & TOUCH UX ==================== */
/* Safe area padding for notch & home indicators */
:root {
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --bottom-nav-height: 54px;
}

/* iOS Touch optimization */
* {
  -webkit-tap-highlight-color: transparent;
}

button, a, select, input, textarea {
  touch-action: manipulation;
}

/* Prevent auto-zoom on iOS inputs while keeping compact desktop styling */
@media (max-width: 767px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="password"],
  input[type="number"],
  textarea,
  select {
    font-size: 16px !important;
  }

  /* Add bottom padding to body so floating bottom bar never obstructs content */
  body {
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 28px) !important;
  }
}

/* Horizontal scroll without scrollbars for touch racks */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

/* ==================== BAG DRAWER NATURAL MOBILE SCROLLING ==================== */
#bagDrawer {
  overscroll-behavior: contain;
}

#bagDrawer .bag-drawer-container {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-sand);
}

#bagDrawer .bag-scroll-body {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
  display: flex;
  flex-direction: column;
}

#bagDrawer .bag-active-flow-elements {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 1.5rem;
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}

/* ==================== GLOBAL SCROLLING & MODAL ARCHITECTURE ==================== */
html.modal-open, body.modal-open {
  overflow: hidden !important;
  height: 100% !important;
  touch-action: none !important;
}

/* Modal Backdrops & Overlays (Zero outer scroll conflicts, pure backdrop) */
#checkoutModal,
#orderReviewModal,
#productDetailModal,
#fitGuideModal,
#locationModal,
#authModal,
#orderTrackingModal,
#confirmationModal,
#accountModal,
#bagDrawer,
#stylistDrawer,
#sideMenuDrawer {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Modal Dialog Cards (Fixed max-height with column flex) */
#checkoutModal > div,
#orderReviewModal > div,
#fitGuideModal > div,
#locationModal > div,
#authModal > div,
#orderTrackingModal > div,
#confirmationModal > div,
#accountModal > div {
  max-height: 92vh;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Dedicated Inner Scroll Containers (Smooth Bidirectional Scrolling) */
#checkoutForm,
#orderReviewBody,
#bagDrawer .bag-scroll-body,
#stylistMessagesContainer,
#customerOrdersList,
#trackingTimeline,
.modal-scroll-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  overscroll-behavior-y: contain !important;
  overscroll-behavior-x: none !important;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  min-height: var(--bottom-nav-height);
  padding-bottom: max(6px, var(--safe-bottom)) !important;
  box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.08);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #171615;
  transition: all 0.2s ease;
  min-width: 52px;
  min-height: 44px;
  padding: 4px 6px;
}

.mobile-nav-item:active {
  transform: scale(0.92);
}

.mobile-nav-item.active {
  color: var(--accent-terra);
}

/* ==================== PRODUCT CARDS & FULL TITLE VISIBILITY ==================== */
.product-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.product-card-title {
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  min-height: 2.7em;
  line-height: 1.35 !important;
  word-break: normal !important;
  overflow-wrap: break-word !important;
}

/* ==================== PRODUCT DETAIL MODAL DISPLAY & MOBILE SCREEN ==================== */
/* Ensure #productDetailModal is hidden by default across all viewports unless explicitly opened */
#productDetailModal {
  display: none !important;
}

#productDetailModal.flex:not(.hidden) {
  display: flex !important;
}

@media (max-width: 767px) {
  #productDetailModal {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    z-index: 60 !important;
    display: none !important;
    flex-direction: column !important;
    background-color: var(--bg-sand) !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  #productDetailModal.flex:not(.hidden) {
    display: flex !important;
  }

  #productDetailModal > div {
    width: 100% !important;
    height: 100% !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    background-color: var(--bg-sand) !important;
  }

  /* Single unified scroll container on mobile: continuous, smooth, bidirectional scroll */
  #detailScrollContainer {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow-y: scroll !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    overscroll-behavior: auto !important;
    overscroll-behavior-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* Ensure all child wrappers in detailScrollContainer expand naturally without inner scroll locks */
  #detailScrollContainer > div {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
  }

  /* Responsive image stage: full portrait visible, zero cropping, immediate vertical pan */
  #detailMainImgContainer {
    width: 100% !important;
    max-height: 58vh !important;
    min-height: 320px !important;
    height: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #f4efe6 !important;
    padding: 0.5rem !important;
    position: relative !important;
    overflow: hidden !important;
    margin: 0 !important;
    touch-action: pan-y !important;
  }

  #detailMainImg {
    max-height: 56vh !important;
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: center !important;
    display: block !important;
    margin: 0 auto !important;
    pointer-events: none !important;
    transform-origin: center center !important;
    will-change: transform !important;
  }

  /* Bottom purchase bar on mobile: flex sibling footer without sticky gesture conflicts */
  #stickyBottomPurchaseBar {
    position: relative !important;
    flex-shrink: 0 !important;
    width: 100% !important;
    z-index: 30 !important;
    background-color: rgba(245, 242, 236, 0.98) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-top: 1px solid rgba(23, 22, 21, 0.12) !important;
    padding: 0.75rem 1rem !important;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom)) !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08) !important;
    touch-action: pan-y !important;
  }

  #stickyBottomPurchaseBar button {
    touch-action: manipulation !important;
  }
}


/* Bottom Sheet Modal Styles on Mobile */
@media (max-width: 767px) {
  .mobile-bottom-sheet {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .mobile-bottom-sheet > div {
    max-height: 88vh !important;
    border-radius: 20px 20px 0 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    padding-bottom: calc(16px + var(--safe-bottom)) !important;
  }

  /* Drag handle visual for mobile sheets */
  .sheet-handle {
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background-color: rgba(0, 0, 0, 0.2);
    margin: 0 auto 12px auto;
  }
}

@media (min-width: 768px) {
  .sheet-handle {
    display: none;
  }
}

/* Enhanced Touch Feedback */
/* Enlarge touch targets on mobile */
@media (max-width: 767px) {
  /* Make buttons and interactive pills easier to tap */
  .btn-primary, .btn-accent, .cat-pill {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Increase swatch size slightly for touch */
  .swatch-circle {
    width: 32px;
    height: 32px;
  }
  
  /* Make close buttons and icon buttons larger */
  button[id^="close"], .btn-touch-target {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ==================== DESKTOP PRODUCT DETAIL PAGE SIMPLIFICATION ==================== */
/* On Mac, laptop, and desktop screens (min-width: 768px), simplify the product page:
   - Completely remove the Similar Kurti Sets / Curated Selection / recommendations
   - Keep the Add to Bag button clearly visible, prominent, and above the fold
   - Retain full mobile experience unchanged (< 768px) */
@media (min-width: 768px) {
  #detailSimilarSection {
    display: none !important;
  }

  #detailAddToCartBtn {
    box-shadow: 0 4px 14px rgba(23, 22, 21, 0.25) !important;
    transition: all 0.2s ease-in-out !important;
  }
  #detailAddToCartBtn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(23, 22, 21, 0.35) !important;
  }
}

/* ==================== QUICK SIZE SELECTION OVERLAY & MOBILE SHEET ==================== */
.quick-size-overlay {
  animation: quickSizeSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, opacity;
}

@keyframes quickSizeSlideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.quick-size-btn {
  min-width: 38px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: all 0.15s ease;
}

.quick-size-btn:active {
  transform: scale(0.95);
}

/* Mobile Quick Size Bottom Sheet */
#mobileQuickSizeModal {
  transition: opacity 0.25s ease;
}
#mobileQuickSizeSheet {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding-bottom: max(1rem, var(--safe-bottom));
}

/* Compact Premium Snackbar Toast */
.alvera-snackbar {
  position: fixed;
  top: max(12px, var(--safe-top));
  left: 12px;
  right: 12px;
  z-index: 99999;
  background-color: rgba(20, 19, 18, 0.96);
  color: #f5f2ec;
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: snackbarSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@media (min-width: 640px) {
  .alvera-snackbar {
    left: auto;
    right: 20px;
    max-width: 380px;
  }
}

@keyframes snackbarSlideDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== ADDRESS AUTOCOMPLETE DROPDOWN ==================== */
#checkoutAddressSuggestions {
  scrollbar-width: thin;
  scrollbar-color: rgba(23, 22, 21, 0.2) transparent;
}
#checkoutAddressSuggestions::-webkit-scrollbar {
  width: 5px;
}
#checkoutAddressSuggestions::-webkit-scrollbar-thumb {
  background: rgba(23, 22, 21, 0.2);
  border-radius: 4px;
}
.address-suggestion-item {
  user-select: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.address-suggestion-item:active {
  background-color: rgba(0, 0, 0, 0.08);
}

