/* =========================================
   GhSell Ultimate Product Detail Styles
   "Premium, Clean, Conversion-Focused"
   ========================================= */

:root {
  /* Brand Colors */
  --primary: #DC2626;       /* GhSell Red */
  --primary-dark: #B91C1C;
  --primary-light: #FEE2E2;

  /* Neutral Colors */
  --bg-body: #F9FAFB;       /* Light Gray Background */
  --bg-card: #FFFFFF;
  --text-main: #111827;     /* Almost Black */
  --text-muted: #6B7280;    /* Gray Text */
  --border: #E5E7EB;        /* Light Border */

  /* Functional Colors */
  --success: #059669;
  --warning: #D97706;
  --danger: #DC2626;
  --star: #FBBF24;

  /* Spacing & Layout */
  --container-width: 1280px;
  --header-height: 70px;
  --radius: 12px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-sticky: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* =========================================
   Base & Layout
   ========================================= */
body {
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.pd-container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1rem;
}

.pd-grid {
  display: grid;
  gap: 2rem;
  margin-top: 1.5rem;
}

/* Desktop Grid: Gallery | Info | BuyBox */
@media (min-width: 1024px) {
  .pd-grid {
    grid-template-columns: 1.2fr 1.5fr 0.8fr; /* 3-Column Layout */
    align-items: start;
  }
}

/* =========================================
   1. Product Gallery (Left Column)
   ========================================= */
.pd-gallery {
  position: relative;
}

.pd-main-image-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  aspect-ratio: 1; /* Square aspect ratio */
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.pd-main-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.pd-main-image-wrapper:hover .pd-main-image {
  transform: scale(1.05); /* Subtle zoom on hover */
}

.pd-thumbnails {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
}

.pd-thumb {
  width: 70px;
  height: 70px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  object-fit: cover;
  background: var(--bg-card);
  transition: all 0.2s;
}

.pd-thumb.active,
.pd-thumb:hover {
  border-color: var(--primary);
}

/* Badges */
.pd-badge-container {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 10;
}

.pd-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pd-badge-new { background: var(--success); color: white; }
.pd-badge-sale { background: var(--primary); color: white; }

/* =========================================
   2. Product Info (Center Column)
   ========================================= */
.pd-info {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.pd-brand {
  font-size: 0.875rem;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pd-title {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
  margin: 0;
}

.pd-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
}

.pd-rating {
  color: var(--star);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.pd-rating-count {
  color: var(--text-muted);
  text-decoration: underline;
  cursor: pointer;
}

.pd-price-mobile {
  display: none; /* Hidden on desktop, shown on mobile */
}

/* Variations */
.pd-variation-group {
  margin-top: 0.5rem;
}

.pd-variation-label {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: block;
}

.pd-variation-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.pd-option-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.pd-option-btn:hover {
  border-color: var(--text-muted);
}

.pd-option-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}

/* Short Description / Specs */
.pd-short-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.pd-key-specs {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.pd-spec-item {
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}

.pd-spec-icon {
  color: var(--text-muted);
  width: 16px;
}

/* =========================================
   3. Buy Box (Right Column - Sticky)
   ========================================= */
.pd-buy-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: calc(var(--header-height) + 1rem);
}

.pd-price-wrapper {
  margin-bottom: 1.5rem;
}

.pd-current-price {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
}

.pd-old-price {
  font-size: 1rem;
  color: var(--text-muted);
  text-decoration: line-through;
  margin-left: 0.5rem;
}

.pd-discount-tag {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  vertical-align: text-top;
  margin-left: 0.5rem;
}

.pd-stock-status {
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pd-stock-in { color: var(--success); }
.pd-stock-low { color: var(--warning); }
.pd-stock-out { color: var(--danger); }

/* Quantity */
.pd-qty-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.pd-qty-controls {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.pd-qty-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-main);
}

.pd-qty-btn:hover { background: var(--bg-body); }

.pd-qty-input {
  width: 40px;
  text-align: center;
  border: none;
  font-weight: 600;
  -moz-appearance: textfield;
}

/* Actions */
.pd-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pd-btn {
  width: 100%;
  padding: 0.875rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
}

.pd-btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 6px rgba(220, 38, 38, 0.2);
}

.pd-btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.pd-btn-secondary {
  background: white;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.pd-btn-secondary:hover {
  background: var(--primary-light);
}

.pd-btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 0.875rem;
}

.pd-btn-outline:hover {
  border-color: var(--text-muted);
  background: var(--bg-body);
}

/* Trust Badges */
.pd-trust {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 1rem;
}

.pd-trust-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pd-trust-icon {
  color: var(--primary);
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

/* =========================================
   4. Content Tabs (Description, Reviews)
   ========================================= */
.pd-tabs-section {
  margin-top: 3rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.pd-tabs-nav {
  display: flex;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.pd-tab-btn {
  padding: 1rem 1.5rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

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

.pd-tab-content {
  padding: 2rem;
  display: none;
}

.pd-tab-content.active {
  display: block;
}

/* =========================================
   5. Mobile Sticky Bar
   ========================================= */
.pd-mobile-bar {
  display: none; /* Hidden on desktop */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-sticky);
  z-index: 100;
  border-top: 1px solid var(--border);
  align-items: center;
  gap: 1rem;
}

/* =========================================
   Responsive Adjustments
   ========================================= */
@media (max-width: 1023px) {
  .pd-buy-box {
    display: none; /* Hide desktop buy box on mobile/tablet */
  }

  .pd-price-mobile {
    display: block; /* Show price in info section */
    margin-bottom: 1rem;
  }

  .pd-mobile-bar {
    display: flex; /* Show sticky bar */
  }

  /* Add padding to bottom of body so sticky bar doesn't cover content */
  body {
    padding-bottom: 80px;
  }
}

@media (max-width: 768px) {
  .pd-title { font-size: 1.5rem; }
  
  /* Full Width Mobile Hero */
  .pd-gallery {
    margin-left: -1rem;
    margin-right: -1rem;
  }
  
  .pd-main-image-wrapper {
    border-radius: 0;
    border-left: none;
    border-right: none;
    aspect-ratio: unset;
    height: 35vh; /* Drastically reduced height */
    min-height: 250px;
    max-height: 400px;
    background: white;
  }
  
  .pd-tab-content { padding: 1.5rem; }
}
