/* =============================================
   BUY PAGE - Brand-based product selection
   ============================================= */

/* Loading spinner */
.buy-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
  grid-column: 1 / -1;
}
.buy-loading p {
  color: #64748B;
  font-size: 14px;
  margin: 0;
}
.buy-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #E2E8F0;
  border-top-color: #3B82F6;
  border-radius: 50%;
  animation: buySpinner 0.8s linear infinite;
}
@keyframes buySpinner {
  to { transform: rotate(360deg); }
}

/* Toast notifications */
.buy-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 10000;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.buy-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.buy-toast-success {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #fff;
}
.buy-toast-error {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: #fff;
}

/* Brand logos row — horizontal scroll with arrows */
.buy-brands-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 32px;
}
.buy-brands-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 10px 6px;
  margin: 0 8px;
}
.buy-brands-scroll::-webkit-scrollbar { display: none; }
.buy-brands-arrow {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .2s;
  z-index: 2;
}
.buy-brands-arrow:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.buy-brands-arrow.hidden { opacity: 0; pointer-events: none; }
.buy-brands {
  display: flex;
  gap: 10px;
  padding: 4px 8px;
}

.buy-brand-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px 12px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: all .25s;
  flex: 0 0 130px;
  min-width: 130px;
  max-width: 130px;
}

.buy-brand-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(30,64,175,.15);
}

.buy-brand-card.active {
  border-color: var(--primary);
  background: rgba(30,64,175,.07);
  box-shadow: 0 0 0 3px rgba(30,64,175,.12);
}

.buy-brand-img-wrap {
  width: 100%;
  height: 80px;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.buy-brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.buy-brand-name {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: .8px;
}

.buy-brand-desc {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
  text-align: center;
}

/* Type header with tabs */
.buy-type-header {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 16px;
}

.buy-type-heading {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
}

.buy-type-select {
  padding: 10px 36px 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") right 12px center no-repeat;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  appearance: none;
  -webkit-appearance: none;
  min-width: 220px;
  max-width: 100%;
}

.buy-type-select:hover {
  border-color: var(--primary);
}

.buy-type-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,64,175,.1);
}

/* Product search bar */
.buy-search-wrap {
  position: relative;
  flex: 1;
  max-width: 340px;
  min-width: 180px;
}
.buy-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}
.buy-search-input {
  width: 100%;
  padding: 10px 36px 10px 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
  transition: border-color .2s, box-shadow .2s;
}
.buy-search-input::placeholder { color: #94a3b8; }
.buy-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,64,175,.1);
}
.buy-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.buy-search-clear:hover { color: var(--text); }

.buy-no-results {
  text-align: center;
  padding: 48px 20px;
  color: #64748b;
}
.buy-no-results svg { margin-bottom: 12px; color: #cbd5e1; }
.buy-no-results h3 { font-size: 18px; font-weight: 700; color: var(--text); margin: 0 0 8px; }
.buy-no-results p { font-size: 14px; margin: 0; }

/* Product grid */
.buy-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
  animation: buyFadeIn .35s ease;
  background: #F8FAFC;
  padding: 24px;
  border-radius: 16px;
  border: 1.5px solid var(--border);
}

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

/* Product card */
.buy-product-card {
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: 18px;
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
}

.buy-product-card:hover {
  border-color: var(--primary);
  transform: translateY(-5px);
  box-shadow: 0 12px 32px rgba(30,64,175,.14);
}

/* --- Image area --- */
.buy-product-img {
  width: 100%;
  height: 210px;
  overflow: hidden;
  background: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-bottom: 1px solid #F1F5F9;
}

.buy-product-img img:not(.buy-logo-bg) {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 16px;
  transition: transform .35s ease, opacity .3s ease;
  /* Improve image rendering quality */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Loading state for images */
.buy-product-img img.loading {
  opacity: 0;
}
.buy-product-img img.loaded {
  opacity: 1;
}

/* Image loading spinner */
.buy-product-img::before {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  border: 2px solid #E2E8F0;
  border-top-color: #3B82F6;
  border-radius: 50%;
  animation: buySpinner 0.8s linear infinite;
  opacity: 0;
  transition: opacity .2s;
}
.buy-product-img.img-loading::before {
  opacity: 1;
}

.buy-product-card:hover .buy-product-img img:not(.buy-logo-bg) {
  transform: scale(1.06);
}

.buy-product-img .buy-placeholder-icon {
  color: var(--muted);
  opacity: .2;
}

/* Brand-logo-only image variant */
.buy-product-img--logo {
  background: linear-gradient(135deg, #F0F4FF 0%, #E8F0FE 100%);
  flex-direction: column;
  gap: 8px;
}
.buy-product-img--logo .buy-logo-bg {
  width: 120px;
  height: 60px;
  object-fit: contain;
  opacity: .85;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.08));
}
.buy-product-img--logo .buy-placeholder-icon { opacity: .15; }

/* Error state */
.buy-product-img.buy-img-error {
  background: #F8FAFC;
}
.buy-product-img.buy-img-error::before {
  display: none;
}
.buy-product-img.buy-img-error::after {
  content: 'Image unavailable';
  font-size: 11px;
  color: var(--muted);
  position: absolute;
}

/* Badges overlay */
.buy-card-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  z-index: 2;
}
.buy-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: .4px;
  text-transform: uppercase;
}
.buy-badge--sale { background: #FEE2E2; color: #B91C1C; border: 1px solid #FCA5A5; }
.buy-badge--inverter { background: rgba(30,64,175,.1); color: var(--primary); border: 1px solid rgba(30,64,175,.2); }
.buy-badge--smart { background: rgba(5,150,105,.1); color: #059669; border: 1px solid rgba(5,150,105,.2); }
.buy-badge--non-inverter { background: rgba(107,114,128,.1); color: #4B5563; border: 1px solid rgba(107,114,128,.2); }
.buy-badge--chilled-water { background: rgba(6,182,212,.1); color: #0891B2; border: 1px solid rgba(6,182,212,.2); }
.buy-badge--conventional { background: rgba(217,119,6,.1); color: #B45309; border: 1px solid rgba(217,119,6,.2); }
.buy-badge--h-accu { background: rgba(139,92,246,.1); color: #7C3AED; border: 1px solid rgba(139,92,246,.2); }
.buy-badge--v-accu { background: rgba(236,72,153,.1); color: #DB2777; border: 1px solid rgba(236,72,153,.2); }
.buy-badge--indoor { background: rgba(34,197,94,.1); color: #16A34A; border: 1px solid rgba(34,197,94,.2); }
.buy-badge--outdoor { background: rgba(249,115,22,.1); color: #EA580C; border: 1px solid rgba(249,115,22,.2); }
.buy-badge--indoor-outdoor { background: rgba(59,130,246,.1); color: #2563EB; border: 1px solid rgba(59,130,246,.2); }

/* --- Card body --- */
.buy-product-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
}

.buy-product-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.buy-product-brand-tag {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--primary);
}

.buy-variant-pill {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.buy-product-brand {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.buy-product-name {
  font-size: 16px;
  font-weight: 800;
  color: #1E293B;
  margin: 0;
  line-height: 1.25;
  letter-spacing: -.2px;
}

.buy-product-model {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(30,64,175,.06);
  border: 1px solid rgba(30,64,175,.15);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: .4px;
  font-family: 'Courier New', monospace;
  width: fit-content;
}

.buy-product-specs {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.buy-product-spec {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  color: #475569;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.buy-product-spec svg { flex-shrink: 0; opacity: .7; }

/* Price section */
.buy-product-price-row {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #F1F5F9;
}
.buy-product-price-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 3px;
}
.buy-price-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.buy-price-main {
  font-size: 22px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}
.buy-price-suffix {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  opacity: .75;
}
.buy-price-srp {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: line-through;
}
.buy-price-discounted {
  font-size: 22px;
  font-weight: 900;
  color: #059669;
  line-height: 1;
}

/* CTA Button */
.buy-product-actions {
  padding: 0 18px 18px;
}

.buy-add-cart-btn {
  width: 100%;
  padding: 11px 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2, #3B82F6) 100%);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  letter-spacing: .2px;
  pointer-events: none;
}

.buy-product-card:hover .buy-add-cart-btn {
  background: linear-gradient(135deg, #1a36a0 0%, #2563eb 100%);
  box-shadow: 0 4px 14px rgba(30,64,175,.35);
}

/* Load more */
.buy-load-more {
  text-align: center;
  margin-top: 28px;
}

.buy-load-btn {
  padding: 12px 36px;
  background: transparent;
  border: 2px solid var(--primary);
  border-radius: 12px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
}

.buy-load-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* No products message */
.buy-no-products {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 16px;
}

/* Series card cursor */
.buy-series-card { cursor: pointer; }
.buy-view-btn { pointer-events: none; }

/* Responsive product grid */
@media (max-width: 900px) {
  .buy-products { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; padding: 18px; }
}
@media (max-width: 600px) {
  .buy-products { grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 12px; border-radius: 12px; }
  .buy-product-img { height: 160px; }
  .buy-product-body { padding: 12px 14px; gap: 7px; }
  .buy-product-name { font-size: 14px; }
  .buy-price-main, .buy-price-discounted { font-size: 18px; }
  .buy-product-actions { padding: 0 14px 14px; }
  .buy-add-cart-btn { padding: 9px 12px; font-size: 12px; }
}
@media (max-width: 380px) {
  .buy-products { grid-template-columns: 1fr; }
}

/* =============================================
   PRODUCT DETAIL MODAL
   ============================================= */
.pdm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 2000;
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.pdm-overlay.show { opacity: 1; pointer-events: auto; }

.pdm-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(.95);
  background: #FFFFFF; border-radius: 20px; z-index: 2001;
  width: 94%; max-width: 960px; max-height: 90vh; overflow: hidden;
  box-shadow: 0 24px 64px rgba(30,64,175,.25); opacity: 0; pointer-events: none;
  transition: all .3s ease;
}
.pdm-modal.show { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }

.pdm-close {
  position: absolute; top: 12px; right: 16px; background: none; border: none;
  font-size: 28px; color: var(--muted); cursor: pointer; z-index: 10;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: all .2s;
}
.pdm-close:hover { color: #1E293B; background: rgba(30,64,175,.08); }

.pdm-body {
  display: grid; grid-template-columns: 1fr 1.2fr; gap: 0; max-height: 90vh;
}

.pdm-img-col {
  display: flex; align-items: center; justify-content: center;
  background: #FFFFFF; border-radius: 20px 0 0 20px; min-height: 300px; padding: 32px;
  position: sticky; top: 0; height: 90vh; align-self: stretch;
}
.pdm-img { 
  display: flex; align-items: center; justify-content: center; 
  width: 100%; height: 100%; position: relative;
  cursor: grab;
  user-select: none;
}
.pdm-img.dragging { cursor: grabbing; }

/* Modal image loading spinner */
.pdm-img::before {
  content: '';
  position: absolute;
  width: 36px;
  height: 36px;
  border: 3px solid #E2E8F0;
  border-top-color: #3B82F6;
  border-radius: 50%;
  animation: buySpinner 0.8s linear infinite;
  opacity: 0;
  transition: opacity .2s;
  z-index: 1;
}
.pdm-img.img-loading::before {
  opacity: 1;
}

.pdm-img img { 
  max-width: 100%; max-height: 100%; width: auto; height: auto;
  object-fit: contain;
  transition: transform 0.1s ease-out, opacity 0.3s ease;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}
.pdm-img img.loading { opacity: 0; }
.pdm-img img.loaded { opacity: 1; }
.pdm-360-hint {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  opacity: 0.8;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}
.pdm-360-counter {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}
.pdm-img .buy-placeholder-icon { width: 120px; height: 120px; color: var(--muted); opacity: .25; }

/* Product Image Carousel */
.pdm-carousel {
  position: relative; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.pdm-carousel-track {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.pdm-carousel-slide {
  display: none; width: 100%; height: 100%;
  align-items: center; justify-content: center;
}
.pdm-carousel-slide.active { display: flex; }
.pdm-carousel-slide img {
  max-width: 100%; max-height: 100%; object-fit: contain;
}
.pdm-carousel-prev, .pdm-carousel-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.95); border: 1px solid #E2E8F0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 10; box-shadow: 0 2px 8px rgba(0,0,0,.1);
  transition: all .2s;
}
.pdm-carousel-prev:hover, .pdm-carousel-next:hover {
  background: #fff; border-color: var(--primary); color: var(--primary);
  box-shadow: 0 4px 12px rgba(30,64,175,.15);
}
.pdm-carousel-prev { left: 12px; }
.pdm-carousel-next { right: 12px; }
.pdm-carousel-dots {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; z-index: 10;
}
.pdm-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #CBD5E1; cursor: pointer; transition: all .2s;
}
.pdm-dot:hover { background: #94A3B8; }
.pdm-dot.active { background: var(--primary); transform: scale(1.2); }

.pdm-info-col {
  padding: 32px 28px; display: flex; flex-direction: column; gap: 12px;
  overflow-y: auto; max-height: 90vh; background: #FFFFFF;
}
.pdm-details-scroll {
  display: flex; flex-direction: column; gap: 12px;
  border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px;
}

.pdm-brand {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--primary); opacity: .8;
}
.pdm-name {
  font-size: 24px; font-weight: 800; color: #1E293B; margin: 0; line-height: 1.2;
}
.pdm-desc {
  font-size: 14px; color: var(--muted); line-height: 1.6; margin: 0;
}

.pdm-section { margin-top: 4px; }
.pdm-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); margin-bottom: 8px; display: block;
}

/* HP option buttons */
.pdm-hp-options {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.pdm-hp-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 16px; border: 2px solid var(--border); border-radius: 12px;
  background: transparent; cursor: pointer; transition: all .2s; min-width: 80px;
}
.pdm-hp-btn:hover { border-color: var(--primary); transform: translateY(-1px); }
.pdm-hp-btn.active {
  border-color: var(--primary); background: rgba(30,64,175,.08);
  box-shadow: 0 2px 8px rgba(30,64,175,.15);
}
.pdm-hp-label { font-size: 14px; font-weight: 800; color: var(--text); }
.pdm-hp-price { font-size: 11px; font-weight: 600; color: var(--primary); }
.pdm-hp-srp { font-size: 11px; font-weight: 500; color: var(--muted); text-decoration: line-through; margin-right: 6px; }
.pdm-hp-discounted { font-size: 11px; font-weight: 700; color: #e74c3c; }

/* Discount pricing styles for product cards */
.buy-price-srp { font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: line-through; margin-right: 8px; }
.buy-price-discounted { font-size: 18px; font-weight: 800; color: #e74c3c; }

/* Quantity controls */
.pdm-qty-row {
  display: flex; align-items: center; gap: 12px;
}
.pdm-qty-btn {
  width: 36px; height: 36px; border: 2px solid var(--border); border-radius: 10px;
  background: transparent; font-size: 18px; font-weight: 700; color: var(--text);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.pdm-qty-btn:hover { border-color: var(--primary); color: var(--primary); }
.pdm-qty-val {
  font-size: 20px; font-weight: 800; color: var(--text); min-width: 28px; text-align: center;
}

/* Installation toggle */
.pdm-installation-toggle {
  display: flex; gap: 8px; margin-top: 8px;
}
.pdm-toggle-btn {
  flex: 1; padding: 10px 16px; border: 2px solid var(--border); border-radius: 10px;
  background: var(--surface); cursor: pointer; transition: all .2s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 600; font-size: 14px; color: var(--muted);
}
.pdm-toggle-btn:hover { border-color: var(--primary); }
.pdm-toggle-btn.active {
  border-color: var(--primary); background: rgba(30,64,175,.08);
  color: var(--primary);
}
.pdm-toggle-btn .pdm-toggle-icon {
  display: none; font-size: 16px; font-weight: 700;
}
.pdm-toggle-btn.active .pdm-toggle-icon { display: inline; }
.pdm-installation-note {
  margin-top: 6px; font-size: 12px; color: var(--muted); font-style: italic;
}

/* Price breakdown */
.pdm-price-breakdown {
  margin-top: 12px; padding-top: 12px; border-top: 2px solid var(--border);
}
.pdm-price-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
}
.pdm-price-row.pdm-total-row {
  padding-top: 12px; margin-top: 8px; border-top: 1px solid var(--border);
}
.pdm-price-label { font-size: 14px; font-weight: 600; color: var(--muted); }
.pdm-price { font-size: 20px; font-weight: 800; color: var(--text); }
.pdm-total-price { font-size: 28px; font-weight: 900; color: var(--primary); }
.pdm-install-fee-row .pdm-price { color: #059669; }

/* Pricing notes */
.pdm-pricing-notes {
  margin-top: 12px; padding: 12px; background: rgba(30,64,175,.04);
  border-radius: 10px; border: 1px solid rgba(30,64,175,.12);
}
.pdm-note {
  font-size: 11px; color: var(--muted); line-height: 1.6; margin-bottom: 4px;
}
.pdm-note:last-child { margin-bottom: 0; }

/* View Installation Packages button */
.pdm-view-packages-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border: 2px solid #059669; border-radius: 10px;
  background: rgba(5,150,105,.07); color: #059669; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all .2s;
}
.pdm-view-packages-btn:hover {
  background: rgba(5,150,105,.15); transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(5,150,105,.2);
}

/* =============================================
   INSTALLATION PACKAGES MODAL (ipm)
   ============================================= */
.ipm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 2100; opacity: 0; pointer-events: none; transition: opacity .3s;
}
.ipm-overlay.active { opacity: 1; pointer-events: auto; }

.ipm-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(.95);
  background: #fff; border-radius: 20px; z-index: 2101;
  width: 94%; max-width: 680px; max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 64px rgba(30,64,175,.22); opacity: 0; pointer-events: none;
  transition: all .3s ease;
}
.ipm-modal.active { opacity: 1; pointer-events: auto; transform: translate(-50%,-50%) scale(1); }

.ipm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 2px solid var(--border);
  flex-shrink: 0;
}
.ipm-title { font-size: 20px; font-weight: 800; color: var(--text); margin: 0; }
.ipm-close {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--border);
  background: transparent; font-size: 20px; font-weight: 700; color: var(--text);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .2s; line-height: 1;
}
.ipm-close:hover { border-color: #ef4444; color: #ef4444; background: rgba(239,68,68,.08); }

.ipm-body {
  overflow-y: auto; padding: 20px 24px; flex: 1;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}

.ipm-alert {
  display: flex; align-items: center; gap: 10px;
  background: rgba(30,64,175,.07); border: 1.5px solid rgba(30,64,175,.2);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 20px; color: var(--primary);
  font-size: 13px;
}
.ipm-alert svg { flex-shrink: 0; }

.ipm-section { margin-bottom: 22px; }
.ipm-section-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 14px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 10px; padding-bottom: 7px;
  border-bottom: 2px solid;
}
.ipm-included-title { color: #059669; border-color: rgba(5,150,105,.25); }
.ipm-included-title svg { stroke: #059669; }
.ipm-excluded-title { color: #dc2626; border-color: rgba(220,38,38,.2); }
.ipm-excluded-title svg { stroke: #dc2626; }
.ipm-scope-title { color: var(--primary); border-color: rgba(30,64,175,.2); }
.ipm-scope-title svg { stroke: var(--primary); }

.ipm-list {
  list-style: none; padding: 0; margin: 0;
}
.ipm-list li {
  font-size: 13px; color: var(--text); line-height: 1.6;
  padding: 5px 0 5px 20px; position: relative; border-bottom: 1px solid rgba(0,0,0,.04);
}
.ipm-list li:last-child { border-bottom: none; }
.ipm-list-included li::before {
  content: '✓'; position: absolute; left: 0; color: #059669; font-weight: 800;
}
.ipm-list-excluded li::before {
  content: '✕'; position: absolute; left: 0; color: #dc2626; font-weight: 800; font-size: 11px; top: 7px;
}

.ipm-scope-list { display: flex; flex-direction: column; gap: 10px; }
.ipm-scope-item {
  background: rgba(30,64,175,.03); border: 1px solid rgba(30,64,175,.1);
  border-radius: 10px; padding: 12px 14px;
}
.ipm-scope-item-title {
  font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 6px;
}
.ipm-scope-sub {
  list-style: disc; margin: 0; padding-left: 18px;
}
.ipm-scope-sub li {
  font-size: 12px; color: var(--text); line-height: 1.6; padding: 2px 0;
}

.ipm-footer {
  padding: 16px 0 4px; display: flex; justify-content: flex-end;
  border-top: 1px solid var(--border); margin-top: 8px;
}
.ipm-close-btn { padding: 10px 28px; font-weight: 700; }

@media (max-width: 600px) {
  .ipm-modal { max-height: 92vh; border-radius: 16px 16px 0 0; top: auto; bottom: 0; transform: translateX(-50%) translateY(0) scale(.95); }
  .ipm-modal.active { transform: translateX(-50%) translateY(0) scale(1); }
  .ipm-header { padding: 16px 18px 12px; }
  .ipm-body { padding: 16px 18px; }
}

/* Actions */
.pdm-actions {
  display: flex; gap: 10px; margin-top: 4px;
}
.pdm-cart-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700;
}
.pdm-feedback-btn {
  display: flex; align-items: center; gap: 6px; font-weight: 600;
  white-space: nowrap; padding: 10px 16px;
}

/* =============================================
   REVIEWS SECTION
   ============================================= */
.pdm-reviews-section {
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
}
.pdm-reviews-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.pdm-reviews-title { font-size: 16px; font-weight: 700; color: var(--text); margin: 0; }
.pdm-avg-stars { color: #f5a623; font-size: 16px; }
.pdm-avg-num { font-weight: 800; color: var(--text); font-size: 15px; }
.pdm-review-count { font-size: 13px; color: var(--muted); }

.pdm-reviews-list {
  max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 16px;
}
.pdm-reviews-loading, .pdm-no-reviews {
  text-align: center; color: var(--muted); font-size: 13px; padding: 16px 0;
}
.pdm-review-item {
  padding: 10px 12px; background: #F1F5F9; border-radius: 10px;
  border: 1px solid #E2E8F0;
}
.pdm-review-top {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px;
}
.pdm-reviewer { font-size: 13px; color: var(--text); }
.pdm-review-stars { color: #f5a623; font-size: 13px; }
.pdm-review-date { font-size: 11px; color: var(--muted); margin-left: auto; }
.pdm-review-text { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0; }

/* Review form */
.pdm-review-form {
  padding: 14px; background: rgba(30,64,175,.04); border-radius: 12px;
  border: 1px solid rgba(30,64,175,.1);
}
.pdm-review-form-title { font-size: 14px; font-weight: 700; margin: 0 0 10px; color: var(--text); }
.pdm-review-input, .pdm-review-textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #E2E8F0; border-radius: 8px;
  background: #FFFFFF; color: #1E293B; font-size: 13px;
  font-family: inherit; transition: border-color .2s; margin-bottom: 8px; box-sizing: border-box;
}
.pdm-review-input:focus, .pdm-review-textarea:focus {
  outline: none; border-color: var(--primary);
}
.pdm-review-textarea { resize: vertical; min-height: 60px; }

/* Star picker */
.pdm-star-picker {
  display: flex; gap: 4px; margin-bottom: 8px;
}
.pdm-star {
  font-size: 24px; color: var(--border); cursor: pointer; transition: color .15s;
  user-select: none;
}
.pdm-star:hover, .pdm-star.active { color: #f5a623; }

.pdm-review-submit {
  width: 100%; padding: 10px; font-size: 13px; font-weight: 700;
}
.pdm-review-msg {
  text-align: center; font-size: 13px; margin-top: 8px; min-height: 18px;
}
.pdm-review-msg.error { color: #e74c3c; }
.pdm-review-msg.success { color: #27ae60; }

/* =============================================
   FEATURES & FUNCTIONS IN MODAL
   ============================================= */
.pdm-features-area, .pdm-functions-area {
  margin-top: 4px;
}
.pdm-features-area h4, .pdm-functions-area h4 {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); margin: 0 0 10px;
}
.pdm-features-list {
  display: flex; flex-direction: column; gap: 10px;
}
.pdm-feature-item {
  display: flex; gap: 10px; align-items: flex-start;
}
.pdm-feature-icon {
  flex-shrink: 0; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  background: rgba(30,64,175,.1); border-radius: 50%; color: var(--primary); margin-top: 1px;
}
.pdm-feature-icon svg { width: 16px; height: 16px; }
.pdm-feature-item strong {
  display: block; font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.3;
}
.pdm-feature-item p {
  font-size: 12px; color: var(--muted); line-height: 1.5; margin: 2px 0 0;
}
.pdm-model-tag {
  margin-top: 8px; font-size: 11px; font-weight: 700; color: var(--primary);
  background: rgba(30,64,175,.08); padding: 4px 10px; border-radius: 6px; display: inline-block;
}
.pdm-functions-tags {
  display: flex; flex-wrap: wrap; gap: 5px;
}
.pdm-fn-tag {
  font-size: 11px; padding: 4px 10px; background: rgba(30,64,175,.05); border: 1px solid var(--border); border-radius: 20px; color: var(--text);
  white-space: nowrap; font-weight: 500;
}

/* Technical Specifications Display */
.pdm-spec-images-area {
  margin-top: 16px;
}
.pdm-tech-specs h4 {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); margin: 0 0 12px;
}
.pdm-specs-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  background: rgba(255,255,255,.03);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.pdm-spec-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.pdm-spec-row:last-child {
  border-bottom: none;
}
.pdm-spec-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.pdm-spec-value {
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
  text-align: right;
}

/* =============================================
   MODAL SPECS AREA
   ============================================= */
.pdm-specs-area {
  display: none;
  margin-top: 4px;
  padding: 12px 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.pdm-specs-area.has-specs { display: block; }
.pdm-specs-area h4 {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); margin: 0 0 8px;
}
.pdm-specs-table {
  width: 100%; border-collapse: collapse;
}
.pdm-specs-table tr + tr td { border-top: 1px solid var(--border); }
.pdm-specs-table td {
  padding: 5px 0; font-size: 13px; vertical-align: top;
}
.pdm-specs-table td:first-child {
  font-weight: 600; color: var(--text); width: 40%; padding-right: 12px;
}
.pdm-specs-table td:last-child {
  color: var(--muted);
}

/* =============================================
   WARRANTY INSIDE MODAL
   ============================================= */
.pdm-warranty-area {
  margin-top: 4px;
}
.pdm-warranty h4 {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); margin: 0 0 10px;
}
.pdm-warranty-badges {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.pdm-warranty-badge {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  flex: 1; min-width: 80px;
}
.pdm-warranty-shield {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; margin-bottom: 5px; box-shadow: 0 3px 10px rgba(0,0,0,.25);
}
.pdm-warranty-num { font-size: 20px; font-weight: 900; line-height: 1; }
.pdm-warranty-unit { font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.pdm-warranty-desc {
  font-size: 11px; font-weight: 600; color: var(--muted); line-height: 1.3; max-width: 100px;
}

/* =============================================
   BRAND WARRANTY / ASSURANCE SECTION (page-level)
   ============================================= */
.bw-section {
  padding: 48px 32px;
  background: #FFFFFF;
  margin-top: 0;
  margin-left: 250px;
  border-top: 1px solid #E2E8F0;
  border-bottom: 1px solid #E2E8F0;
}
.bw-title {
  font-size: 26px; font-weight: 800; text-align: center; margin: 0 0 36px;
  color: #0F172A;
}
.bw-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 40px;
}
.bw-subtitle {
  font-size: 20px; font-weight: 700; color: #1E293B; margin: 0 0 20px;
  padding-bottom: 10px; border-bottom: 2px solid #E2E8F0;
}

/* Feature rows */
.bw-feature {
  display: flex; gap: 14px; margin-bottom: 20px; align-items: flex-start;
}
.bw-icon {
  flex-shrink: 0; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
}
.bw-feature strong {
  display: block; font-size: 15px; font-weight: 700; color: #1E293B; margin-bottom: 4px;
}
.bw-feature p {
  font-size: 13px; color: #64748B; line-height: 1.5; margin: 0;
}

/* Warranty badges */
.bw-badges {
  display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 24px;
}
.bw-badge {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  flex: 1; min-width: 100px;
}
.bw-badge-shield {
  width: 80px; height: 80px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; margin-bottom: 6px;
}
.bw-badge-num { font-size: 28px; font-weight: 900; line-height: 1; }
.bw-badge-unit { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.bw-badge-label {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px;
  color: #1E293B; margin-bottom: 2px;
}
.bw-badge-desc {
  font-size: 11px; color: #64748B; line-height: 1.3; max-width: 120px;
}

/* Stats row */
.bw-stats {
  display: flex; flex-direction: column; gap: 16px;
}
.bw-stat {
  display: flex; gap: 12px; align-items: center;
}
.bw-stat-icon { flex-shrink: 0; width: 40px; height: 40px; }
.bw-stat-icon svg { width: 40px; height: 40px; }
.bw-stat strong {
  display: block; font-size: 14px; font-weight: 700; color: #1E293B;
}
.bw-stat p {
  font-size: 12px; color: #64748B; margin: 2px 0 0; line-height: 1.3;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
  .buy-brands {
    gap: 8px;
  }
  .buy-brand-card {
    padding: 10px 8px 8px;
    flex: 0 0 110px; min-width: 110px; max-width: 110px;
  }
  .buy-brand-img-wrap {
    height: 60px;
  }
  .buy-brand-name {
    font-size: 11px;
  }
  .buy-brand-desc {
    display: none;
  }
  .buy-brands-arrow {
    width: 30px; height: 30px;
  }
  /* Section header with search bar - stack on mobile */
  .section-header {
    flex-direction: column !important;
    align-items: flex-start !important;
  }
  .section-header .buy-search-wrap {
    max-width: 100% !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  .buy-type-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .buy-type-select {
    width: 100%;
    min-width: 0;
  }
  .buy-search-wrap {
    max-width: 100%;
    width: 100%;
  }
  .buy-products {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .buy-product-img {
    height: 110px;
  }
  .buy-product-img img {
    padding: 8px;
  }
  .buy-product-name {
    font-size: 12px;
  }
  .buy-product-price {
    font-size: 16px;
  }
  .buy-product-body {
    padding: 10px;
    gap: 6px;
  }
  .buy-product-desc {
    font-size: 11px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
  .buy-product-model {
    font-size: 10px;
  }
  .buy-product-actions {
    padding: 0 10px 10px;
  }
  /* Modal responsive */
  .pdm-modal { width: 92%; max-width: 400px; max-height: 90vh; border-radius: 16px; overflow-y: auto; }
  .pdm-body { display: flex; flex-direction: column; max-height: none; }
  .pdm-img-col {
    border-radius: 16px 16px 0 0;
    min-height: 0 !important;
    max-height: 200px !important;
    height: 200px !important;
    padding: 12px 16px;
    position: static;
    flex-shrink: 0;
    background: #f8fafc;
  }
  .pdm-img { height: 100%; }
  .pdm-img img { width: auto; max-width: 100%; max-height: 100%; height: auto; object-fit: contain; image-rendering: -webkit-optimize-contrast; }
  .pdm-info-col { padding: 16px; overflow-y: visible; max-height: none; }
  .pdm-name { font-size: 18px; }
  .pdm-price { font-size: 22px; }
  .pdm-actions { flex-direction: column; }
  .pdm-close { top: 6px; right: 10px; font-size: 24px; width: 32px; height: 32px; }
  /* Warranty section responsive */
  .bw-section { padding: 32px 16px; margin-left: 0; }
  .bw-title { font-size: 20px; margin-bottom: 24px; }
  .bw-grid { grid-template-columns: 1fr; gap: 28px; }
  .bw-badges { gap: 10px; }
  .bw-badge-shield { width: 64px; height: 64px; }
  .bw-badge-num { font-size: 22px; }
}
@media (max-width: 480px) {
  .buy-products {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .buy-product-card {
    flex-direction: row;
    align-items: stretch;
  }
  .buy-product-img {
    height: auto;
    width: 100px;
    min-height: 100px;
    flex-shrink: 0;
    border-radius: 12px 0 0 12px;
  }
  .buy-product-img img {
    padding: 6px;
  }
  .buy-product-card .buy-product-body {
    flex: 1;
    padding: 10px 12px;
  }
  .buy-product-card .buy-product-actions {
    display: none;
  }
  .buy-type-select {
    min-width: 0;
    width: 100%;
    font-size: 13px;
  }
  .buy-brand-card {
    flex: 0 0 90px; min-width: 90px; max-width: 90px;
    padding: 8px 6px 6px;
  }
  .buy-brand-img-wrap {
    height: 48px;
  }
  .buy-brand-name {
    font-size: 10px;
  }
}

/* =============================================
   ADMIN: Add Unit button next to Select Type
   ============================================= */
.buy-admin-add-unit-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border: 2px dashed #3B82F6; border-radius: 8px;
  background: rgba(59,130,246,.06); color: #1D4ED8;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: all .2s;
}
.buy-admin-add-unit-btn:hover {
  background: rgba(59,130,246,.15); border-color: #1D4ED8;
}
.buy-admin-delete-unit-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border: 2px dashed #DC2626; border-radius: 8px;
  background: rgba(220,38,38,.06); color: #DC2626;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: all .2s;
}
.buy-admin-delete-unit-btn:hover {
  background: rgba(220,38,38,.15); border-color: #B91C1C;
}
.buy-admin-delete-unit-btn.active {
  background: #DC2626; color: #fff; border-style: solid;
}

/* Delete mode checkbox on product cards */
.buy-delete-checkbox {
  display: none;
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 10;
  width: 24px;
  height: 24px;
  cursor: pointer;
  accent-color: #DC2626;
}
.delete-mode .buy-delete-checkbox {
  display: block;
}
.delete-mode .buy-product-card {
  cursor: pointer;
  transition: box-shadow .2s, border-color .2s;
}
.delete-mode .buy-product-card:hover {
  border-color: #FECACA;
  box-shadow: 0 0 0 3px rgba(220,38,38,.15);
}
.delete-mode .buy-product-card.selected-for-delete {
  border-color: #DC2626;
  box-shadow: 0 0 0 3px rgba(220,38,38,.25);
  background: #FEF2F2;
}

/* Delete mode floating bar */
#deleteModebar {
  animation: slideUp .3s ease;
}
@keyframes slideUp {
  from { transform: translateX(-50%) translateY(100px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* Admin edit button on product cards */
.buy-admin-edit-btn {
  position: absolute; top: 8px; right: 8px; z-index: 5;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 6px; border: none;
  background: rgba(30,64,175,.9); color: #fff;
  font-size: 11px; font-weight: 700; cursor: pointer;
  opacity: 0; transition: opacity .2s;
}
.buy-product-card:hover .buy-admin-edit-btn { opacity: 1; }
.buy-admin-edit-btn:hover { background: #1E40AF; }

/* =============================================
   UNIT MODAL — styled for buy page
   ============================================= */
body.uf-modal-open {
  overflow: hidden !important;
  position: fixed;
  width: 100%;
  height: 100%;
}
.uf-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10000;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  overflow: hidden;
}
.uf-modal-box {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,.2);
  overflow: hidden;
}
.uf-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #E2E8F0;
  flex-shrink: 0;
  background: #fff;
}
.uf-modal-header h3 { margin: 0; font-size: 17px; font-weight: 800; color: #0F172A; }
.uf-modal-close {
  width: 32px; height: 32px; border: none; background: #F1F5F9;
  border-radius: 8px; font-size: 18px; cursor: pointer; color: #64748B;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.uf-modal-close:hover { background: #E2E8F0; color: #0F172A; }
.uf-modal-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  -webkit-overflow-scrolling: touch;
}
.uf-modal-body::-webkit-scrollbar { width: 6px; }
.uf-modal-body::-webkit-scrollbar-track { background: #F1F5F9; }
.uf-modal-body::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 99px; }
.uf-modal-body::-webkit-scrollbar-thumb:hover { background: #94A3B8; }
.uf-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid #E2E8F0;
  flex-shrink: 0;
  background: #fff;
}

.uf-fieldset {
  border: 1.5px solid #E2E8F0;
  border-radius: 10px;
  padding: 16px;
  margin: 0;
  min-width: 0;
  display: block;
  position: relative;
  background: #fff;
  flex-shrink: 0;
}
.uf-fieldset legend {
  font-weight: 800;
  font-size: 12px;
  color: #1E40AF;
  padding: 0 8px;
  text-transform: uppercase;
  letter-spacing: .5px;
  background: #fff;
  position: relative;
}
.uf-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.uf-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; }
.uf-field { display: flex; flex-direction: column; gap: 4px; }
.uf-field label { font-size: 12px; font-weight: 700; color: #475569; }
.uf-field input, .uf-field select, .uf-field textarea {
  padding: 8px 10px; border: 1.5px solid #CBD5E1; border-radius: 8px;
  font-size: 13px; color: #0F172A; background: #fff; width: 100%;
  transition: border-color .15s; box-sizing: border-box;
}
.uf-field input:focus, .uf-field select:focus, .uf-field textarea:focus {
  outline: none; border-color: #3B82F6; box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.uf-field textarea { resize: vertical; min-height: 60px; }
.uf-field-hint { font-size: 11px; color: #94A3B8; margin-top: 2px; }
.uf-hint { font-size: 12px; color: #64748B; margin: 0 0 8px; }
.uf-btn-add {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 8px;
  padding: 6px 14px; border: 1.5px dashed #93C5FD; border-radius: 8px;
  background: rgba(59,130,246,.04); color: #2563EB;
  font-size: 12px; font-weight: 700; cursor: pointer;
}
.uf-btn-add:hover { background: rgba(59,130,246,.1); border-color: #3B82F6; }
.uf-btn-cancel {
  padding: 8px 20px; border: 1.5px solid #CBD5E1; border-radius: 8px;
  background: #fff; color: #475569; font-size: 13px; font-weight: 700; cursor: pointer;
}
.uf-btn-cancel:hover { background: #F8FAFC; }
.uf-btn-save {
  padding: 8px 24px; border: none; border-radius: 8px;
  background: linear-gradient(135deg,#1E40AF,#3B82F6); color: #fff;
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.uf-btn-save:hover { filter: brightness(1.1); }

/* Feature rows */
.uf-features-list { display: flex; flex-direction: column; gap: 8px; }
.uf-feature-row {
  display: grid; grid-template-columns: 160px 1fr 32px; gap: 8px; align-items: start;
}
.uf-feature-row input, .uf-feature-row textarea {
  font-size: 12px; padding: 6px 8px; border: 1.5px solid #CBD5E1;
  border-radius: 6px; box-sizing: border-box; width: 100%;
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.uf-feature-row textarea { resize: vertical; min-height: 36px; word-break: break-word; overflow-wrap: break-word; }
.uf-del-btn {
  width: 32px; height: 32px; border: none; background: #FEE2E2; color: #DC2626;
  border-radius: 6px; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.uf-del-btn:hover { background: #FECACA; }

/* Function tags */
.uf-fn-tags-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.uf-fn-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; background: #EFF6FF; color: #1E40AF;
  border-radius: 20px; font-size: 12px; font-weight: 600;
}
.uf-fn-tag .uf-fn-x { cursor: pointer; color: #93C5FD; font-size: 14px; margin-left: 2px; }
.uf-fn-tag .uf-fn-x:hover { color: #DC2626; }

/* HP variant rows */
.uf-hp-rows { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; }
.uf-hp-row {
  display: grid; grid-template-columns: 120px 1fr 110px 110px 32px; gap: 8px; align-items: center;
  padding: 8px 10px; background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 8px;
}
.uf-hp-row select, .uf-hp-row input {
  padding: 6px 8px; border: 1.5px solid #CBD5E1; border-radius: 6px;
  font-size: 12px; color: #0F172A; background: #fff;
}
.uf-hp-row select:focus, .uf-hp-row input:focus {
  outline: none; border-color: #3B82F6; box-shadow: 0 0 0 2px rgba(59,130,246,.1);
}
@media (max-width: 640px) {
  .uf-hp-row { grid-template-columns: 1fr 1fr; }
  .uf-hp-row .uf-del-btn { grid-column: span 2; justify-self: end; }
}

/* Image dropzone */
.uf-dropzone {
  border: 2px dashed #CBD5E1; border-radius: 12px;
  padding: 24px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
}
.uf-dropzone.uf-dz-hover { border-color: #3B82F6; background: rgba(59,130,246,.04); }
.uf-dropzone.uf-dz-uploading { pointer-events: none; opacity: .6; }
.uf-dropzone-idle { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.uf-dropzone-idle p { margin: 0; font-size: 13px; color: #64748B; }
.uf-dz-browse { color: #2563EB; font-weight: 700; text-decoration: underline; cursor: pointer; }
.uf-dz-formats { font-size: 11px !important; color: #94A3B8 !important; }
.uf-dropzone-preview {
  display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative;
}
.uf-dropzone-preview img {
  max-height: 140px; max-width: 100%; border-radius: 8px;
  border: 1px solid #E2E8F0; object-fit: contain;
}
.uf-dz-remove {
  position: absolute; top: -6px; right: -6px;
  width: 26px; height: 26px; border-radius: 50%; border: none;
  background: #DC2626; color: #fff; font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.uf-dz-remove:hover { background: #B91C1C; }
.uf-dz-filename { font-size: 11px; color: #64748B; margin: 0; word-break: break-all; }

/* Multi-image gallery */
.uf-images-gallery {
  display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px;
}
.uf-images-gallery:empty { display: none; }
.uf-gallery-item {
  position: relative; width: 100px; height: 100px;
  border: 2px solid #E2E8F0; border-radius: 10px;
  overflow: hidden; cursor: grab; background: #F8FAFC;
  transition: border-color .2s, box-shadow .2s;
}
.uf-gallery-item:first-child { border-color: #3B82F6; box-shadow: 0 0 0 2px rgba(59,130,246,.2); }
.uf-gallery-item:first-child::after {
  content: 'MAIN'; position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(135deg,#1E40AF,#3B82F6); color: #fff;
  font-size: 9px; font-weight: 700; text-align: center; padding: 2px 0;
}
.uf-gallery-item.dragging { opacity: .5; border-style: dashed; }
.uf-gallery-item img {
  width: 100%; height: 100%; object-fit: cover;
}
.uf-gallery-item .uf-gallery-remove {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%; border: none;
  background: #DC2626; color: #fff; font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.uf-gallery-item:hover .uf-gallery-remove { opacity: 1; }
.uf-gallery-item .uf-gallery-remove:hover { background: #B91C1C; }

/* Unit Modal Mobile Responsive */
@media (max-width: 600px) {
  .uf-modal-overlay { padding: 8px; }
  .uf-modal-box {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 12px;
  }
  .uf-modal-header { padding: 12px 16px; }
  .uf-modal-header h3 { font-size: 15px; }
  .uf-modal-body { padding: 12px 16px; gap: 12px; }
  .uf-modal-footer { padding: 12px 16px; }
  .uf-grid-2, .uf-grid-4 { grid-template-columns: 1fr !important; }
  .uf-fieldset { padding: 12px; }
  .uf-fieldset legend { font-size: 11px; }
  .uf-field label { font-size: 11px; }
  .uf-field input, .uf-field select, .uf-field textarea { font-size: 14px; padding: 10px; }
  .uf-btn-save, .uf-btn-cancel { padding: 10px 16px; font-size: 13px; }
  .uf-feature-row { grid-template-columns: 1fr 32px; }
  .uf-feature-row textarea { grid-column: 1; }
  .uf-dropzone { padding: 16px; }
}
