/* --- UTILITIES --- */
.hidden {
  display: none;
}
.flex {
  display: flex;
}
.items-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.justify-center {
  justify-content: center;
} 
.flex-col {
  flex-direction: column; 
} 
.relative {
  position: relative;
}
.absolute {
  position: absolute;
}
.w-full {
  width: 100%;
}
.h-full {
  height: 100%;
}

/* --- PRODUCT CARD (3D LOGIC) --- */
.product-card {
  position: relative;
  width: 250px;
  height: 400px;
  flex-shrink: 0;
  font-family: var(--site-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #e6f7ff;
}

.flip-card-inner { 
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.2s ease-out;
  transform-style: preserve-3d;
}

/* Trigger Logic */ 
.flip-checkbox:checked + .flip-card-inner {
  transform: rotateY(180deg); 
}

/* Disable front interaction when flipped */ 
.flip-checkbox:checked + .flip-card-inner .front-trigger {
  pointer-events: none; 
  display: none; /* completely remove label so it can't grab events */
}
.flip-checkbox:checked + .flip-card-inner .card-front {
  pointer-events: none;
}
/* additionally explicitly disable chat button just in case stacking context allows it */
.flip-checkbox:checked + .flip-card-inner .card-front .chat-toggle-btn {
  pointer-events: none !important;
}
/* ensure back face is interactive when flipped */
.flip-checkbox:checked + .flip-card-inner .card-back {
  pointer-events: auto;
  z-index: 20;
}
/* make front slightly lower when flipped so back buttons are topmost */
.flip-checkbox:checked + .flip-card-inner .card-front {
  z-index: 10;
}

.card-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 15px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* FRONT FACE */
.card-front {
  background-color: #2e2e31;
}

.front-trigger {
  position: absolute;
  inset: 0;
  z-index: 30;
  cursor: pointer;
}

.image-area {
  height: 60%;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, #1c1c1e, transparent, transparent);
  z-index: 10;
  pointer-events: none;
}

.product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.star-rating {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 60; /* above .front-trigger */
  pointer-events: auto;
  cursor: pointer;
}


.rating-badge {
  gap: 2px;
  background: rgba(91, 83, 83, 0.18);
  padding: 0;
  border-radius: 8px;
  justify-content: flex-end;
  display: flex;
  align-items: center;
}

.strelka {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  color: black;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 15px -3px rgba(255,255,255,0.2);
  opacity: 0;
}

.product-title {
  font-family: var(--site-font);
  font-size: 18px;
  font-weight: 600;
  color: #e6f7ff;
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin-top: 0;
  margin-bottom: 6px;
}

.product-subtitle {
  font-family: var(--site-font);
  font-size: 13px;
  color: #98a4ad;
  margin-top: 4px;
  font-weight: 500;
  opacity: 0.9;
}

.rating-number {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.product-price {
  font-family: var(--site-font);
  font-size: 20px;
  color: #f7db6c;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.details-heading {
  font-size: 14px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 5px;
  margin-left: 10px;
}

.cart-full-wrap {
  margin-top: auto;
  width: 100%;
  padding: 12px 0 0 0;
  box-sizing: border-box;
  display: flex;
  gap: 8px;
  flex-wrap: nowrap; /* keep buttons on one line */
  align-items: center;
}

.description-cart-back {
  padding: 10px;
  position: relative;
  color: #ffffff;
  font-size: 14px;
}

.cart-full-btn {
  position: relative;
  z-index: 60; /* keep above front-trigger when needed */
  flex: 1 1 50%; /* equal halves */
  min-width: 0; /* allow flex children to shrink */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  background: linear-gradient(135deg,#3b82f6,#6366f1);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform .15s, box-shadow .15s, background .3s;
}

.cart-full-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,.25);
}

.cart-full-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: currentColor;
}

.cart-photo-btn {
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
}

.cart-photo-btn:hover {
  background: #f9fafb;
}

/* smaller font on very narrow viewports to avoid text overflow */
@media (max-width: 420px) {
  .cart-full-btn {
    font-size: 12px;
    padding: 8px 10px;
  }
}

/* split-button corners (override outer radius) */
.cart-full-wrap .cart-full-btn:first-child { border-bottom-left-radius: 12px; }
.cart-full-wrap .cart-full-btn:last-child  { border-bottom-right-radius: 12px; }

/* Product gallery modal */
.product-gallery { position: fixed; inset: 0; display:flex; align-items:center; justify-content:center; z-index: 3000; pointer-events: none; opacity: 0; transition: opacity .18s ease; }
.product-gallery.open { pointer-events: auto; opacity: 1; }
.product-gallery .pg-overlay { position:absolute; inset:0; background:rgba(0,0,0,0.7); backdrop-filter: blur(4px); }
.product-gallery .pg-content { position: relative; z-index: 10; max-width: 92vw; width: 920px; display:flex; flex-direction:column; gap:12px; align-items:center; }
.pg-main { position: relative; display:flex; align-items:center; justify-content:center; width:100%; touch-action: pan-y; -ms-touch-action: pan-y; }
.pg-image { max-width: 100%; max-height: 80vh; border-radius: 12px; box-shadow: 0 12px 50px rgba(0,0,0,0.6); background:#111; object-fit:contain; touch-action: pan-y; -ms-touch-action: pan-y; }
.pg-arrow { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.5); border: none; color: #fff; font-size: 28px; width: 56px; height:56px; border-radius: 999px; display:flex; align-items:center; justify-content:center; cursor:pointer; transition: transform .12s; }
.pg-prev{ left: 8px; } .pg-next{ right: 8px; } .pg-arrow:hover{ transform: translateY(-50%) scale(1.06); }
.pg-thumbs { display:flex; gap:8px; overflow:auto; padding:6px; max-width:100%; }
.pg-thumb { width:64px; height:64px; object-fit:cover; border-radius:8px; opacity:0.9; cursor:pointer; border:2px solid transparent; }
.pg-thumb.active { border-color:#fff8dc; box-shadow: 0 6px 18px rgba(0,0,0,0.4); transform: translateY(-2px); }
.pg-close { position:absolute; top:-8px; right:-8px; z-index:12; background: rgba(255,255,255,0.06); border: none; color: #fff; font-size: 20px; width:36px; height:36px; border-radius:999px; cursor:pointer; }

@media (max-width:600px){
  /* hide prev/next arrows on small screens — use swipe instead */
  .pg-arrow{ display: none !important; }
  .pg-thumb{ width:44px;height:44px; }
  .pg-content{ width: 94vw; }
  .pg-image{ max-height: 60vh; }
}

.size-heading {
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 8px;
}

/*.brand-tag {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 20;
  padding: 4px 12px;
  background-color: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.model-tag {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 20;
  padding: 4px 12px;
  background-color: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}*/

.heart-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 40; /* Above trigger */
  padding: 8px;
  background-color: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  cursor: pointer;
  transition: color 0.2s;
}
.heart-btn:hover {
  color: #ef4444;
}

/* when product is in favorites, make heart red by default */
.heart-btn.favorited {
  color: #ef4444;
}


.front-content {
  height: 40%;
  padding: 0px;
  margin-left: 10px;
  margin-right: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  z-index: 20;
  pointer-events: none;
  overflow: hidden;
}

.glow-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  opacity: 0.8;
  filter: blur(2px);
}

/* BACK FACE */
.card-back {
  background-color: #2c2c2e;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
}

.close-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  background: transparent;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  cursor: pointer;
  z-index: 50;
  box-shadow: none;
}
.close-btn:active {
  transform: scale(0.95);
}

/* Hide inner icon by default (same behavior as mobile) */
.close-btn svg, .close-btn img, .close-btn-icon {
  width: 30px;
  height: 30px;
  pointer-events: none;
  opacity: 0;
} 

.details-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  padding-right: 48px;
  margin-left: 10px;
}

.details-desc {
  font-size: 12px;
  color: #9ca3af;
  line-height: 1.5;
  margin-bottom: 24px;
}

/* Size Selection */
.size-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.size-option {
  position: relative;
  aspect-ratio: 1;
}

.size-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.2s;
}

/* Checked Size State */
.size-radio:checked + .size-label {
  background-color: white;
  color: black;
  border-color: white;
  transform: scale(1.05);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Cart Button Logic using :has() equivalent logic via sibling combinations within flex */
.cart-container {
  margin-top: auto;
  padding-top: 0px;
}

.cart-btn {
  width: 100%;
  padding: 0px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  border: none;

  /* Default Disabled State */
  /*background-color: #3a3a3c;*/
  color: #6b7280;
  cursor: not-allowed;
}

.cart-btn-text-add {
  display: none;
}
.cart-btn-text-select {
  display: inline;
}

/* Logic: If any radio in the container is checked, style the button */
/* Since we can't easily do container queries for this specific logic in pure CSS without a specific wrapper structure, 
 we will use the :has() selector which is now widely supported */

.card-back:has(.size-radio:checked) .cart-btn {
  background-color: white;
  color: black;
  cursor: pointer;
  box-shadow: 0 10px 15px -3px rgba(255, 255, 255, 0.1);
}

.card-back:has(.size-radio:checked) .cart-btn:active {
  transform: scale(0.95);
}

.card-back:has(.size-radio:checked) .cart-btn-text-add {
  display: inline;
}
.card-back:has(.size-radio:checked) .cart-btn-text-select {
  display: none;
}

@media (max-width: 480px) {
    .brand-tag {
      position: absolute;
      top: 8px;
      left: 2px;
      z-index: 30;
    }
    .product-card {
  position: relative;
  width: 48%;
  height: 255px;
  }

.front-content {
  height: 40%;
}

.details-heading {
  font-size: 10px;
}

.description-cart-back {
  font-size: 10px;
}

  .details-title {
    margin-left: 5px;
  }
.strelka {
  max-width: 30px;
  max-height: 30px;
}
  .heart-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    z-index: 40;
  }

    /* Mobile: first product card title smaller */
    .product-card .txt-content div h3 {
      font-size: 12px !important;
    }
  }


