/* ================================================
   COMPREHENSIVE IMPROVEMENTS
   All Priority Recommendations Implementation
   ================================================ */

/* ============================================
   1. ACCESSIBILITY IMPROVEMENTS
   ============================================ */

/* Skip to content link - Hidden */
.skip-to-content {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  position: absolute !important;
  top: -9999px !important;
  left: -9999px !important;
}

/* Enhanced Focus Indicators */
*:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* ARIA Live Regions */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================
   2. LOADING STATES & SKELETON SCREENS
   ============================================ */

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 8px;
}

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

.skeleton-image {
  aspect-ratio: 16/9;
  width: 100%;
}

.skeleton-text {
  height: 16px;
  margin: 8px 0;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.medium {
  width: 80%;
}

.skeleton-title {
  height: 24px;
  width: 70%;
  margin-bottom: 12px;
}

/* Product Skeleton */
.product-skeleton {
  background: linear-gradient(135deg, #0a0a0a 0%, #111 100%);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ============================================
   3. ERROR HANDLING & EMPTY STATES
   ============================================ */

.error-state,
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #CCCCCC;
}

.error-state-icon,
.empty-state-icon {
  font-size: 64px;
  color: rgb(from var(--color-primary) r g b / 0.5);
  margin-bottom: 24px;
}

.error-state-title,
.empty-state-title {
  font-size: 24px;
  font-weight: 600;
  color: #FFFFFF;
  margin-bottom: 12px;
}

.error-state-message,
.empty-state-message {
  font-size: 16px;
  margin-bottom: 24px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.error-state-action,
.empty-state-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--color-primary);
  color: #FFFFFF;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

.error-state-action:hover,
.empty-state-action:hover {
  background: var(--color-primary-hover);
  transform: translateY(-2px);
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1a1a1a;
  border: 1px solid rgb(from var(--color-primary) r g b / 0.3);
  border-radius: 12px;
  padding: 16px 20px;
  color: #FFFFFF;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 400px;
  animation: slideInUp 0.3s ease;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-color: rgba(0, 255, 0, 0.3);
}

.toast.error {
  border-color: rgba(255, 0, 0, 0.3);
}

.toast.warning {
  border-color: rgba(255, 165, 0, 0.3);
}

.toast-icon {
  font-size: 20px;
}

.toast-message {
  flex: 1;
}

.toast-close {
  background: none;
  border: none;
  color: #CCCCCC;
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
}

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

/* ============================================
   4. SEARCH FUNCTIONALITY
   ============================================ */

.search-container {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

@media (max-width: 960px) {
  .search-container {
    display: none; /* Hide search on mobile, can be shown in mobile menu */
  }
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 12px 48px 12px 16px;
  background: rgb(from var(--color-primary) r g b / 0.1);
  border: 1px solid rgb(from var(--color-primary) r g b / 0.3);
  border-radius: 12px;
  color: #FFFFFF;
  font-size: 16px;
  transition: all 0.3s ease;
}

.search-input:focus {
  outline: none;
  background: rgb(from var(--color-primary) r g b / 0.15);
  border-color: rgb(from var(--color-primary) r g b / 0.5);
  box-shadow: 0 0 0 3px rgb(from var(--color-primary) r g b / 0.1);
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.search-button {
  position: absolute;
  right: 8px;
  background: var(--color-primary);
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-button:hover {
  background: var(--color-primary-hover);
  transform: scale(1.1);
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #1a1a1a;
  border: 1px solid rgb(from var(--color-primary) r g b / 0.3);
  border-radius: 12px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: none;
}

.search-results.active {
  display: block;
}

.search-result-item {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: rgb(from var(--color-primary) r g b / 0.1);
}

.search-result-image {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  font-size: 14px;
  font-weight: 600;
  color: #FFFFFF;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-price {
  font-size: 12px;
  color: var(--color-primary);
  font-weight: 600;
}

.search-no-results {
  padding: 24px;
  text-align: center;
  color: #CCCCCC;
}

/* ============================================
   5. PRODUCT QUICK VIEW
   ============================================ */

.quick-view-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.quick-view-modal.active {
  opacity: 1;
  visibility: visible;
}

.quick-view-content {
  background: #1a1a1a;
  border: 1px solid rgb(from var(--color-primary) r g b / 0.3);
  border-radius: 20px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.quick-view-modal.active .quick-view-content {
  transform: scale(1);
}

.quick-view-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  cursor: pointer;
  z-index: 1;
  transition: all 0.3s ease;
}

.quick-view-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.quick-view-body {
  padding: 24px;
}

/* ============================================
   6. PRODUCT FILTERING
   ============================================ */

.filter-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
  padding: 20px;
  background: rgb(from var(--color-primary) r g b / 0.05);
  border-radius: 12px;
  border: 1px solid rgb(from var(--color-primary) r g b / 0.2);
}

.filter-button {
  padding: 8px 16px;
  background: rgb(from var(--color-primary) r g b / 0.2);
  border: 1px solid rgb(from var(--color-primary) r g b / 0.3);
  border-radius: 8px;
  color: #FFFFFF;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: 500;
}

.filter-button:hover {
  background: rgb(from var(--color-primary) r g b / 0.3);
  border-color: rgb(from var(--color-primary) r g b / 0.5);
}

.filter-button.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #FFFFFF;
}

.sort-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.sort-label {
  color: #CCCCCC;
  font-size: 14px;
}

.sort-select {
  padding: 8px 16px;
  background: rgb(from var(--color-primary) r g b / 0.1);
  border: 1px solid rgb(from var(--color-primary) r g b / 0.3);
  border-radius: 8px;
  color: #FFFFFF;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.sort-select:focus {
  outline: none;
  border-color: rgb(from var(--color-primary) r g b / 0.5);
  box-shadow: 0 0 0 3px rgb(from var(--color-primary) r g b / 0.1);
}

/* ============================================
   7. WISHLIST FEATURE
   ============================================ */

.wishlist-button {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
}

.wishlist-button:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

.wishlist-button.active {
  color: #FF1493;
  background: rgba(255, 20, 147, 0.2);
}

.wishlist-button.active:hover {
  background: rgba(255, 20, 147, 0.3);
}

.wishlist-count {
  position: fixed;
  top: 80px;
  right: 24px;
  background: var(--color-primary);
  color: #FFFFFF;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  z-index: 1000;
  display: none;
}

.wishlist-count.show {
  display: block;
  animation: pulse 0.5s ease;
}

/* ============================================
   8. ADVANCED ANIMATIONS
   ============================================ */

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

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.animate-fade-in-down {
  animation: fadeInDown 0.6s ease-out;
}

.animate-scale-in {
  animation: scaleIn 0.4s ease-out;
}

.animate-slide-in-right {
  animation: slideInRight 0.5s ease-out;
}

/* Stagger animations */
.animate-stagger > * {
  animation: fadeInUp 0.6s ease-out forwards;
  opacity: 0;
}

.animate-stagger > *:nth-child(1) { animation-delay: 0.1s; }
.animate-stagger > *:nth-child(2) { animation-delay: 0.2s; }
.animate-stagger > *:nth-child(3) { animation-delay: 0.3s; }
.animate-stagger > *:nth-child(4) { animation-delay: 0.4s; }
.animate-stagger > *:nth-child(5) { animation-delay: 0.5s; }
.animate-stagger > *:nth-child(6) { animation-delay: 0.6s; }

/* ============================================
   9. RESPONSIVE IMPROVEMENTS
   ============================================ */

@media (max-width: 768px) {
  .search-container {
    max-width: 100%;
    padding: 0 16px;
    display: block; /* Show in mobile menu */
  }

  .filter-container {
    padding: 16px;
  }

  .quick-view-content {
    max-width: 100%;
    margin: 16px;
    max-height: 85vh;
  }

  .toast {
    bottom: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
  }

  .wishlist-count {
    top: 60px;
    right: 16px;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

