/* ============================================
   AJAX PAGE TRANSITIONS - NYKAA STYLE
   ============================================ */

/* Page Transition Container */
#page-transition-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  pointer-events: none;
  visibility: hidden;
}

#page-transition-overlay.active {
  visibility: visible;
}

/* Slide Panels */
.transition-panel {
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  background: var(--white);
}

.transition-panel-left {
  left: 0;
  transform: translateX(-100%);
}

.transition-panel-right {
  right: 0;
  transform: translateX(100%);
}

/* Forward Transition (slide in from right) */
#page-transition-overlay.transition-forward .transition-panel-right {
  transform: translateX(0);
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

#page-transition-overlay.transition-forward .transition-panel-left {
  transform: translateX(-100%);
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Backward Transition (slide in from left) */
#page-transition-overlay.transition-backward .transition-panel-left {
  transform: translateX(0);
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

#page-transition-overlay.transition-backward .transition-panel-right {
  transform: translateX(100%);
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Loading Spinner */
.transition-loader {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.transition-loader.active {
  opacity: 1;
  visibility: visible;
}

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

.transition-loader-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-600);
}

/* Progress Bar */
.transition-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  z-index: 100001;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(40, 116, 240, 0.5);
}

.transition-progress.active {
  animation: progressPulse 1.5s ease infinite;
}

.transition-progress.complete {
  width: 100% !important;
  transition: width 0.3s ease, opacity 0.5s ease;
  opacity: 0;
}

@keyframes progressPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Page Content Wrapper */
#ajax-content {
  transition: opacity 0.2s ease;
}

#ajax-content.transitioning {
  opacity: 0;
}

/* Smooth Page Fade */
.page-fade-in {
  animation: pageFadeIn 0.4s ease forwards;
}

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

/* Cart Drawer */
.cart-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 90vw;
  height: 100%;
  background: var(--white);
  z-index: 99998;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.15);
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.cart-drawer.open {
  right: 0;
}

.cart-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99997;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.cart-drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
}

.cart-drawer-header h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.cart-drawer-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--gray-50);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  color: var(--gray-600);
}

.cart-drawer-close:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.cart-drawer-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}

.cart-drawer-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--gray-100);
}

.cart-drawer-item:last-child {
  border-bottom: none;
}

.cart-drawer-item-image {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--gray-50);
}

.cart-drawer-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-drawer-item-info {
  flex: 1;
  min-width: 0;
}

.cart-drawer-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-800);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-drawer-item-variant {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 8px;
}

.cart-drawer-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-drawer-item-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
}

.cart-drawer-item-qty {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.cart-drawer-item-qty button {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--gray-600);
  transition: var(--transition);
}

.cart-drawer-item-qty button:hover {
  background: var(--gray-100);
}

.cart-drawer-item-qty span {
  width: 32px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

.cart-drawer-empty {
  text-align: center;
  padding: 40px 0;
}

.cart-drawer-empty svg {
  width: 64px;
  height: 64px;
  color: var(--gray-300);
  margin-bottom: 16px;
}

.cart-drawer-empty p {
  color: var(--gray-500);
  font-size: 14px;
}

/* Quick View Modal */
.quick-view-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99996;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

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

.quick-view-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.quick-view-modal-content {
  position: relative;
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.quick-view-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--white);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  z-index: 10;
  border: none;
  color: var(--gray-600);
  transition: var(--transition);
}

.quick-view-modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.quick-view-modal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-height: 90vh;
  overflow-y: auto;
}

.quick-view-gallery {
  background: var(--gray-50);
}

.quick-view-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.quick-view-info {
  padding: 32px;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 100002;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-800);
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 360px;
  border-left: 4px solid var(--success);
}

.toast.show {
  transform: translateX(0);
}

.toast.toast-error {
  border-left-color: var(--danger);
}

.toast.toast-warning {
  border-left-color: var(--warning);
}

.toast-icon {
  flex-shrink: 0;
}

.toast-close {
  margin-left: auto;
  cursor: pointer;
  color: var(--gray-400);
  padding: 4px;
  transition: var(--transition);
}

.toast-close:hover {
  color: var(--gray-600);
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease infinite;
  border-radius: var(--radius-sm);
}

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

.skeleton-card {
  background: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.skeleton-image {
  width: 100%;
  padding-top: 100%;
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease infinite;
}

.skeleton-text {
  height: 14px;
  margin: 12px;
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease infinite;
  border-radius: var(--radius-sm);
}

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

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

/* Scroll to Top Button */
.scroll-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: var(--transition);
  border: none;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-4px);
}

/* Responsive */
@media (max-width: 768px) {
  .quick-view-modal-body {
    grid-template-columns: 1fr;
  }

  .quick-view-gallery {
    max-height: 300px;
  }

  .quick-view-info {
    padding: 20px;
  }

  .toast-container {
    top: auto;
    bottom: 24px;
    right: 16px;
    left: 16px;
  }

  .toast {
    max-width: 100%;
  }
}
