/* Professional Animations & Polish */
:root {
  --orange: #ff9900;
  --orange-dark: #e68a00;
  --orange-light: #fff8f0;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --transition: 0.2s ease;
}

/* Button animations */
.btn, .add-btn, .checkout-btn, .auth-btn, .save-btn, button[type="submit"] {
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.btn:hover, .add-btn:hover, .checkout-btn:hover, .auth-btn:hover, .save-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(255,153,0,0.3);
}
.btn:active, .add-btn:active, .checkout-btn:active {
  transform: translateY(0) scale(0.98);
}

/* Product card hover */
.product-card {
  transition: transform var(--transition), box-shadow var(--transition);
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

/* Cart card animation */
.cart-card {
  animation: slideIn 0.3s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Category chip animation */
.cat-chip {
  transition: background var(--transition), color var(--transition), transform var(--transition);
}
.cat-chip:hover {
  transform: scale(1.05);
}
.cat-chip:active {
  transform: scale(0.95);
}

/* Page fade in */
body > *:not(script) {
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Loading pulse */
.loading {
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Success check animation */
.success-check {
  animation: popIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
@keyframes popIn {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

/* Mobile touch feedback */
@media (hover: none) {
  .btn:active, .add-btn:active, .cat-chip:active {
    background: var(--orange);
    color: #fff;
  }
}

/* Responsive grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  padding: 16px;
}
@media (min-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 24px;
  }
}
@media (min-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

/* Image container */
.product-img {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}
.product-img img {
  max-width: 85%;
  max-height: 85%;
  object-fit: contain;
  transition: transform 0.3s ease;
}
.product-card:hover .product-img img {
  transform: scale(1.05);
}

/* Header polish */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Smooth scroll */
html { scroll-behavior: smooth; }

/* Focus states for accessibility */
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* RTL/LTR transitions */
body { transition: none; }
body.ltr { direction: ltr; text-align: left; }
body:not(.ltr) { direction: rtl; text-align: right; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Image fade-in when loaded */
img {
  opacity: 1;
  transition: opacity 0.3s ease;
}
img[loading="lazy"] {
  opacity: 0;
}
img[loading="lazy"].loaded, img.loaded {
  opacity: 1;
}
