/* ================================
   DESIGN SYSTEM & CUSTOM STYLES
   ================================ */

:root {
  /* Refined color palette */
  --primary: #27AE60;
  --primary-dark: #1E8449;
  --primary-light: #52BE80;
  --primary-glow: rgba(39, 174, 96, 0.25);
  --secondary: #E67E22;
  --secondary-dark: #D35400;
  --accent: #3498DB;
  --accent-dark: #2980B9;
  --dark: #1a2634;
  --dark-soft: #2C3E50;
  --light: #F5F7FA;
  --light-soft: #ECF0F1;
  --danger: #E74C3C;
  --danger-dark: #C0392B;
  --success: #27AE60;
  --warning: #F39C12;
  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;

  /* Glass */
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.10);
  --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px var(--primary-glow);
}

/* Typography refinements */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  letter-spacing: -0.01em;
}

h1 { letter-spacing: -0.02em; }
h2 { letter-spacing: -0.015em; }

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

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

/* Selection styling */
::selection {
  background-color: var(--primary);
  color: white;
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Print styles */
@media print {
  body {
    background-color: white;
  }
  .no-print {
    display: none;
  }
}

/* ================================
   CARD REDESIGN
   ================================ */

.card {
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--gray-100);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: var(--gray-200);
}

.product-card {
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--gray-100);
  overflow: hidden;
  position: relative;
}

.product-card:hover {
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(39, 174, 96, 0.15);
  transform: translateY(-6px);
  border-color: rgba(39, 174, 96, 0.2);
}

.product-card .product-image img {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ================================
   BUTTON REDESIGN
   ================================ */

.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px rgba(39, 174, 96, 0.3);
  overflow: hidden;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

.btn-primary:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-secondary:hover {
  background: rgba(52, 152, 219, 0.08);
  transform: translateY(-2px);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--danger), var(--danger-dark));
  color: white;
  border: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 14px rgba(231, 76, 60, 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.btn-small {
  padding: 0.4rem 1rem;
  font-size: 0.75rem;
  border-radius: 8px;
}

.btn-large {
  padding: 1rem 2.5rem;
  font-size: 1rem;
  border-radius: 12px;
}

/* ================================
   BADGE & TAG REDESIGN
   ================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  line-height: 1;
}

.badge-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

.badge-danger {
  background: linear-gradient(135deg, var(--danger), #F1948A);
  color: white;
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.badge-accent {
  background: linear-gradient(135deg, var(--accent), #85C1E9);
  color: white;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.badge-warning {
  background: linear-gradient(135deg, var(--warning), #F7DC6F);
  color: #7B5E00;
  box-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
}

/* Discount ribbon */
.discount-ribbon {
  position: absolute;
  top: 12px;
  right: -8px;
  background: linear-gradient(135deg, var(--danger), #F1948A);
  color: white;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.3rem 1rem 0.3rem 1rem;
  box-shadow: 0 3px 10px rgba(231, 76, 60, 0.35);
  z-index: 5;
  clip-path: polygon(100% 0, 95% 50%, 100% 100%, 0 100%, 0 0);
}

/* New badge ribbon style */
.new-ribbon {
  position: absolute;
  top: 12px;
  left: -8px;
  background: linear-gradient(135deg, var(--accent), #85C1E9);
  color: white;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.3rem 1rem 0.3rem 1rem;
  box-shadow: 0 3px 10px rgba(52, 152, 219, 0.35);
  z-index: 5;
  clip-path: polygon(0 0, 100% 0, 95% 50%, 100% 100%, 0 100%);
}

/* Out of stock overlay */
.out-of-stock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  z-index: 5;
}

.out-of-stock-overlay span {
  background: rgba(255, 255, 255, 0.95);
  color: var(--dark);
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 0.875rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* ================================
   GRADIENT UTILITIES
   ================================ */

.bg-gradient-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
}

.bg-gradient-secondary {
  background: linear-gradient(135deg, var(--secondary), var(--warning));
}

.bg-gradient-accent {
  background: linear-gradient(135deg, var(--accent), #85C1E9);
}

.bg-gradient-dark {
  background: linear-gradient(135deg, var(--dark), #2C3E50);
}

.bg-gradient-hero {
  background: linear-gradient(135deg, #1a2634 0%, #2C3E50 50%, #1E8449 100%);
}

.text-gradient {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ================================
   GLASSMORPHISM
   ================================ */

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.glass-dark {
  background: rgba(26, 38, 52, 0.85);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* ================================
   NAVBAR IMPROVEMENTS
   ================================ */

.nav-link {
  position: relative;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: white;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: all 0.3s ease;
  transform: translateX(-50%);
  border-radius: 1px;
}

.nav-link:hover::after {
  width: 60%;
}

/* Category dropdown */
.category-dropdown {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: rgba(26, 38, 52, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.5rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

.category-trigger:hover .category-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(4px);
}

.category-dropdown a {
  display: block;
  padding: 0.6rem 1rem;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.875rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.category-dropdown a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
  padding-left: 1.25rem;
}

/* ================================
   HERO ANIMATIONS
   ================================ */

@keyframes hero-gradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.hero-animated {
  background-size: 200% 200%;
  animation: hero-gradient 12s ease infinite;
}

@keyframes float-slow {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33% { transform: translateY(-12px) rotate(1deg); }
  66% { transform: translateY(-6px) rotate(-1deg); }
}

.floating-element {
  animation: float-slow 6s ease-in-out infinite;
}

.floating-element-delayed {
  animation: float-slow 6s ease-in-out 2s infinite;
}

.floating-element-slow {
  animation: float-slow 8s ease-in-out 1s infinite;
}

/* ================================
   SCROLL ANIMATIONS
   ================================ */

.animate-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

.animate-on-scroll-left {
  opacity: 0;
  transform: translateX(-24px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-on-scroll-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.animate-on-scroll-right {
  opacity: 0;
  transform: translateX(24px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-on-scroll-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Stagger animation for grids */
.stagger-children > * {
  opacity: 0;
  transform: translateY(16px);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.stagger-children.visible > *:nth-child(1) { transition-delay: 0.05s; }
.stagger-children.visible > *:nth-child(2) { transition-delay: 0.1s; }
.stagger-children.visible > *:nth-child(3) { transition-delay: 0.15s; }
.stagger-children.visible > *:nth-child(4) { transition-delay: 0.2s; }
.stagger-children.visible > *:nth-child(5) { transition-delay: 0.25s; }
.stagger-children.visible > *:nth-child(6) { transition-delay: 0.3s; }
.stagger-children.visible > *:nth-child(7) { transition-delay: 0.35s; }
.stagger-children.visible > *:nth-child(8) { transition-delay: 0.4s; }

.stagger-children.visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* Skeleton loading */
.skeleton-pulse {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

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

/* ================================
   TOAST NOTIFICATIONS
   ================================ */

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  animation: toast-slide-in 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 400px;
  backdrop-filter: blur(8px);
}

.toast-success {
  background: rgba(39, 174, 96, 0.95);
  color: white;
}

.toast-error {
  background: rgba(231, 76, 60, 0.95);
  color: white;
}

.toast-info {
  background: rgba(52, 152, 219, 0.95);
  color: white;
}

.toast-warning {
  background: rgba(243, 156, 18, 0.95);
  color: #7B5E00;
}

.toast-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.toast-close {
  margin-left: auto;
  opacity: 0.7;
  cursor: pointer;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

.toast-close:hover {
  opacity: 1;
}

@keyframes toast-slide-in {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toast-slide-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}

.toast-exit {
  animation: toast-slide-out 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ================================
   UTILITY CLASSES
   ================================ */

/* Responsive utilities */
@media (max-width: 640px) {
  .sm-hide {
    display: none;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .md-hide {
    display: none;
  }
}

@media (min-width: 1025px) {
  .lg-hide {
    display: none;
  }
}

/* Text utilities */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-break {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Visibility utilities */
.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;
}

/* Disabled state */
.disabled,
[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Loading state */
.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

.spinner {
  border: 3px solid var(--gray-200);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Aspect ratio helpers */
.aspect-video {
  aspect-ratio: 16 / 9;
}

.aspect-square {
  aspect-ratio: 1 / 1;
}

.aspect-portrait {
  aspect-ratio: 3 / 4;
}

/* Image fit utilities */
.object-cover-contain {
  object-fit: contain;
}

/* Border utilities */
.border-dashed {
  border-style: dashed;
}

/* Overlay utilities */
.overlay {
  position: relative;
}

.overlay::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1;
}

/* Z-index utilities */
.z-dropdown {
  z-index: 1000;
}

.z-sticky {
  z-index: 500;
}

.z-modal {
  z-index: 2000;
}

.z-tooltip {
  z-index: 3000;
}

/* Gap utilities */
.gap-xs {
  gap: 4px;
}

.gap-sm {
  gap: 8px;
}

.gap-md {
  gap: 16px;
}

.gap-lg {
  gap: 24px;
}

.gap-xl {
  gap: 32px;
}

/* Text align utilities */
.text-left {
  text-align: left;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

/* Min/Max width utilities */
.w-max-content {
  width: max-content;
}

.h-max-content {
  height: max-content;
}

/* Hover effects (desktop only) */
@media (hover: hover) {
  .hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
  }

  .hover-scale:hover {
    transform: scale(1.05);
  }

  .hover-brighten:hover {
    filter: brightness(1.1);
  }
}

/* Safe area support for notched devices */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
    padding-top: max(0px, env(safe-area-inset-top));
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }
}

/* Scrollbar hide utility */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Out-of-stock overlay responsive */
.out-of-stock-overlay span {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
@media (min-width: 640px) {
  .out-of-stock-overlay span {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}
