/* ============================================
   assets/css/product.css
   نسخه نهایی - ترکیبی از هر دو استایل
   ============================================ */

:root {
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --primary-light: #a855f7;
  --primary-bg: #faf5ff;
  --success: #22c55e;
  --danger: #ef4444;
  --orange: #f97316;
  --blue: #3b82f6;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset */
.product-page *,
.product-page *::before,
.product-page *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.product-page {
  min-height: 70vh;
  padding: 40px 0 60px;
  background: #ffffff;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  line-height: 1.6;
}

.product-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-500);
  padding: 16px 0;
}

.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.breadcrumb a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.breadcrumb .sep {
  color: var(--gray-300);
  font-size: 11px;
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
  margin-bottom: 48px;
}

/* Gallery */
.product-gallery {
  position: sticky;
  top: 20px;
}

.gallery-main-wrapper {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-md);
  width: 100%;
  aspect-ratio: 1/1;
  max-height: 500px;
}

#galleryMain {
  width: 100%;
  height: 100%;
}

#galleryMain img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 20px;
  background: var(--gray-50);
  transition: var(--transition);
}

#galleryMain img:hover {
  transform: scale(1.02);
}

#galleryMain .video-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
}

#galleryMain .video-container iframe,
#galleryMain .video-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.gallery-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--danger);
  color: #fff;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 700;
  z-index: 10;
}

.gallery-thumbs {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  overflow-x: auto;
  padding: 4px 0 8px;
  scrollbar-width: thin;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.gallery-thumbs::-webkit-scrollbar {
  height: 4px;
}

.gallery-thumbs::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

.gallery-thumb {
  width: 72px;
  height: 72px;
  min-width: 72px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  cursor: pointer;
  border: 2px solid var(--gray-200);
  transition: var(--transition);
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  scroll-snap-align: start;
}

.gallery-thumb:hover,
.gallery-thumb.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-bg);
}

/* Product Info */
.product-info {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.product-title {
  font-size: 28px;
  font-weight: 900;
  line-height: 1.4;
  color: var(--gray-900);
  margin: 0;
}

/* Price Box */
.price-box {
  background: var(--primary-bg);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid rgba(124, 58, 237, 0.08);
  transition: var(--transition);
}

.price-regular {
  font-size: 16px;
  color: var(--gray-400);
  text-decoration: line-through;
}

.price-sale {
  font-size: 34px;
  font-weight: 900;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.price-normal {
  font-size: 34px;
  font-weight: 900;
  color: var(--primary);
}

.price-free {
  font-size: 34px;
  font-weight: 900;
  color: var(--success);
}

.price-discount-badge {
  display: inline-block;
  background: var(--danger);
  color: white;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 700;
}

/* Variations */
.variations-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.variation-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-700);
}

.variation-items {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.variation-item {
  padding: 12px 18px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  transition: var(--transition);
  background: white;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  position: relative;
}

.variation-item:hover {
  border-color: var(--primary-light);
  background: var(--primary-bg);
  transform: translateY(-2px);
}

.variation-item.active {
  border-color: var(--primary);
  background: var(--primary-bg);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
}

.variation-item .check {
  display: none;
  color: var(--primary);
  font-weight: 900;
  font-size: 16px;
}

.variation-item.active .check {
  display: inline;
}

/* Stock & Delivery */
.stock-delivery {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
  font-size: 13px;
  color: var(--gray-600);
}

.in-stock {
  color: var(--success);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.in-stock::before {
  content: '●';
  font-size: 8px;
}

/* Short Description */
.short-desc {
  color: var(--gray-600);
  line-height: 2;
  font-size: 14px;
  padding: 16px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-100);
}

/* Add to Cart */
.add-to-cart-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 900;
  font-size: 18px;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}

.add-to-cart-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.45);
}

.add-to-cart-btn:active {
  transform: translateY(0);
}

/* Download Section */
.download-section {
  margin-top: 24px;
  padding: 24px;
  background: linear-gradient(135deg, #f0fdf4, #eff6ff);
  border-radius: var(--radius);
  border: 2px solid var(--gray-200);
}

.download-section .section-title {
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 16px;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 8px;
}

.download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 20px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: var(--transition);
  border: none;
  margin-bottom: 10px;
  text-align: center;
  flex-wrap: wrap;
}

.download-btn-trial {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.download-btn-trial:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

.locked-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: var(--gray-50);
  border: 2px dashed var(--gray-200);
  border-radius: 12px;
  color: var(--gray-400);
  font-weight: 700;
  font-size: 14px;
  text-align: center;
}

/* Related Products */
.related-section {
  margin-top: 48px;
  padding-top: 40px;
  border-top: 1px solid var(--gray-200);
}

.related-title {
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 20px;
  color: var(--gray-900);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.related-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  border: 1px solid var(--gray-200);
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
  display: block;
}

.related-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.related-card img {
  width: 100%;
  height: 160px;
  object-fit: contain;
  border-radius: 12px;
  background: var(--gray-50);
}

.related-card h4 {
  font-size: 14px;
  font-weight: 700;
  margin: 12px 0 6px;
  color: var(--gray-800);
}

.related-card .price {
  font-weight: 700;
  color: var(--primary);
  font-size: 16px;
}

.related-card .old-price {
  color: var(--gray-400);
  text-decoration: line-through;
  font-size: 13px;
  margin-right: 6px;
}

/* Full Description */
.full-desc-section {
  margin-top: 48px;
  background: #fff;
  border-radius: var(--radius);
  padding: 32px;
  border: 1px solid var(--gray-200);
}

.full-desc-title {
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 20px;
  color: var(--gray-800);
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary);
}

.full-desc-content {
  line-height: 2.2;
  color: var(--gray-800);
  font-size: 15px;
}

.full-desc-content h1,
.full-desc-content h2,
.full-desc-content h3 {
  font-weight: 800;
  margin: 16px 0 8px;
}

.full-desc-content p {
  margin-bottom: 12px;
}

.full-desc-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 10px 0;
}

.full-desc-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.full-desc-content table td,
.full-desc-content table th {
  border: 1px solid var(--gray-200);
  padding: 8px 12px;
  text-align: right;
}

/* Videos */
.product-videos-section {
  margin-top: 48px;
}

.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.video-card {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--gray-200);
  transition: var(--transition);
}

.video-card:hover {
  box-shadow: var(--shadow-lg);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-800);
  color: white;
  padding: 14px 28px;
  border-radius: 14px;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-size: 14px;
  font-weight: 700;
  z-index: 9999;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
  text-align: center;
  max-width: 90%;
}

.toast-success {
  background: var(--success);
}

.toast-error {
  background: var(--danger);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Responsive */
@media (max-width: 992px) {
  .product-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .product-gallery {
    position: static;
  }
  .product-title {
    font-size: 24px;
  }
}

@media (max-width: 640px) {
  .product-page {
    padding: 20px 0 40px;
  }
  .product-container {
    padding: 0 16px;
  }
  .product-grid {
    gap: 24px;
  }
  .product-title {
    font-size: 20px;
  }
  .price-sale,
  .price-normal,
  .price-free {
    font-size: 26px;
  }
  .gallery-thumb {
    width: 56px;
    height: 56px;
    min-width: 56px;
  }
  .add-to-cart-btn {
    font-size: 16px;
    padding: 14px;
  }
  .related-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  .variation-items {
    flex-direction: column;
  }
  .variation-item {
    justify-content: space-between;
  }
}

@media (max-width: 480px) {
  .product-container {
    padding: 0 12px;
  }
  .related-grid {
    grid-template-columns: 1fr;
  }
  .gallery-thumb {
    width: 50px;
    height: 50px;
    min-width: 50px;
  }
}