/* ===========================================
   MICROSOFT FLUENT DESIGN PRODUCT CARDS v2.0
   ===========================================

   Design Principles:
   - No borders, use gradients and shadows
   - Smooth animations and micro-interactions
   - Color coding by category
   - Fluent depth system (4dp resting, 8dp hover)
   - Responsive grid: 1 col mobile, 2 col tablet, 3+ col desktop
   - Accessibility first with ARIA labels
   - Touch-friendly targets (44px minimum)
*/

/* ===== FLUENT DESIGN TOKENS ===== */
:root {
  /* Primary Colors */
  --fluent-primary-blue: #0078D4;
  --fluent-primary-blue-hover: #106EBE;
  --fluent-secondary-blue: #40E0FF;
  --fluent-accent-blue: #005A9E;

  /* Category Colors */
  --category-windows: #0078D4;
  --category-office: #D83B01;
  --category-adobe: #FF0000;
  --category-autodesk: #0696D7;
  --category-server: #0078D4;
  --category-antivirus: #107C10;

  /* Neutral Colors */
  --fluent-surface-primary: #FFFFFF;
  --fluent-surface-secondary: #F3F2F1;
  --fluent-surface-tertiary: #EDEBE9;
  --fluent-text-primary: #323130;
  --fluent-text-secondary: #605E5C;
  --fluent-text-tertiary: #8A8886;

  /* Shadow System (Fluent depth) */
  --fluent-shadow-depth-4: 0 1.6px 3.6px rgba(0, 0, 0, 0.132), 0 0.3px 0.9px rgba(0, 0, 0, 0.108);
  --fluent-shadow-depth-8: 0 3.2px 7.2px rgba(0, 0, 0, 0.132), 0 0.6px 1.8px rgba(0, 0, 0, 0.108);
  --fluent-shadow-depth-16: 0 6.4px 14.4px rgba(0, 0, 0, 0.132), 0 1.2px 3.6px rgba(0, 0, 0, 0.108);

  /* Corner Radius */
  --fluent-corner-radius: 8px;
  --fluent-corner-radius-large: 12px;

  /* Spacing Scale */
  --fluent-spacing-xs: 4px;
  --fluent-spacing-sm: 8px;
  --fluent-spacing-md: 16px;
  --fluent-spacing-lg: 24px;
  --fluent-spacing-xl: 32px;
  --fluent-spacing-xxl: 48px;

  /* Typography Scale */
  --fluent-font-size-xs: 0.75rem;    /* 12px */
  --fluent-font-size-sm: 0.875rem;   /* 14px */
  --fluent-font-size-base: 1rem;     /* 16px */
  --fluent-font-size-lg: 1.125rem;   /* 18px */
  --fluent-font-size-xl: 1.25rem;    /* 20px */
  --fluent-font-size-2xl: 1.5rem;    /* 24px */
  --fluent-font-size-3xl: 1.875rem;  /* 30px */

  /* Transitions */
  --fluent-transition-fast: 150ms cubic-bezier(0.1, 0.9, 0.2, 1);
  --fluent-transition-normal: 300ms cubic-bezier(0.1, 0.9, 0.2, 1);
  --fluent-transition-slow: 500ms cubic-bezier(0.1, 0.9, 0.2, 1);
}

/* ===== BASE CARD STRUCTURE ===== */
.fluent-product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #FFFFFF !important; /* Force white background */
  border-radius: 12px;
  box-shadow: 0 1.6px 3.6px rgba(0, 0, 0, 0.132), 0 0.3px 0.9px rgba(0, 0, 0, 0.108);
  overflow: hidden;
  cursor: pointer;
  transition: all 300ms cubic-bezier(0.1, 0.9, 0.2, 1);
  transform: translateZ(0); /* Hardware acceleration */
  will-change: transform, box-shadow;
  min-height: 380px;
  border: 1px solid transparent;
  color: #323130; /* Text color */
}

/* ===== RESPONSIVE GRID SYSTEM ===== */
.products-grid {
  display: grid;
  gap: var(--fluent-spacing-lg);
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Responsive: minimum 250px per card */
}

@media (max-width: 767px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr); /* Mobile: 2 columns for better visibility */
  }
}

@media (min-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr); /* Tablet: 2 columns */
  }
}

@media (min-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr); /* Desktop: 4 columns */
  }
}

/* ===== CARD INTERACTIONS ===== */
.fluent-product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--fluent-shadow-depth-16);
  cursor: pointer;
}

.fluent-product-card:focus-visible {
  outline: 2px solid var(--fluent-primary-blue);
  outline-offset: 2px;
}

.fluent-product-card:active {
  transform: translateY(-2px);
  box-shadow: var(--fluent-shadow-depth-8);
}

/* ===== PRODUCT IMAGE SECTION ===== */
.product-image-container {
  position: relative;
  width: 100%;
  height: 200px;
  background: var(--fluent-surface-secondary);
  overflow: hidden;
  border-radius: var(--fluent-corner-radius-large) var(--fluent-corner-radius-large) 0 0;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform var(--fluent-transition-slow);
}

.fluent-product-card:hover .product-image {
  transform: scale(1.05);
}

/* Placeholder for missing images */
.product-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--fluent-surface-secondary) 0%, var(--fluent-surface-tertiary) 100%);
  color: var(--fluent-text-tertiary);
  font-size: 3rem;
}

/* ===== CATEGORY COLOR CODING ===== */
.fluent-product-card[data-category="windows"] .product-image-container::before {
  background: linear-gradient(135deg, var(--category-windows) 0%, #40E0FF 100%);
}

.fluent-product-card[data-category="office"] .product-image-container::before {
  background: linear-gradient(135deg, var(--category-office) 0%, #F2552C 100%);
}

.fluent-product-card[data-category="adobe"] .product-image-container::before {
  background: linear-gradient(135deg, var(--category-adobe) 0%, #FF6666 100%);
}

.fluent-product-card[data-category="autodesk"] .product-image-container::before {
  background: linear-gradient(135deg, var(--category-autodesk) 0%, #4A9EFF 100%);
}

.fluent-product-card[data-category="server"] .product-image-container::before {
  background: linear-gradient(135deg, var(--category-server) 0%, #40E0FF 100%);
}

.fluent-product-card[data-category="antivirus"] .product-image-container::before {
  background: linear-gradient(135deg, var(--category-antivirus) 0%, #4ADE80 100%);
}

.product-image-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  transition: opacity var(--fluent-transition-normal);
  z-index: 1;
}

.fluent-product-card:hover .product-image-container::before {
  opacity: 0.1;
}

/* ===== BADGES AND OVERLAYS ===== */
.category-badge {
  position: absolute;
  top: var(--fluent-spacing-sm);
  left: var(--fluent-spacing-sm);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  color: var(--fluent-text-primary);
  padding: var(--fluent-spacing-xs) var(--fluent-spacing-sm);
  border-radius: calc(var(--fluent-corner-radius) / 2);
  font-size: var(--fluent-font-size-xs);
  font-weight: 600;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: var(--fluent-spacing-xs);
  box-shadow: var(--fluent-shadow-depth-4);
}

.version-badge {
  position: absolute;
  top: var(--fluent-spacing-sm);
  right: var(--fluent-spacing-sm);
  padding: var(--fluent-spacing-xs) var(--fluent-spacing-sm);
  border-radius: calc(var(--fluent-corner-radius) / 2);
  font-size: var(--fluent-font-size-xs);
  font-weight: 700;
  color: white;
  z-index: 3;
  min-width: 32px;
  text-align: center;
  box-shadow: var(--fluent-shadow-depth-4);
}

/* Stock status badge */
.stock-badge {
  position: absolute;
  bottom: var(--fluent-spacing-sm);
  left: var(--fluent-spacing-sm);
  padding: var(--fluent-spacing-xs) var(--fluent-spacing-sm);
  border-radius: calc(var(--fluent-corner-radius) / 2);
  font-size: var(--fluent-font-size-xs);
  font-weight: 600;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: var(--fluent-spacing-xs);
}

.stock-badge.in-stock {
  background: rgba(16, 124, 16, 0.9);
  color: white;
}

.stock-badge.low-stock {
  background: rgba(255, 184, 0, 0.9);
  color: white;
}

.stock-badge.out-of-stock {
  background: rgba(209, 52, 56, 0.9);
  color: white;
}

/* ===== PRODUCT BODY ===== */
.product-body {
  padding: var(--fluent-spacing-lg);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--fluent-spacing-md);
}

/* Product Title */
.product-title {
  font-size: var(--fluent-font-size-lg);
  font-weight: 600;
  color: var(--fluent-text-primary);
  line-height: 1.3;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Product Description */
.product-description {
  font-size: var(--fluent-font-size-sm);
  color: var(--fluent-text-secondary);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== FEATURE TAGS ===== */
.feature-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--fluent-spacing-xs);
}

.feature-tag {
  background: var(--fluent-surface-secondary);
  color: var(--fluent-text-secondary);
  padding: var(--fluent-spacing-xs) var(--fluent-spacing-sm);
  border-radius: calc(var(--fluent-corner-radius) / 2);
  font-size: var(--fluent-font-size-xs);
  font-weight: 500;
  transition: all var(--fluent-transition-fast);
}

.feature-tag:hover {
  background: var(--fluent-primary-blue);
  color: white;
}

/* Category-specific feature tags */
[data-category="windows"] .feature-tag.genuine {
  background: var(--category-windows);
  color: white;
}

[data-category="windows"] .feature-tag.lifetime {
  background: var(--fluent-primary-blue);
  color: white;
}

[data-category="office"] .feature-tag.apps {
  background: var(--category-office);
  color: white;
}

[data-category="office"] .feature-tag.cloud {
  background: #F2552C;
  color: white;
}

/* ===== PRODUCT VARIANTS ===== */
.product-variants {
  margin-top: auto;
}

.variants-label {
  font-size: var(--fluent-font-size-xs);
  color: var(--fluent-text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--fluent-spacing-xs);
}

.variants-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--fluent-spacing-xs);
}

.variant-option {
  background: var(--fluent-surface-tertiary);
  color: var(--fluent-text-secondary);
  padding: var(--fluent-spacing-xs) var(--fluent-spacing-sm);
  border-radius: calc(var(--fluent-corner-radius) / 2);
  font-size: var(--fluent-font-size-xs);
  font-weight: 500;
}

.variant-more {
  background: var(--fluent-surface-secondary);
  color: var(--fluent-text-tertiary);
  padding: var(--fluent-spacing-xs) var(--fluent-spacing-sm);
  border-radius: calc(var(--fluent-corner-radius) / 2);
  font-size: var(--fluent-font-size-xs);
  font-weight: 500;
}

/* ===== PRODUCT FOOTER ===== */
.product-footer {
  padding: var(--fluent-spacing-lg);
  padding-top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fluent-spacing-md);
}

/* Pricing Section */
.pricing-section {
  display: flex;
  align-items: center;
  gap: var(--fluent-spacing-md);
  flex: 1;
}

.price-container {
  display: flex;
  flex-direction: column;
  gap: var(--fluent-spacing-xs);
}

.price-main {
  font-size: var(--fluent-font-size-xl);
  font-weight: 700;
  color: var(--fluent-text-primary);
}

.price-original {
  font-size: var(--fluent-font-size-sm);
  color: var(--fluent-text-tertiary);
  text-decoration: line-through;
}

.price-discount {
  font-size: var(--fluent-font-size-xs);
  color: var(--fluent-primary-blue);
  font-weight: 600;
  text-transform: uppercase;
}

/* Rating Section */
.rating-container {
  display: flex;
  align-items: center;
  gap: var(--fluent-spacing-xs);
}

.stars {
  display: flex;
  gap: 2px;
}

.stars i {
  font-size: var(--fluent-font-size-sm);
  color: #FFB900;
}

.rating-text {
  font-size: var(--fluent-font-size-sm);
  color: var(--fluent-text-secondary);
  font-weight: 500;
}

/* Cart Icon Button */
.cart-icon-btn {
  position: absolute;
  bottom: var(--fluent-spacing-md);
  right: var(--fluent-spacing-md);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--fluent-primary-blue);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--fluent-transition-fast);
  box-shadow: var(--fluent-shadow-depth-4);
  z-index: 15;
}

.cart-icon-btn:hover {
  background: var(--fluent-primary-blue-hover);
  transform: scale(1.1);
  box-shadow: var(--fluent-shadow-depth-8);
}

.cta-button:hover {
  background: linear-gradient(135deg, var(--fluent-primary-blue-hover) 0%, var(--fluent-accent-blue) 100%);
  box-shadow: var(--fluent-shadow-depth-8);
  transform: translateY(-1px);
}

.cta-button:focus-visible {
  outline: 2px solid var(--fluent-primary-blue);
  outline-offset: 2px;
}

/* ===== REMOVED: QUICK ACTIONS OVERLAY ===== */
/* Overlay functionality removed for simpler UX */

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  .fluent-product-card,
  .product-image,
  .product-image-container::before,
  .cart-icon-btn,
  .feature-tag {
    transition: none;
  }

  .fluent-product-card:hover {
    transform: none;
  }

  .fluent-product-card:hover .product-image {
    transform: none;
  }

  .cta-button:hover {
    transform: none;
  }

  .quick-action-btn:hover {
    transform: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .fluent-product-card {
    border: 2px solid var(--fluent-text-primary);
  }

  .category-badge,
  .version-badge,
  .stock-badge {
    border: 1px solid var(--fluent-text-primary);
  }
}

/* ===== LOADING STATES ===== */
.fluent-product-card.loading {
  pointer-events: none;
}

.fluent-product-card.loading .product-image,
.fluent-product-card.loading .product-title,
.fluent-product-card.loading .product-description,
.fluent-product-card.loading .price-main {
  background: linear-gradient(90deg, var(--fluent-surface-tertiary) 25%, var(--fluent-surface-secondary) 50%, var(--fluent-surface-tertiary) 75%);
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ===== DARK MODE SUPPORT ===== */
/* Temporarily disabled dark theme to fix black cards issue */
/* @media (prefers-color-scheme: dark) {
  :root {
    --fluent-surface-primary: #1F1F1F;
    --fluent-surface-secondary: #2D2D2D;
    --fluent-surface-tertiary: #3A3A3A;
    --fluent-text-primary: #FFFFFF;
    --fluent-text-secondary: #CCCCCC;
    --fluent-text-tertiary: #999999;
  }
} */

/* ===== CATEGORY COLOR CODING ===== */
/* Apply category-specific background gradients */
.fluent-product-card[data-category="windows"] .product-image-container::before {
  background: linear-gradient(135deg, var(--category-windows) 0%, #40E0FF 100%);
}

.fluent-product-card[data-category="office"] .product-image-container::before {
  background: linear-gradient(135deg, var(--category-office) 0%, #F2552C 100%);
}

.fluent-product-card[data-category="adobe"] .product-image-container::before {
  background: linear-gradient(135deg, var(--category-adobe) 0%, #FF6666 100%);
}

.fluent-product-card[data-category="autodesk"] .product-image-container::before {
  background: linear-gradient(135deg, var(--category-autodesk) 0%, #4A9EFF 100%);
}

.fluent-product-card[data-category="server"] .product-image-container::before {
  background: linear-gradient(135deg, var(--category-server) 0%, #40E0FF 100%);
}

.fluent-product-card[data-category="antivirus"] .product-image-container::before {
  background: linear-gradient(135deg, var(--category-antivirus) 0%, #4ADE80 100%);
}

/* Category badge colors */
.category-badge.category-windows {
  background: rgba(0, 120, 212, 0.9);
  color: white;
}

.category-badge.category-office {
  background: rgba(216, 59, 1, 0.9);
  color: white;
}

.category-badge.category-adobe {
  background: rgba(255, 0, 0, 0.9);
  color: white;
}

.category-badge.category-autodesk {
  background: rgba(6, 150, 215, 0.9);
  color: white;
}

.category-badge.category-server {
  background: rgba(0, 120, 212, 0.9);
  color: white;
}

.category-badge.category-antivirus {
  background: rgba(16, 124, 16, 0.9);
  color: white;
}

/* ===== BACKWARD COMPATIBILITY ===== */
/* Legacy support for old card classes - using CSS inheritance */
.product-card:not(.fluent-product-card),
.modern-card,
.product-card-windows,
.product-card-office,
.product-card-adobe,
.product-card-autodesk,
.product-card-server,
.product-card-antivirus {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--fluent-surface-primary);
  border-radius: var(--fluent-corner-radius-large);
  box-shadow: var(--fluent-shadow-depth-4);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--fluent-transition-normal);
  transform: translateZ(0);
  will-change: transform, box-shadow;
  min-height: 380px;
  border: 1px solid transparent;
}

/* ===== PRINT STYLES ===== */
@media print {
  .fluent-product-card,
  .product-card {
    box-shadow: none;
    border: 1px solid #000;
    break-inside: avoid;
  }
}
