/* =====================================================
   PRAKASH SWEETS — Product Detail Page Styles
   Requires css/style.css to be loaded first (design tokens)
   ===================================================== */

/* ===== 1. BREADCRUMB ===== */
.breadcrumb {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 24px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--text-light);
  transition: color var(--transition);
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb-sep {
  color: var(--border);
}

.breadcrumb-current {
  color: var(--text);
  font-weight: 500;
}

/* ===== 2. PRODUCT DETAIL LAYOUT ===== */
.product-detail-section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 16px 24px 56px;
}

.product-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 52px;
  align-items: start;
}

/* ===== 3. IMAGE PANEL ===== */
.pd-gallery {
  position: sticky;
  top: calc(var(--header-h) + 20px);
}

.pd-image-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  background: #f9f5f0;
  aspect-ratio: 1 / 1;
  box-shadow: var(--shadow-card);
  cursor: default;
  position: relative;
  transition: aspect-ratio .3s ease, max-height .3s ease;
}

.pd-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s ease;
}

/* Zoom hint icon — hidden while zoom is disabled */
.pd-zoom-hint {
  display: none;
}

/* Zoomed-in state — container keeps size, scaled image overflows and scrolls */
.pd-image-wrap.zoomed {
  cursor: zoom-out;
  overflow: scroll;
  -webkit-overflow-scrolling: touch;
  z-index: 10;
  touch-action: none;
}
.pd-image-wrap.zoomed img {
  transform-origin: 0 0;
  will-change: transform;
}
.pd-image-wrap.zoomed .pd-zoom-hint { display: none; }

/* Thumbnail strip */
.pd-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.pd-thumb {
  flex: 0 0 68px;
  width: 68px;
  height: 68px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  background: #f9f5f0;
  padding: 0;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

.pd-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pd-thumb:hover {
  border-color: var(--accent);
}

.pd-thumb.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(181, 101, 29, 0.25);
}

/* ===== 4. INFO PANEL ===== */
.pd-info {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Category tag */
.pd-category-tag {
  display: inline-block;
  background: rgba(245, 197, 24, 0.18);
  color: #7a5200;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  width: fit-content;
}

/* Product name */
.pd-name {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  margin: 0;
}

/* Price block */
.pd-price-block {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.pd-price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.pd-price-original {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: line-through;
}

.pd-discount-badge {
  background: #fff0f0;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(200, 16, 46, 0.2);
}

.pd-tax-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== VARIATION SELECTOR ===== */
.pd-variation-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.pd-variation-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  min-width: 70px;
}

.pd-variation-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pd-variation-chip {
  padding: 8px 22px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text);
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  outline: none;
  transition: border-color .2s, background .2s, color .2s, box-shadow .2s;
}

.pd-variation-chip:hover {
  border-color: var(--accent);
  background: #fdf8f0;
}

.pd-variation-chip.active {
  border-color: var(--primary);
  color: var(--primary);
  background: #fff0f0;
  box-shadow: 0 0 0 2px rgba(200, 16, 46, 0.12);
}

/* Stock badge */
.pd-stock-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  width: fit-content;
}

.pd-stock-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.pd-stock-badge.in-stock {
  background: #e8f5e9;
  color: #2e7d32;
}

.pd-stock-badge.out-stock {
  background: #fce4ec;
  color: #c62828;
}

/* Meta table */
.pd-meta-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}

.pd-meta-row {
  display: flex;
  gap: 16px;
  font-size: 0.875rem;
  align-items: baseline;
}

.pd-meta-label {
  color: var(--text-muted);
  min-width: 100px;
  flex-shrink: 0;
}

.pd-meta-value {
  color: var(--text);
  font-weight: 500;
}

/* Short description summary (above qty stepper) */
.pd-short-desc {
  font-size: 0.925rem;
  color: var(--text-light);
  line-height: 1.75;
  margin: 0;
}

.pd-short-desc:empty {
  display: none;
}

/* ===== 5. QUANTITY STEPPER ===== */
.pd-qty-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.pd-qty-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  min-width: 70px;
}

.qty-stepper {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  width: fit-content;
}

.qty-btn {
  width: 42px;
  height: 42px;
  background: #fff;
  color: var(--primary);
  font-size: 1.3rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
  border: none;
  cursor: pointer;
  line-height: 1;
  padding-bottom: 2px;
  /* optical centre for − */
  font-family: var(--font);
}

.qty-btn:hover:not(:disabled) {
  background: #fdf0f3;
}

.qty-btn:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

#pd-qty-input {
  width: 54px;
  text-align: center;
  border: none;
  border-left: 1.5px solid var(--border);
  border-right: 1.5px solid var(--border);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  outline: none;
  padding: 10px 4px;
  background: #fff;
  font-family: var(--font);
  -moz-appearance: textfield;
}

#pd-qty-input::-webkit-inner-spin-button,
#pd-qty-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

/* ===== 6. ACTION BUTTONS ===== */
.pd-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-add-cart {
  width: 100%;
  background: #fff;
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: var(--radius-pill);
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  font-family: var(--font);
}

.btn-add-cart:hover:not(:disabled) {
  background: #fdf0f3;
}

.btn-buy-now {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: 2px solid var(--primary);
  border-radius: var(--radius-pill);
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  font-family: var(--font);
}

.btn-buy-now:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: scale(1.02);
}

.btn-add-cart:disabled,
.btn-buy-now:disabled {
  background: #e8e4e0;
  border-color: #e8e4e0;
  color: #999;
  cursor: not-allowed;
  transform: none;
}

/* ===== 7. DESCRIPTION TABS ===== */
.pd-tabs-section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px 56px;
  border-top: 1px solid var(--border);
  padding-top: 32px;
}

.pd-tabs-header {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.pd-tab-btn {
  padding: 12px 28px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  background: none;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  font-family: var(--font);
}

.pd-tab-btn:hover {
  color: var(--text-light);
}

.pd-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.pd-tab-panel {
  display: none;
}

.pd-tab-panel.active {
  display: block;
  font-size: 0.925rem;
  color: var(--text-light);
  line-height: 1.85;
  white-space: pre-wrap;
}

.pd-tab-panel ul {
  list-style: disc;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pd-tab-panel li {
  font-size: 0.9rem;
  color: var(--text-light);
}

/* ===== 8. SIMILAR PRODUCTS ===== */
.similar-section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px 72px;
}

.similar-section h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
}

.similar-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  padding-bottom: 8px;
}

.similar-scroll-wrap::-webkit-scrollbar {
  height: 5px;
}

.similar-scroll-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.similar-scroll-wrap::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.similar-cards-row {
  display: flex;
  gap: 16px;
}

/* Similar product cards — fixed width for horizontal scroll */
.similar-cards-row .product-card {
  flex: 0 0 220px;
  width: 220px;
  /* Override mobile stacking — cards in similar row always stay vertical */
  flex-direction: column !important;
  max-height: none !important;
}

.similar-cards-row .product-card .card-image-wrap {
  width: 100% !important;
  min-width: unset !important;
  height: auto !important;
  aspect-ratio: 1 / 1 !important;
  border-radius: var(--radius) var(--radius) 0 0 !important;
}

.similar-cards-row .product-card .card-body {
  padding: 12px 14px 14px !important;
}

.similar-cards-row .product-card .product-desc {
  display: block !important;
  /* override mobile hidden */
  -webkit-line-clamp: 2;
  display: -webkit-box !important;
}

/* ===== 9. ERROR / LOADING STATES ===== */
.pd-error-state {
  text-align: center;
  padding: 100px 24px;
  color: var(--text-muted);
}

.pd-error-state svg {
  margin: 0 auto 20px;
}

.pd-error-state h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 12px;
}

.pd-error-state p {
  font-size: 0.95rem;
  line-height: 1.7;
}

.pd-error-state a {
  color: var(--primary);
  font-weight: 600;
}

/* Skeleton loader */
.pd-loading-state {
  padding: 0;
}

@keyframes pk-shimmer {
  0%   { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}
.pd-loading-state .pk-skel {
  background: linear-gradient(90deg, #f0e8d8 25%, #f8f0e4 50%, #f0e8d8 75%);
  background-size: 200px 100%;
  animation: pk-shimmer 1.2s ease-in-out infinite;
  border-radius: 8px;
}
.pk-skel-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 52px;
  align-items: start;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px;
}
.pk-skel-detail-img {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
}
.pk-skel-detail-info {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 8px;
}
.pk-skel-detail-info .pk-skel-text {
  height: 14px;
}
.pk-skel-title {
  height: 28px;
  width: 60%;
}
.pk-skel-btn {
  height: 48px;
  width: 200px;
  border-radius: var(--radius);
}

/* ===== 10. RESPONSIVE — TABLET ===== */
@media (max-width: 1024px) {
  .product-detail-grid {
    gap: 36px;
  }

  .pk-skel-detail {
    gap: 36px;
  }

  .pd-gallery {
    position: static;
  }

  .pd-name {
    font-size: 1.5rem;
  }

  .similar-cards-row .product-card {
    flex: 0 0 200px;
    width: 200px;
  }
}

/* ===== 11. RESPONSIVE — MOBILE ===== */
@media (max-width: 768px) {
  .product-detail-section {
    padding: 12px 16px 40px;
  }

  .product-detail-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .pk-skel-detail {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 16px;
  }

  .pd-gallery {
    position: static;
  }

  .pd-image-wrap {
    border-radius: var(--radius-sm);
    max-height: 340px;
    aspect-ratio: 4 / 3;
  }

  .pd-image-wrap img {
    max-height: 340px;
  }


  .pd-name {
    font-size: 1.3rem;
  }

  .pd-price {
    font-size: 1.6rem;
  }

  .pd-tabs-section {
    padding: 28px 16px 40px;
  }

  .similar-section {
    padding: 0 16px 56px;
  }

  .breadcrumb {
    padding: 10px 16px 6px;
  }

  .similar-cards-row .product-card {
    flex: 0 0 160px;
    width: 160px;
  }

  .pd-qty-row {
    gap: 12px;
  }

  .qty-btn {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }

  #pd-qty-input {
    width: 48px;
  }
}

/* ===== 12. IMAGE SWIPE DOTS (MOBILE) ===== */
.pd-dots { display: none; }
@media (max-width: 768px) {
  .pd-dots {
    display: flex;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    gap: 7px;
    z-index: 5;
  }
  .pd-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,.5);
    border: 1px solid rgba(0,0,0,.15);
    transition: background .2s;
  }
  .pd-dot.active {
    background: var(--accent, #b5651d);
  }
}

/* ===== 13. STICKY ADD-TO-CART BAR (MOBILE) ===== */
#pd-sticky-bar {
  display: none;
}
@media (max-width: 768px) {
  #pd-sticky-bar {
    position: fixed;
    bottom: 64px;
    left: 0;
    right: 0;
    z-index: 3002;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,.1);
    padding: 10px 16px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  #pd-sticky-bar.pd-sticky-visible {
    display: flex;
  }
  #pd-sticky-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #pd-sticky-price .pd-price-original {
    font-size: .85rem;
    font-weight: 400;
    color: #999;
    text-decoration: line-through;
    margin-left: 6px;
  }
  #pd-sticky-cart {
    flex-shrink: 0;
    padding: 10px 22px;
    background: var(--pk-red, #B40228);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
  }
  #pd-sticky-cart:active {
    opacity: .85;
  }
}

/* Handle "Desktop site" mode on touch devices */
@media (hover: none) and (pointer: coarse) and (max-width: 1100px) {
  .product-detail-section {
    padding: 12px 16px 40px;
  }

  .product-detail-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .pk-skel-detail {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 16px;
  }

  .pd-gallery {
    position: static;
  }

  .pd-image-wrap {
    border-radius: var(--radius-sm);
    max-height: 340px;
    aspect-ratio: 4 / 3;
  }

  .pd-image-wrap img {
    max-height: 340px;
  }

  .pd-name {
    font-size: 1.3rem;
  }

  .pd-price {
    font-size: 1.6rem;
  }

  .pd-tabs-section {
    padding: 28px 16px 40px;
  }

  .similar-section {
    padding: 0 16px 56px;
  }

  .breadcrumb {
    padding: 10px 16px 6px;
  }

  .similar-cards-row .product-card {
    flex: 0 0 160px;
    width: 160px;
  }

  .pd-qty-row {
    gap: 12px;
  }

  .qty-btn {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }

  #pd-qty-input {
    width: 48px;
  }

  .pd-dots {
    display: flex;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    gap: 7px;
    z-index: 5;
  }

  #pd-sticky-bar {
    position: fixed;
    bottom: 64px;
    left: 0;
    right: 0;
    z-index: 3002;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,.1);
    padding: 10px 16px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  #pd-sticky-bar.pd-sticky-visible {
    display: flex;
  }

  #pd-sticky-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #pd-sticky-price .pd-price-original {
    font-size: .85rem;
    font-weight: 400;
    color: #999;
    text-decoration: line-through;
    margin-left: 6px;
  }

  #pd-sticky-cart {
    flex-shrink: 0;
    padding: 10px 22px;
    background: var(--pk-red, #B40228);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
  }

  #pd-sticky-cart:active {
    opacity: .85;
  }
}
