/**
 * Hockey Performance Edge - Cart System Styles
 * Premium, minimal cart styling with smooth animations
 */

/* ============================================
   ANIMATIONS & KEYFRAMES
   ============================================ */

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

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

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

/* ============================================
   SIDE CART - BACKDROP & CONTAINER
   ============================================ */

.cart-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 39;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.side-cart {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 420px;
  height: 100vh;
  background-color: #ffffff;
  z-index: 40;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.side-cart.open {
  transform: translateX(0);
}

/* ============================================
   SIDE CART - HEADER
   ============================================ */

.side-cart__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 24px;
  border-bottom: 1px solid #dde5f4;
  background-color: #ffffff;
}

.side-cart__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.6px;
  margin: 0;
  color: #1b232b;
  text-rendering: optimizeLegibility;
}

.side-cart__close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px;
  margin: -12px -12px -12px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #668eab;
  font-size: 24px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.side-cart__close:hover {
  color: #1b232b;
  transform: scale(1.08) rotate(90deg);
}

.side-cart__close:active {
  transform: scale(1.08) rotate(90deg);
}

.side-cart__close svg {
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ============================================
   SIDE CART - BODY (SCROLLABLE ITEMS)
   ============================================ */

.side-cart__body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 0;
  background-color: #ffffff;
}

.side-cart__body::-webkit-scrollbar {
  width: 6px;
}

.side-cart__body::-webkit-scrollbar-track {
  background: transparent;
}

.side-cart__body::-webkit-scrollbar-thumb {
  background-color: #b1c4d8;
  border-radius: 3px;
  transition: background-color 0.2s ease;
}

.side-cart__body::-webkit-scrollbar-thumb:hover {
  background-color: #668eab;
}

.cart-items-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 16px;
}

.cart-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  color: #668eab;
}

.cart-empty-state p {
  margin: 6px 0;
  line-height: 1.6;
}

.cart-empty-state p:first-child {
  font-size: 15px;
  font-weight: 500;
  color: #1b232b;
}

.cart-empty-state p.text-sm {
  font-size: 13px;
  color: #668eab;
}

/* ============================================
   CART ITEM COMPONENT
   ============================================ */

.cart-item {
  display: flex;
  gap: 14px;
  padding: 16px;
  border: 1px solid #dde5f4;
  border-radius: 8px;
  background-color: #ffffff;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-item:hover {
  border-color: #b1c4d8;
  background-color: #f8fafc;
  box-shadow: 0 2px 8px rgba(27, 35, 43, 0.04);
}

.cart-item__image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  background-color: #dde5f4;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.cart-item:hover .cart-item__image {
  transform: scale(1.02);
}

.cart-item__details {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cart-item__title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  color: #1b232b;
  margin: 0;
  text-rendering: optimizeLegibility;
}

.cart-item__variant {
  font-size: 12px;
  color: #668eab;
  margin: 4px 0 0 0;
  font-weight: 400;
}

.cart-item__price {
  font-size: 14px;
  font-weight: 700;
  color: #1b232b;
  margin: 6px 0 0 0;
  letter-spacing: 0.2px;
}

.cart-item__price-original {
  text-decoration: line-through;
  color: #8a949c;
  font-weight: 400;
  margin-right: 4px;
}

.cart-item__price-discounted {
  color: #d32f2f;
}

.cart-item__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

/* ============================================
   QUANTITY SELECTOR
   ============================================ */

.quantity-selector {
  display: flex;
  align-items: center;
  border: 1px solid #dde5f4;
  border-radius: 4px;
  background-color: #f8fafc;
  overflow: hidden;
}

.qty-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  color: #668eab;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.qty-btn:hover {
  background-color: #dde5f4;
  color: #1b232b;
}

.qty-btn:active {
  background-color: #b1c4d8;
  color: #1b232b;
}

.qty-display {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  color: #1b232b;
  min-width: 32px;
  text-align: center;
  user-select: none;
}

.remove-item-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  color: #668eab;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
  margin-left: auto;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.remove-item-btn:hover {
  color: #d32f2f;
  text-decoration: underline;
}

/* ============================================
   SIDE CART - FOOTER (STICKY)
   ============================================ */

.side-cart__footer {
  padding: 24px;
  border-top: 1px solid #dde5f4;
  background-color: #f8fafc;
  flex-shrink: 0;
  max-height: 50vh;
  overflow-y: auto;
}

.side-cart__footer::-webkit-scrollbar {
  width: 6px;
}

.side-cart__footer::-webkit-scrollbar-thumb {
  background-color: #b1c4d8;
  border-radius: 3px;
}

/* ============================================
   SHIPPING THRESHOLD
   ============================================ */

.shipping-threshold {
  margin-bottom: 24px;
}

.shipping-threshold__bar {
  height: 4px;
  background-color: #dde5f4;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}

.shipping-threshold__progress {
  height: 100%;
  background-color: #668eab;
  border-radius: 2px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: width;
}

.shipping-threshold__text {
  font-size: 12px;
  color: #668eab;
  margin: 0;
  line-height: 1.6;
  font-weight: 500;
}

/* ============================================
   CART SUMMARY
   ============================================ */

.cart-summary {
  margin-bottom: 20px;
}

.cart-summary__row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #1b232b;
  margin-bottom: 12px;
  font-weight: 400;
}

.cart-summary__row span:last-child {
  font-weight: 600;
}

.cart-summary__total {
  font-size: 16px;
  font-weight: 700;
  color: #1b232b;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #dde5f4;
}

/* ============================================
   GIFT WRAP OPTION
   ============================================ */

.gift-wrap-option {
  margin: 20px 0;
}

.gift-wrap-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 12px 14px;
  border: 1px solid #dde5f4;
  border-radius: 6px;
  background-color: #ffffff;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.gift-wrap-label:hover {
  border-color: #b1c4d8;
  background-color: #f8fafc;
}

.gift-wrap-label:active {
  background-color: #dde5f4;
}

.gift-wrap-checkbox {
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: #668eab;
  transition: transform 0.1s ease;
}

.gift-wrap-checkbox:checked {
  transform: scale(1.05);
}

.gift-wrap-text {
  font-size: 13px;
  font-weight: 500;
  color: #1b232b;
  flex: 1;
  text-rendering: optimizeLegibility;
}

.gift-wrap-price {
  font-size: 13px;
  font-weight: 700;
  color: #1b232b;
  letter-spacing: 0.2px;
}

/* ============================================
   FINANCING INFO
   ============================================ */

.financing-info {
  background: linear-gradient(135deg, #f8fafc 0%, #dde5f4 100%);
  padding: 14px;
  border-radius: 6px;
  margin: 20px 0;
  border: 1px solid #dde5f4;
}

.financing-info p {
  font-size: 12px;
  color: #668eab;
  margin: 0;
  line-height: 1.6;
  font-weight: 400;
}

.financing-info strong {
  color: #1b232b;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* ============================================
   CART DIVIDER
   ============================================ */

.cart-divider {
  height: 1px;
  background: linear-gradient(
    90deg,
    #ffffff 0%,
    #b1c4d8 50%,
    #ffffff 100%
  );
  margin: 18px 0;
}

/* ============================================
   CHECKOUT BUTTON
   ============================================ */

.checkout-btn {
  width: 100%;
  padding: 15px 16px;
  background-color: #668eab;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  text-rendering: optimizeLegibility;
  user-select: none;
}

.checkout-btn:hover:not(:disabled) {
  background-color: #5a7f9a;
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(102, 142, 171, 0.18);
}

.checkout-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
}

.checkout-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.checkout-btn__arrow {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 16px;
  font-weight: 700;
}

.checkout-btn:hover .checkout-btn__arrow {
  transform: translateX(4px);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 480px) {
  .side-cart {
    max-width: 100%;
  }

  .side-cart__header {
    padding: 20px;
  }

  .side-cart__footer {
    padding: 20px;
  }

  .cart-item {
    gap: 12px;
  }

  .cart-item__image {
    width: 70px;
    height: 70px;
  }

  .cart-item__title {
    font-size: 12px;
  }

  .cart-item__price {
    font-size: 13px;
  }

  .qty-display {
    min-width: 28px;
    font-size: 12px;
  }

  .qty-btn {
    padding: 4px 6px;
    font-size: 12px;
  }
}

@media (max-width: 640px) {
  .side-cart {
    max-width: 100%;
  }
}

/* ============================================
   CART PAGE STYLES
   ============================================ */

/* Empty state */
.empty-cart {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 100px 24px;
  text-align: center;
}

.empty-cart-icon {
  font-size: 56px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-cart-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #333333;
}

.empty-cart-text {
  font-size: 14px;
  color: #999999;
  margin-bottom: 24px;
  max-width: 300px;
}

.continue-shopping-btn {
  padding: 12px 28px;
  background-color: #000000;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
}

.continue-shopping-btn:hover {
  background-color: #1a1a1a;
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

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

.text-sm {
  font-size: 13px;
}

.text-gray-500 {
  color: #999999;
}

/* ============================================
   ACCESSIBILITY & FOCUS STATES
   ============================================ */

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid #000000;
  outline-offset: 2px;
}

.gift-wrap-checkbox:focus-visible {
  outline: 2px solid #000000;
  outline-offset: 2px;
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

.side-cart,
.side-cart__close,
.qty-btn,
.checkout-btn,
.cart-item__image {
  will-change: transform;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .side-cart {
    transition: none;
  }

  .cart-backdrop {
    transition: none;
  }
}
