/**
 * OCSAPP Marketplace - Global Styles
 * Variables, reset, layout, utilities, and common components
 * Last Updated: December 18, 2025
 */

/* ===================================
   CSS VARIABLES
   =================================== */
:root {
  /* Brand Colors */
  --primary: #00b207;
  --primary-600: #009206;
  --primary-700: #007a05;
  --dark: #1a1a1a;
  --border: #e5e5e5;

  /* Gray Scale */
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e5e5e5;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-900: #1a1a1a;

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

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 28px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 15px 50px rgba(0, 0, 0, 0.2);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Z-index Layers */
  --z-dropdown: 100;
  --z-sticky: 30;
  --z-modal: 1000;
  --z-mobile-nav: 50;
  --z-toast: 1100;
}

/* ===================================
   RESET & BASE STYLES
   =================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: Poppins, system-ui, -apple-system, sans-serif;
  color: var(--dark);
  line-height: 1.5;
  background: #fff;
  overflow-x: hidden;
}

@media (max-width: 768px) {
  body {
    padding-bottom: 70px;
  }
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
}

a {
  text-decoration: none;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

/* ===================================
   LAYOUT
   =================================== */
.page {
  margin: 0 auto;
  max-width: 1400px;
  padding: 0 5%;
  overflow: visible; /* Allow hover effects to overflow */
}

@media (max-width: 1024px) {
  .page {
    padding: 0 4%;
  }
}

@media (max-width: 768px) {
  .page {
    padding: 0 4%;
  }
}

/* ===================================
   PRODUCT CARD COMPONENT
   =================================== */
.product-card {
  background: #fff;
  border-radius: 12px;
  overflow: visible; /* Allow zoom effect to overflow */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  z-index: 1;
}

.product-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--primary);
  border-radius: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.product-card:hover {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  transform: translateY(-6px);
  z-index: 10;
}

.product-card:hover::after {
  opacity: 1;
}

.product-image {
  position: relative;
  width: 100%;
  padding-top: 100%;
  overflow: hidden;
  background: #f5f5f5;
  display: block;
  border-radius: 12px 12px 0 0; /* Rounded top corners */
}

.product-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

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

.product-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  background: #f0f0f0;
  color: #ccc;
}

.product-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.product-name {
  font-size: 15px;
  font-weight: 500;
  color: #1a1a1a;
  line-height: 1.4;
  margin: 0;
  min-height: 42px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-name a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.product-name a:hover {
  color: #00b207;
}

.product-price {
  font-size: 20px;
  font-weight: 700;
  color: #00b207;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.old-price {
  font-size: 14px;
  color: #999;
  text-decoration: line-through;
  font-weight: 400;
}

.product-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #666;
}

.product-rating .stars {
  color: #ffa500;
  font-size: 14px;
  letter-spacing: 2px;
}

.product-badges {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 60px; /* Leave space for wishlist button */
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  z-index: 10;
}

.product-badge {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  letter-spacing: 0.3px;
}

.product-badge.sale { background: #ff4444; }
.product-badge.featured { background: #ff9800; }
.product-badge.bestseller { background: #ffc107; color: #333; }
.product-badge.new { background: #00b207; }
.product-badge.organic { background: #4caf50; }
.product-badge.premium { background: #9c27b0; }
.product-badge.eco { background: #2196f3; }
.product-badge.limited { background: #f44336; }

/* Wishlist Button */
.wishlist-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.wishlist-btn:hover {
  background: #fef2f2;
  transform: scale(1.1);
}

.wishlist-btn.active i,
.wishlist-btn i.fas {
  color: #ef4444;
}

.wishlist-btn i {
  font-size: 16px;
  color: #6b7280;
}

.add-to-cart {
  width: 100%;
  padding: 12px;
  background: #00b207;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: auto;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.add-to-cart:hover {
  background: #009206;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 178, 7, 0.4);
}

.add-to-cart:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--primary);
}

.add-to-cart:active {
  transform: translateY(0);
}

/* ===================================
   CATEGORY & SHOP CARD COMPONENT
   =================================== */
.category-card,
.shop-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  height: 100%;
  position: relative;
  z-index: 1;
}

.shop-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--primary);
  border-radius: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.category-card:hover {
  transform: translateY(-6px);
  z-index: 10;
}

.shop-card:hover {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  transform: translateY(-6px);
  z-index: 10;
}

.shop-card:hover::after {
  opacity: 1;
}

.category-icon,
.shop-mall-logo {
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f5f5f5;
  overflow: hidden;
}

.category-icon img,
.shop-mall-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.category-icon-placeholder {
  font-size: 40px;
}

.category-name {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  margin: 4px 0;
}

.category-count {
  font-size: 13px;
  color: #666;
}

.shop-mall-description {
  font-size: 13px;
  color: #666;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.shop-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: auto;
}

/* ===================================
   UTILITIES
   =================================== */
.loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ===================================
   ANIMATIONS
   =================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
