/* ==========================================================================
   Store Theme & Customizer Dynamic Styles Engine
   Overrides store-specific colors, fonts, border-radii, buttons & layout variants
   ========================================================================== */

/* Store Dynamic Root Variables - Managed via Store Customizer */
.store-theme {
  --store-primary: var(--primary);
  --store-secondary: var(--secondary);
  --store-bg: var(--bg-main);
  --store-text: var(--text-main);
  --store-button-color: var(--primary);
  --store-header-bg: var(--bg-surface);
  --store-footer-bg: var(--bg-surface);
  --store-card-bg: var(--bg-card);
  --store-border-radius: 12px;
  --store-btn-shape: 10px;
  --store-font: 'Cairo', sans-serif;
}

/* Customizer Layout Choices */
/* Product Card Layouts: grid, list, cards, large, compact */
.product-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.product-grid.layout-cards {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.product-grid.layout-large {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.product-grid.layout-compact {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.product-grid.layout-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Individual Product Card Styling */
.product-card {
  background-color: var(--store-card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--store-border-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

/* Product Card List View Override */
.product-grid.layout-list .product-card {
  flex-direction: row;
  align-items: center;
}
.product-grid.layout-list .product-image-wrapper {
  width: 200px;
  height: 160px;
  flex-shrink: 0;
}
.product-grid.layout-list .product-info {
  flex: 1;
  padding: 1.25rem;
}

.product-image-wrapper {
  position: relative;
  width: 100%;
  padding-top: 80%; /* 4:3 Aspect Ratio */
  overflow: hidden;
  background-color: var(--bg-input);
}

.product-image-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

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

.product-badge-group {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  z-index: 2;
}
[dir="ltr"] .product-badge-group {
  right: auto;
  left: 0.75rem;
}

.product-info {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-category {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.product-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--store-text);
  margin-bottom: 0.5rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price-row {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  margin-top: auto;
  margin-bottom: 1rem;
}

.product-price {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--store-primary);
}

.product-old-price {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: line-through;
}

.product-actions {
  display: flex;
  gap: 0.5rem;
}

.product-actions .btn {
  border-radius: var(--store-btn-shape);
  flex: 1;
}

/* Section Wrapper ON/OFF Toggles */
.store-section {
  padding: 3.5rem 0;
  position: relative;
}
.store-section.section-hidden {
  display: none !important;
}

.section-header {
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 800;
  position: relative;
}
.section-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Hero Section Variants */
.hero-section {
  background: linear-gradient(135deg, var(--store-primary), var(--store-secondary));
  color: #ffffff;
  padding: 4.5rem 0;
  border-radius: var(--store-border-radius);
  margin-bottom: 2rem;
  overflow: hidden;
  position: relative;
}
.hero-content {
  max-width: 600px;
  z-index: 2;
  position: relative;
}
.hero-title {
  font-size: 2.75rem;
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 1rem;
  line-height: 1.2;
}
.hero-desc {
  font-size: 1.15rem;
  margin-bottom: 2rem;
  opacity: 0.9;
}

/* Banner Advertisement Sections */
.banner-ad-section {
  border-radius: var(--store-border-radius);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-md);
  margin: 2.5rem 0;
}
.banner-ad-section img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
}

/* Sponsored Tag Banner Overlay */
.sponsored-tag-float {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 5;
}
[dir="rtl"] .sponsored-tag-float {
  left: auto;
  right: 1rem;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .product-grid.layout-list .product-card {
    flex-direction: column;
  }
  .product-grid.layout-list .product-image-wrapper {
    width: 100%;
    height: auto;
  }
  .hero-title { font-size: 2rem; }
}
