/* ============================================================
   1. RESET ET BASE (Boutique)
   ============================================================ */
body {
  user-select: none;
  font-family: var(--font-standard);
  margin: 0; 
  padding: 0;
}

p {
  color: var(--text-secondary);
}

button {
  cursor: pointer;
}

.scrollblock, .scrollblockprod {
  overflow: hidden;
}

/* ============================================================
   2. LAYOUT & TRI (Structure de la page)
   ============================================================ */
.main-content {
  padding-left: clamp(16px, 1.25vw, 1.25vw);
  padding-right: clamp(16px, 1.25vw, 1.25vw);
  margin-top: clamp(20px, 2.5vw, 2.5vw);
  margin-bottom: clamp(60px, 8vw, 8vw); 
  transition: margin-right 0.3s ease;
}

.sort-wrapper {
  width:100%;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-content: center;
  justify-content: flex-start;
  align-items: center;
  gap: clamp(10px, 0.6vw, 0.6vw);
  margin-bottom: clamp(15px, 2vw, 2vw);
  color: var(--text-secondary);
  font-weight: bold;
  font-size: clamp(14px, 1.12vw, 1.12vw);
}

.select-container {
  position: relative;
  width: auto;
}

.styled-select {
  appearance: none;
  background-color: #161616;
  color: var(--text-secondary);
  border: 1px solid #444;
  padding: clamp(7px, 0.5vw, 0.5vw);
  padding-right: clamp(25px, 2.5vw, 2.5vw);
  border-radius: clamp(3px, 0.2vw, 0.2vw);
  width: 100%;
  font-family: inherit;
  font-size: clamp(14px, 1.12vw, 1.12vw);
  cursor: pointer;
}

.styled-select:focus-visible {
  outline: 2px solid var(--brand-pink);
  outline-offset: 2px;
}

.select-container::after {
  content: "\25BE";
  font-family: Arial, sans-serif;
  position: absolute;
  top: 50%;
  color: var(--text-primary);
  right: clamp(7.5px, 0.75vw, 0.75vw);
  transform: translateY(-50%);
  pointer-events: none;
}


/* ============================================================
   3. GRILLE ET CARTES PRODUITS
   ============================================================ */
#products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(250px, 15.5vw, 15.5vw), 1fr));
  gap: clamp(15px, 1vw, 1vw);
}

.product-card {
  content-visibility: auto;
  contain-intrinsic-size: 1px 350px;
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: clamp(3px, 0.2vw, 0.2vw);
  overflow: hidden;
  box-shadow: 1px 1px 5px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: box-shadow 0.3s ease;
  background: rgba(255, 255, 255, 0);
}

.img-container {
  overflow: hidden;
  flex: 2 1 auto;
}

.product-img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: cover;
  background: #eee;
  transition: transform 0.3s ease-in-out;
}

.product-img:hover {
  transform: scale(1.1);
}

.card-body {
  flex: 1 1 auto;
  padding: clamp(8px, 0.5vw, 0.5vw) clamp(10px, 0.6vw, 0.6vw);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background-color: var(--bg-modal);
}

.card-title {
  color: var(--text-secondary);
  font-size: clamp(16px, 1.22vw, 1.22vw);
  font-weight: bold;
  margin: 0 0 clamp(6px, 0.4vw, 0.4vw) 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.price {
  color: var(--text-primary);
  font-weight: bold;
  font-size: clamp(14px, 1.15vw, 1.15vw);
}

.quick-add {
  z-index: 10;
  border-bottom-right-radius: 50%;
  position: absolute;
  cursor: pointer;
  user-select: none;
  width: clamp(24px, 1.5vw, 1.5vw);
  height: clamp(24px, 1.5vw, 1.5vw);
  background: linear-gradient(to bottom, #ff7ab9, #ff57a5);
  box-shadow: 0 0px 6px 0px rgb(207 23 109 / 80%);
}

.quick-add-text {
    line-height: 0;
    height: 88%;
    width: 98%;
    display: flex;
    font-size: clamp(15px, 1vw, 1vw);
    font-weight: 900 !important;
    -webkit-text-stroke: 0.4px #2f2f2f;
    color: #2f2f2f;
    flex-direction: row;
    flex-wrap: nowrap;
    align-content: center;
    justify-content: center;
    align-items: center;
}

.quick-add:hover {
  background: var(--brand-gradient);
}

/* ============================================================
   4. SYSTÈME DE PANIER (Bouton, Overlay, Sidebar)
   ============================================================ */
#toggle-cart {
  position: fixed;
  top: 45lvh;
  right: clamp(25px, 1.5vw, 1.5vw);
  background: var(--bg-secondary);
  color: white;
  border: 1px solid #444;
  
  width: clamp(50px, 3.5vw, 3.5vw);
  height: clamp(50px, 3.5vw, 3.5vw);
  border-radius: 50%;
  font-size: clamp(22px, 1.9vw, 1.9vw);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 4px 4px 8px rgba(0,0,0,0.2);
  z-index: 2100;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  outline: none;
}

#cart-count {
  animation: pulse-dollar 2s infinite ease-in-out;
  rotate: 0deg;
  transition: rotate 0.3s ease;
  position: absolute;
  top: 0;
  right: 0;
  background: var(--brand-gradient);
  box-shadow: 0 1px 15px rgba(239, 61, 144, 0.3);
  color: white;
  font-size: clamp(12px, 1vw, 1vw);
  font-weight: bold;
  border-radius: 50%;
  width: clamp(20px, 1.25vw, 1.25vw);
  height: clamp(20px, 1.25vw, 1.25vw);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

@keyframes pulse-dollar {
  0% { transform: scale(1); }
  50% { transform: scale(1.17); }
  100% { transform: scale(1); }
}

@media (hover: hover) and (pointer: fine) {
  #toggle-cart:hover #cart-count { rotate: 15deg; }
}

#toggle-cart:active #cart-count {
  transform: rotate(0deg) scale(1);
}

#cart-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: 1040; 
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  background-color: rgba(0, 0, 0, 0.6);
}

#cart-overlay.overlay-active {
  opacity: 1; visibility: visible; pointer-events: auto; 
}

.cart-sidebar {
  user-select: text;
  box-sizing: border-box;
  position: fixed;
  right: 0; top: 0;
  width: clamp(270px, 17vw, 17vw);
  height: 100dvh;
  background: var(--bg-modal);
  padding: clamp(15px, 1vw, 1vw);
  overflow-y: auto;
  transition: transform 1s ease;
  z-index: 1050;
}

.cart-sidebar.hidden {
  transform: translateX(100%);
}

#cart-sidebar h4 {
  font-size: clamp(15px, 1.25vw, 1.25vw);
}

#cart-content > div {
  color: #7f7f7f;
  font-size: clamp(13px, 1.1vw, 1.1vw);
  display: block;    
  margin-bottom: clamp(10px, 0.6vw, 0.6vw);
}

.cart-item {
  border-bottom: 1px solid #444;
}

#cart-content button {
  border: none;
  background: none;
  color: #7f7f7fde;
  font-size: clamp(18px, 1.5vw, 1.5vw);
  cursor: pointer;
}

#clear-cart {
  font-size: clamp(15px, 1vw, 1vw);
  padding: 0.1vw 0.5vw;
  background: linear-gradient(to bottom, #dc3558de, #ff0077de);
  border: none;
  color: #202020;
  border-radius: clamp(2px, 0.1vw, 0.1vw);
  cursor: pointer;
}

#checkout {                                                                    
  transform: rotate(0deg);
  transition: transform 0.45s cubic-bezier(0.25, 0.1, 0.25, 1); 
  display: block;
  margin: clamp(50px, 3.1vw, 3.1vw) 0;
  padding: clamp(10px, 0.6vw, 0.6vw);
  background: var(--brand-gradient);
  color: white;
  text-align: center;
  text-decoration: none;
  border-radius: clamp(3px, 0.2vw, 0.2vw);
  font-weight: bold;
  font-size: clamp(16px, 1.3vw, 1.3vw);
  cursor: pointer;
}

#checkout:hover {
  transform: scale(1.04);
  transition: transform 0.5s ease;
  box-shadow: 0 4px 15px rgba(239, 61, 144, 0.3);
}

/* ============================================================
   5. MODALE PRODUIT (Lightbox)
   ============================================================ */
#modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1200;
}

#modal-overlay.active { display: flex; }

@keyframes lightboxin { 0% {opacity:0} 100% {opacity:1} }

#product-modal {
  scrollbar-gutter: stable;
  animation: lightboxin 2s;
  overflow-x: hidden;
  background: var(--bg-modal);
  width: 80%;
  max-height: 90dvh;
  overflow-y: scroll;
  border-radius: clamp(3px, 0.2vw, 0.2vw);
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  flex-wrap: nowrap;
  flex-direction: row;
}

#product-modal.touch-zooming {
  touch-action: none;
  overflow-y: scroll;
}

#product-modal::-webkit-scrollbar, 
#cart-sidebar::-webkit-scrollbar { width: 6px; }
#product-modal::-webkit-scrollbar-thumb, 
#cart-sidebar::-webkit-scrollbar-thumb { background-color: #7f7f7f; border-radius: 10px; }

#modal-close {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  width: clamp(32px, 2vw, 2vw);
  height: clamp(32px, 2vw, 2vw);
  padding: clamp(10px, 0.6vw, 0.6vw);
  border: none;
  border-radius: 50%;
  background: rgba(85, 85, 85, 1) url('../ui/croixlight.svg') no-repeat center / 75%;
  opacity: 0.5;
  cursor: pointer;
  z-index: 5;
}

#modal-close:hover { opacity: 0.8; }
#modal-close:focus-visible { outline: 2px solid var(--brand-pink); outline-offset: 2px; }

#thumb-img {    
  width: 55%; display: flex; align-items: flex-start; flex-direction: row; flex-wrap: nowrap;
}

#modal-thumbnails {
  width: clamp(70px, 4.3vw, 4.3vw);
  display: flex; flex-direction: column; gap: clamp(10px, 0.6vw, 0.6vw);
}

#modal-thumbnails:empty { display: none; }

#modal-thumbnails img {
  width: 100%; object-fit: cover; height: auto; aspect-ratio: 1 / 1;
  cursor: pointer; border-radius: clamp(3px, 0.2vw, 0.2vw); border: 1.25px solid transparent;
}

#modal-thumbnails img.selected { border-color: var(--text-secondary); }

#modal-body {
  min-width: 0; width: 85%; display: flex; flex-direction: column;
  padding: clamp(15px, 1vw, 1vw);
}

#modal-img {
  border-radius: clamp(3px, 0.2vw, 0.2vw); width: 100%; height: auto; aspect-ratio: 1 / 1;
  object-fit: contain; cursor: zoom-in;
}

#modal-header {
  user-select: text; width: 45%; display: flex; flex-direction: column; justify-content: space-between;
  padding: clamp(15px, 1vw, 1vw);
}

#modal-title {
  user-select: text; font-weight: bold; color: var(--text-primary);
  font-size: clamp(18px, 1.7vw, 1.7vw);
}

#modal-price {
  user-select: text; font-weight: bold; color: var(--text-primary);
  font-size: clamp(18px, 1.55vw, 1.55vw);
  margin-top: clamp(15px, 1vw, 1vw);
  margin-bottom: clamp(15px, 5vw, 5vw);
}

#modal-description {
  user-select: text; display: flex; align-items: center; justify-content: center;
  align-content: center; flex-wrap: nowrap; flex-direction: column; width: 100%;
  overflow-x: hidden; color: var(--text-secondary);
  font-size: clamp(15px, 1.16vw, 1.16vw);
  margin-bottom: clamp(15px, 1vw, 1vw);
}

#modal-variant-info {
  user-select: text; color: var(--text-secondary); display: flex; flex-direction: row-reverse; font-weight: bold;
  font-size: clamp(13px, 1.1vw, 1.1vw);
  margin-top: clamp(10px, 0.6vw, 0.6vw);  
  margin-bottom: clamp(20px, 1.25vw, 1.25vw);
}

#variant-unavailable-msg {
  color: #dc3583; font-weight: bold;
  font-size: clamp(14px, 1.15vw, 1.15vw);
  margin-bottom: clamp(10px, 0.6vw, 0.6vw);
}

.quantity-selector {
  display: flex; align-items: center; justify-content: center; margin: 10px 0;
}

.quantity-selector input {
  color: var(--text-primary); background-color: transparent; text-align: center; border-radius: clamp(3px, 0.2vw, 0.2vw);
  width: clamp(40px, 2.5vw, 2.5vw);
  font-size: clamp(16px, 1.25vw, 1.25vw);
}

#modal-add-to-cart {
  box-shadow: 0 4px 15px rgba(239, 61, 144, 0.3); background: var(--brand-gradient); color: white;
  border: none; width: 100%; border-radius: clamp(3px, 0.2vw, 0.2vw); cursor: pointer;
  padding: clamp(10px, 0.6vw, 0.6vw);
  font-size: clamp(16px, 1.35vw, 1.35vw);
  margin-top: clamp(30px, 1.9vw, 1.9vw);
  margin-bottom: clamp(40px, 2.5vw, 2.5vw);
}

#modal-add-to-cart:hover {
  background: linear-gradient(to bottom, var(--brand-pink), #ff0077de);
}

.no-context-menu {
  -webkit-touch-callout: none !important; -webkit-user-select: none !important;
  user-select: none !important; touch-action: none !important;
}

/* ============================================================
   6. GUIDE DES TAILLES & SPINNER
   ============================================================ */
#size-guide {
  user-select: text; min-width: 0 !important; width: 100%; overflow-x: auto;
  display: block; border-collapse: separate; -webkit-overflow-scrolling: touch; 
}

#size-guide td {
  border: 1px solid #ededed4a; white-space: nowrap; word-break: keep-all;
  color: var(--text-secondary) !important; border-top-color: #3a3a3a !important; background: none !important;
  padding: clamp(10px, 0.6vw, 0.6vw) clamp(15px, 0.9vw, 0.9vw);
  font-size: clamp(14px, 1.1vw, 1.1vw) !important;
}

#size-guide th {
  color: var(--text-primary) !important; border-top-color: #3a3a3a !important; background: none !important;
   font-size: clamp(14px, 1.1vw, 1.1vw) !important;
}

#size-guide::-webkit-scrollbar { height: 5px; }
#size-guide::-webkit-scrollbar-thumb { background: var(--brand-gradient); border-radius: 2px; }
#size-guide.is-scrollable { cursor: grab; }
#size-guide.is-grabbing { cursor: grabbing; }

.spinner-container {
  grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 50px; color: var(--brand-pink);
}

.spinner {
  border: clamp(7px, 0.45vw, 0.45vw) solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--brand-pink); border-radius: 50%;
  animation: spin 1s linear infinite;
  width: clamp(40px, 2.5vw, 2.5vw);
  height: clamp(40px, 2.5vw, 2.5vw);
  margin-bottom: clamp(15px, 1vw, 1vw);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   MODULE : CURRENCY FAB (Widget Devise) 
   ============================================================ */
.currency-fab {
  position: fixed; 
  bottom: 25px; 
  transform: translateY(50%); 
  left: 25px; 
  z-index: 2000;
  display: flex; 
  align-items: center; 
  background: var(--bg-modal); 
  border: 1px solid #444; 
  
  border-radius: clamp(25px, 1.5vw, 1.5vw);
  
  max-width: clamp(50px, 3.5vw, 3.5vw); 
  max-height: clamp(20px, 1.25vw, 1.25vw); 
  height: auto; 
  
  box-shadow: 2px 2px 8px rgba(0,0,0,0.4); 
  cursor: pointer;
  overflow: hidden; 
  -webkit-tap-highlight-color: transparent;
  transition: max-width 0.4s cubic-bezier(0.25, 1, 0.5, 1) 0.3s, max-height 0.4s ease 0.3s, background-color 0.3s ease;
}

.currency-fab.expanded {
  /* En mode étendu, il prend toute la largeur dispo avec une petite marge */
  max-width: calc(100vw - 30px); 
  background: #161616; 
  /* Hauteur étendue fluide */
  max-height: clamp(40px, 2.5vw, 2.5vw); 
  transition: max-width 0.4s cubic-bezier(0.25, 1, 0.5, 1) 0s, max-height 0.4s ease 0s, background-color 0.3s ease;
}

.currency-icon {
  line-height: 1;
  -webkit-font-smoothing: antialiased; 
  -moz-osx-font-smoothing: grayscale; 
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden; 
  will-change: transform; 
  transform: translateZ(0) scale(1);
  transition: transform 0.3s ease; 
  background: var(--brand-gradient); 
  -webkit-background-clip: text;
  background-clip: text; 
  -webkit-text-fill-color: transparent; 

  min-width: clamp(50px, 3.5vw, 3.5vw); 
  height: 50%; 
  
  display: flex;
  align-items: center; 
  justify-content: center; 
  user-select: none;
  font-weight: 900 !important;
  -webkit-text-stroke: 0.25px var(--brand-pink);
  font-size: clamp(13px, 0.95vw, 0.95vw);
}

@media (hover: hover) and (pointer: fine) {
  .currency-fab:hover .currency-icon { transform: translateZ(0) scale(1.15); }
}

.currency-text {
  white-space: normal; 
  color: var(--text-secondary); 
  font-size: clamp(11px, 0.75vw, 0.75vw); 
  line-height: 1.3;
  padding-right: 20px; 
  opacity: 0; 
  padding-top: clamp(10px, 2.5vw, 2.5vw); 
  padding-bottom: clamp(10px, 2.5vw, 2.5vw); 
  min-width: 230px;
  transition: opacity 0.2s ease 0s;
}

.currency-fab.expanded .currency-text {
  opacity: 1; 
  transition: opacity 0.3s ease 0.3s;
}

/* ============================================================
   7. RESPONSIVE : MOBILES & TABLETTES
   ============================================================ */

/* --- A. ARCHITECTURE COMMUNE (Mobile + Tablette Portrait) --- */
@media only screen and (max-width: 767px),
only screen and (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  #product-modal {
    display: flex; 
    flex-direction: column; 
    align-items: center;
    flex-wrap: nowrap; 
    justify-content: space-between;
  }
  
  #modal-header {
    display: flex;
    flex-direction: column; 
    align-items: flex-end;
    align-content: center; 
    width: 90%;
  }

  #thumb-img { 
    justify-content: center; 
    width: 100%;
  }

  #toggle-cart { 
    width: 56px; 
    height: 56px; 
    font-size: 26px; 
  }
}


/* --- B. SPÉCIFICITÉS TABLETTES --- */
@media only screen and (min-width: 768px) and (max-width: 1024px) {
  .cart-sidebar { 
    width: 360px; 
  } 
  #product-modal {
    width: 90%;
  }
}

/* Tablette Paysage (Exception Grille) */
@media only screen and (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
  #products { grid-template-columns: repeat(3, 1fr); }
}

/* Tablette Portrait (Ajustements cosmétiques exclusifs) 
@media only screen and (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  
}*/


/* --- C. SPÉCIFICITÉS MOBILES --- */
@media only screen and (max-width: 767px) {
  .currency-fab { 
    bottom: max(30px, calc(env(safe-area-inset-bottom) + 25px)); left: 15px; 
  }

  .cart-sidebar {
    width: 80%;
  }

  #product-modal { 
    width: 85%; 
    max-height: 90dvh; 
  }
/* images légèrement plus petites */
  #modal-thumbnails { 
    width: 64px; 
  }
/* bouton légèrement plus grand */
  #modal-add-to-cart { 
     min-height: 48px;
  } 
/* qty légèrement plus grand */
  .quantity-selector input { 
    min-height: 25px; 
    width: 50px; 
  } 
}

/* Exception petits mobiles */
@media only screen and (max-width: 380px) {
  .currency-fab.expanded { 
    max-height: 55px; 
  }
}

/* ============================================================
   8. RESPONSIVE : EXCEPTION MOBILE PAYSAGE
   ============================================================ */
@media only screen and (max-width: 950px) and (orientation: landscape) {
   #products { 
    grid-template-columns: repeat(3, 1fr); 
    gap: 10px; 
  }
}