/**
 * Purpilo Premium Design System
 * Unified, modern, fast-feeling UI layer
 * Applied on top of existing styles for consistency
 */

/* ===== ENHANCED DESIGN TOKENS ===== */
:root {
  /* Refined palette - more sophisticated */
  --brand-purple: #564593;
  --brand-purple-soft: #7c6bb5;
  --brand-purple-deep: #3d2f6b;
  --brand-yellow: #f0e654;
  --brand-green: #5cc07d;
  --brand-blue: #6bb8d4;
  
  /* Neutral refinement */
  --surface-primary: #ffffff;
  --surface-secondary: #f9fafb;
  --surface-tertiary: #f3f4f6;
  --border-light: #e5e7eb;
  --border-medium: #d1d5db;
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-tertiary: #9ca3af;
  
  /* Premium shadows (more depth, less spread) */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-card: 0 2px 8px rgba(86,69,147,0.04), 0 8px 24px rgba(86,69,147,0.06);
  --shadow-card-hover: 0 8px 30px rgba(86,69,147,0.12), 0 4px 12px rgba(86,69,147,0.06);
  --shadow-elevated: 0 20px 50px rgba(86,69,147,0.15);
  --shadow-button: 0 4px 14px rgba(86,69,147,0.2);
  
  /* Premium motion */
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

/* ===== GLOBAL REFINEMENTS ===== */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Smooth scroll */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Better focus styles */
:focus-visible {
  outline: 2px solid var(--brand-purple-soft);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Selection color */
::selection {
  background: rgba(86, 69, 147, 0.15);
  color: var(--brand-purple-deep);
}

/* ===== PREMIUM HEADER ===== */
header, .header, .site-header {
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  background: rgba(255,255,255,0.92) !important;
  border-bottom: 1px solid rgba(86,69,147,0.06);
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

/* ===== PREMIUM PRODUCT CARDS (SHOP PAGE) ===== */
.product-card, article.product-card {
  background: var(--surface-primary);
  border-radius: 16px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform var(--duration-normal) var(--ease-smooth), 
              box-shadow var(--duration-normal) var(--ease-smooth),
              border-color var(--duration-normal) var(--ease-smooth);
  display: flex;
  flex-direction: column;
  position: relative;
}

.product-card:hover, article.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(86,69,147,0.12);
}

.product-card .product-image, .product-card .product-image-link {
  display: block;
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--surface-secondary);
}

.product-card .product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-smooth);
}

.product-card:hover .product-image img {
  transform: scale(1.04);
}

.product-card .product-content {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-card .product-category {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--brand-purple-soft);
  margin-bottom: 6px;
}

.product-card .product-content h3 {
  font-family: var(--font-display, 'Poppins', sans-serif);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card .product-content h3 a {
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-fast);
}

.product-card .product-content h3 a:hover {
  color: var(--brand-purple);
}

.product-card .product-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.product-card .product-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--brand-purple);
  margin-bottom: 12px;
  font-family: var(--font-display, 'Poppins', sans-serif);
}

.product-card .product-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  background: var(--brand-purple);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-smooth);
  box-shadow: var(--shadow-button);
  margin-top: auto;
}

.product-card .product-btn:hover {
  background: var(--brand-purple-deep);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(86,69,147,0.3);
}

.product-card .product-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(86,69,147,0.2);
}

/* ===== PREMIUM GRID ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

@media (max-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
  .product-card .product-content { padding: 12px 14px 14px; }
  .product-card .product-content h3 { font-size: 13px; }
  .product-card .product-price { font-size: 16px; }
  .product-card .product-btn { padding: 10px 12px; font-size: 12px; }
}

@media (max-width: 420px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .product-card .product-content { padding: 10px 12px 12px; }
  .product-card .product-desc { display: none; }
}

/* ===== PREMIUM SECTIONS ===== */
.section-title, .shop-header h1, h2.section-heading {
  font-family: var(--font-display, 'Poppins', sans-serif);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* ===== PREMIUM PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 32px 0;
}

.pagination a, .pagination button, .pagination .page-item {
  min-width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid var(--border-light);
  background: var(--surface-primary);
  transition: all var(--duration-fast);
  cursor: pointer;
}

.pagination a:hover, .pagination button:hover {
  background: var(--surface-secondary);
  border-color: var(--brand-purple-soft);
  color: var(--brand-purple);
}

.pagination .active, .pagination a.active, .pagination .current {
  background: var(--brand-purple);
  color: white;
  border-color: var(--brand-purple);
  font-weight: 600;
}

/* ===== PREMIUM FILTERS ===== */
.filter-sidebar, .shop-filters, .filters-container {
  background: var(--surface-primary);
  border-radius: 16px;
  border: 1px solid var(--border-light);
  padding: 20px;
}

/* ===== PREMIUM SEARCH BAR ===== */
input[type="search"], input[type="text"].search-input, .search-bar input {
  border-radius: 12px;
  border: 1.5px solid var(--border-light);
  padding: 12px 16px 12px 42px;
  font-size: 14px;
  transition: all var(--duration-fast);
  background: var(--surface-primary);
}

input[type="search"]:focus, input[type="text"].search-input:focus, .search-bar input:focus {
  border-color: var(--brand-purple-soft);
  box-shadow: 0 0 0 3px rgba(86,69,147,0.08);
  outline: none;
}

/* ===== PREMIUM BUTTONS (Global) ===== */
.btn-primary, button.btn-primary, a.btn-primary {
  background: var(--brand-purple);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-smooth);
  box-shadow: var(--shadow-button);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover {
  background: var(--brand-purple-deep);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(86,69,147,0.3);
}


/* =====================================================
   PRODUCT DETAIL PAGE — Premium Redesign v3
   ===================================================== */

.product-detail {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 36px !important;
  margin: 24px 0 50px !important;
  align-items: start !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
}

/* --- GALLERY --- */
.product-gallery {
  position: sticky !important;
  top: 80px !important;
  padding: 0 !important;
}

.main-image {
  background: #fff !important;
  border-radius: 14px !important;
  border: 1px solid #eee !important;
  padding: 0 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  aspect-ratio: auto !important;
  min-height: unset !important;
  max-height: unset !important;
  overflow: hidden !important;
  box-shadow: none !important;
  position: relative !important;
}

.main-image:hover {
  box-shadow: none !important;
  border-color: #eee !important;
}

.main-image img {
  width: 100% !important;
  height: auto !important;
  min-height: unset !important;
  max-height: 450px !important;
  object-fit: contain !important;
  padding: 20px !important;
  border-radius: 0 !important;
  transform: none !important;
  transition: none !important;
}

.main-image:hover img {
  transform: none !important;
}

.product-badge {
  position: absolute !important;
  top: 12px !important;
  left: 12px !important;
  right: auto !important;
  font-weight: 700 !important;
  font-size: 12px !important;
  padding: 5px 10px !important;
  border-radius: 6px !important;
  width: auto !important;
  height: auto !important;
  box-shadow: none !important;
  animation: none !important;
  background: #ef4444 !important;
  color: #fff !important;
  border: none !important;
}

/* --- THUMBNAILS --- */
.thumbnail-list {
  display: flex !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
  padding: 12px 0 0 !important;
  overflow: visible !important;
  justify-content: flex-start !important;
}

.thumbnail {
  width: 56px !important;
  height: 56px !important;
  background: #fff !important;
  border-radius: 8px !important;
  border: 2px solid #eee !important;
  padding: 3px !important;
  cursor: pointer !important;
  transition: border-color 0.15s !important;
  box-shadow: none !important;
  transform: none !important;
}

.thumbnail:hover {
  border-color: #bbb !important;
  transform: none !important;
  box-shadow: none !important;
}

.thumbnail.active {
  border-color: #564593 !important;
  box-shadow: none !important;
}

.thumbnail img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  border-radius: 4px !important;
  max-width: none !important;
  max-height: none !important;
}

/* --- PRODUCT INFO --- */
.product-info {
  padding: 8px 24px !important;
}

.product-info .product-category {
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
  color: #7c6bb5 !important;
  margin-bottom: 6px !important;
}

.product-info h1,
.product-info .product-title {
  font-size: 1.35rem !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  color: #1f2937 !important;
  margin-bottom: 10px !important;
}

.product-info .product-rating {
  margin-bottom: 12px !important;
  font-size: 13px !important;
}

.product-info .product-rating .stars {
  color: #fbbf24 !important;
  font-size: 13px !important;
}

.product-info .product-rating .rating-count {
  font-size: 12px !important;
  color: #9ca3af !important;
}

.product-info .product-price {
  margin-bottom: 14px !important;
}

.product-info .current-price {
  font-size: 1.6rem !important;
  font-weight: 800 !important;
  color: #564593 !important;
}

.product-info .original-price {
  font-size: 0.95rem !important;
  color: #9ca3af !important;
  text-decoration: line-through !important;
  margin-left: 8px !important;
}

.product-info .product-stock {
  margin: 0 0 14px !important;
  font-size: 13px !important;
}

.product-info .product-short-description {
  margin-bottom: 16px !important;
  padding: 12px 14px !important;
  background: #f9fafb !important;
  border: 1px solid #f0f0f0 !important;
  border-radius: 10px !important;
  font-size: 13.5px !important;
  line-height: 1.6 !important;
  color: #4b5563 !important;
}

/* Gift wrapping */
.gift-wrapping-section {
  margin: 14px 0 !important;
  padding: 12px 14px !important;
  background: #f9fafb !important;
  border: 1px solid #f0f0f0 !important;
  border-radius: 10px !important;
  font-size: 13px !important;
}

.gift-wrapping-header label {
  font-size: 13px !important;
}

/* Buttons */
.product-info .product-actions {
  margin-top: 18px !important;
  display: flex !important;
  gap: 10px !important;
}

.product-info .product-actions .btn {
  padding: 13px 22px !important;
  border-radius: 10px !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
  flex: none !important;
  min-width: auto !important;
}

.product-info .product-actions .btn-primary {
  background: #564593 !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 3px 10px rgba(86,69,147,0.2) !important;
}

.product-info .product-actions .btn-primary:hover {
  background: #3d2f6b !important;
}

.product-info .product-actions .btn-secondary {
  background: #fff !important;
  color: #564593 !important;
  border: 2px solid #564593 !important;
  box-shadow: none !important;
}

.product-info .product-actions .btn-secondary:hover {
  background: #564593 !important;
  color: #fff !important;
}

.product-info button[onclick*="addToCart"],
.product-info button[onclick*="handleAddToCart"],
.product-info .btn-add-cart,
.product-info .add-to-cart-btn {
  padding: 13px 22px !important;
  background: #564593 !important;
  color: #fff !important;
  border: none !important;
  border-radius: 10px !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  box-shadow: 0 3px 10px rgba(86,69,147,0.2) !important;
  transition: background 0.2s !important;
  width: auto !important;
  flex: none !important;
}

.product-info button:hover {
  background: #3d2f6b !important;
  transform: none !important;
  box-shadow: 0 4px 14px rgba(86,69,147,0.25) !important;
}

.product-info .product-meta {
  margin: 14px 0 !important;
  padding: 10px 0 !important;
  border-top: 1px solid #f0f0f0 !important;
  font-size: 12px !important;
  color: #9ca3af !important;
}

/* --- TABS --- */
.tabs-section {
  margin: 0 auto 40px !important;
  max-width: 1320px !important;
  padding: 0 24px !important;
}

.tabs-nav {
  display: flex !important;
  gap: 0 !important;
  border-bottom: 1px solid #e5e7eb !important;
  flex-wrap: wrap !important;
  padding: 0 !important;
}

.tab-btn {
  background: none !important;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  margin-bottom: -1px !important;
  padding: 12px 18px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #9ca3af !important;
  cursor: pointer !important;
  transition: color 0.15s !important;
  box-shadow: none !important;
}

.tab-btn.active {
  color: #564593 !important;
  border-bottom-color: #564593 !important;
}

.tab-btn:hover:not(.active) {
  color: #4b5563 !important;
  background: none !important;
}

.tab-btn i { font-size: 12px !important; }

.tab-pane {
  padding: 20px 0 !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  font-size: 14px !important;
  line-height: 1.7 !important;
  color: #4b5563 !important;
}

.tab-pane h3 {
  font-size: 1rem !important;
  color: #1f2937 !important;
  margin-bottom: 10px !important;
}

/* --- SPECS TABLE --- */
.specs-table {
  width: 100%;
  border-collapse: collapse;
}
.specs-table tr { border-bottom: 1px solid #f0f0f0; }
.specs-table tr:last-child { border-bottom: none; }
.specs-table td { padding: 12px 0; font-size: 13px; }
.specs-table td:first-child { font-weight: 600; color: #1f2937; }
.specs-table td:last-child { text-align: right; color: #6b7280; }

.specs-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px solid #f0f0f0; }
.spec-tag { padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; background: #f3f4f6; color: #564593; }

/* --- RELATED PRODUCTS --- */
.related-title {
  font-size: 1.2rem !important;
  font-weight: 700 !important;
  color: #1f2937 !important;
  margin-bottom: 20px !important;
  text-align: left !important;
}

#related-products-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 16px !important;
}

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
  .product-detail {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    margin: 16px 0 30px !important;
  }
  .product-gallery { position: static !important; }
  .main-image { max-height: 350px !important; }
  .product-info h1 { font-size: 1.2rem !important; }
  .product-info .current-price { font-size: 1.4rem !important; }
  #related-products-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
  .tab-btn { padding: 10px 12px !important; font-size: 12px !important; }
  .tab-btn i { display: none !important; }
}

@media (max-width: 500px) {
  .main-image { border-radius: 10px !important; }
  .thumbnail { width: 48px !important; height: 48px !important; }
  .product-info h1 { font-size: 1.1rem !important; }
  #related-products-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
}
