/* Shopping Cart Styles - LA CRÈME DE LA CRÈME */
/* Sprint 10.1 Phase 1: E-Commerce Features */
/* Premium, polished, professional design */

/* ============================================
   CART ICON (Floating Button) - PREMIUM
   ============================================ */

.cart-icon {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  animation: fadeInScale 0.5s ease-out;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.cart-button {
  position: relative;
  background: linear-gradient(135deg, var(--primary-color, #007bff) 0%, var(--secondary-color, #0056b3) 100%);
  color: white;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 123, 255, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-button::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, rgba(255,255,255,0.3), transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.cart-button:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 12px 32px rgba(0, 123, 255, 0.4);
}

.cart-button:active {
  transform: scale(0.95);
}

.cart-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: linear-gradient(135deg, #ff4444, #cc0000);
  color: white;
  border-radius: 50%;
  min-width: 26px;
  height: 26px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 3px solid white;
  box-shadow: 0 4px 12px rgba(255, 68, 68, 0.4);
  animation: bounceIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

/* ============================================
   CART SIDEBAR - LA CRÈME DE LA CRÈME
   ============================================ */

.cart-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
}

.cart-sidebar.active {
  pointer-events: all;
  opacity: 1;
}

.cart-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  cursor: pointer;
  transition: backdrop-filter 0.3s ease;
}

.cart-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 480px;
  height: 100%;
  background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-sidebar.active .cart-panel {
  transform: translateX(0);
}

/* ============================================
   CART HEADER - PREMIUM GRADIENT
   ============================================ */

.cart-header {
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, var(--primary-color, #007bff) 0%, var(--secondary-color, #0056b3) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.cart-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.cart-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

.cart-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(90deg);
}

/* ============================================
   CART BODY
   ============================================ */

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: #999;
}

.cart-empty svg {
  margin-bottom: 20px;
  opacity: 0.3;
}

.cart-empty p {
  font-size: 18px;
  margin-bottom: 20px;
}

/* ============================================
   CART ITEMS - PREMIUM DESIGN
   ============================================ */

.cart-item {
  display: flex;
  gap: 16px;
  padding: 20px;
  border: 2px solid transparent;
  border-radius: 16px;
  margin-bottom: 16px;
  background: white;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.cart-item:hover {
  border-color: var(--primary-color, #007bff);
  box-shadow: 0 8px 24px rgba(0, 123, 255, 0.15);
  transform: translateY(-2px);
}

.cart-item-image {
  width: 90px;
  height: 90px;
  object-fit: contain;
  border-radius: 12px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

.cart-item-name {
  margin: 0 0 5px 0;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cart-item-ref {
  margin: 0 0 5px 0;
  font-size: 12px;
  color: #666;
}

.cart-item-price {
  margin: 0;
  font-size: 14px;
  color: var(--primary-color, #007bff);
  font-weight: 600;
}

.cart-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

/* ============================================
   QUANTITY CONTROLS - PREMIUM
   ============================================ */

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 0;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  background: white;
}

.qty-btn {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color, #007bff);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.qty-btn:hover {
  background: linear-gradient(135deg, var(--primary-color, #007bff) 0%, var(--secondary-color, #0056b3) 100%);
  color: white;
  transform: scale(1.1);
}

.qty-btn:active {
  transform: scale(0.95);
}

.qty-input {
  width: 60px;
  height: 40px;
  border: none;
  border-left: 2px solid #e9ecef;
  border-right: 2px solid #e9ecef;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark, #333);
  background: white;
  -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cart-item-total {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #333;
}

.btn-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  padding: 5px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.btn-remove:hover {
  opacity: 1;
}

/* ============================================
   CART FOOTER - PREMIUM
   ============================================ */

.cart-footer {
  padding: 24px;
  border-top: 2px solid #e9ecef;
  background: white;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 20px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 16px;
  font-size: 18px;
  font-weight: 700;
}

#cart-subtotal {
  color: var(--primary-color, #007bff);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
}

.btn-checkout,
.btn-continue {
  width: 100%;
  padding: 18px;
  border: none;
  border-radius: 16px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn-checkout {
  background: linear-gradient(135deg, var(--primary-color, #007bff) 0%, var(--secondary-color, #0056b3) 100%);
  color: white;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(0, 123, 255, 0.3);
}

.btn-checkout::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s;
}

.btn-checkout:hover::before {
  left: 100%;
}

.btn-checkout:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 123, 255, 0.4);
}

.btn-checkout:active {
  transform: translateY(-2px);
}

.btn-continue {
  background: white;
  color: var(--text-dark, #333);
  border: 2px solid #e9ecef;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.btn-continue:hover {
  background: #f8f9fa;
  border-color: var(--primary-color, #007bff);
  color: var(--primary-color, #007bff);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ============================================
   ADD TO CART BUTTON (Product Cards)
   ============================================ */

.btn-add-to-cart {
  background: var(--primary-color, #007bff);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.btn-add-to-cart:hover {
  background: var(--primary-color-dark, #0056b3);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.btn-add-to-cart:active {
  transform: translateY(0);
}

.btn-add-to-cart svg {
  width: 18px;
  height: 18px;
}

/* ============================================
   CART NOTIFICATION - LA CRÈME DE LA CRÈME
   ============================================ */

.cart-notification {
  position: fixed;
  top: 100px;
  right: 20px;
  z-index: 10000;
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  padding: 20px 28px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(40, 167, 69, 0.4);
  transform: translateX(400px);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

.cart-notification::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 2px;
  background: linear-gradient(135deg, rgba(255,255,255,0.4), transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.cart-notification.show {
  transform: translateX(0);
  animation: slideInBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes slideInBounce {
  0% {
    transform: translateX(400px);
  }
  60% {
    transform: translateX(-10px);
  }
  80% {
    transform: translateX(5px);
  }
  100% {
    transform: translateX(0);
  }
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.notification-icon {
  font-size: 24px;
  font-weight: bold;
  animation: checkmark 0.5s ease-out;
}

@keyframes checkmark {
  0% {
    transform: scale(0) rotate(-45deg);
  }
  50% {
    transform: scale(1.2) rotate(10deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

.notification-text {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .cart-icon {
    top: 15px;
    right: 15px;
  }

  .cart-button {
    width: 48px;
    height: 48px;
  }

  .cart-panel {
    max-width: 100%;
  }

  .cart-item {
    flex-direction: column;
    gap: 10px;
  }

  .cart-item-image {
    width: 100%;
    height: 150px;
  }

  .cart-item-actions {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
  }

  .cart-notification {
    right: 10px;
    left: 10px;
    top: 80px;
  }
}

@media (max-width: 480px) {
  .cart-header h2 {
    font-size: 18px;
  }

  .cart-body {
    padding: 15px;
  }

  .cart-footer {
    padding: 15px;
  }

  .cart-total {
    font-size: 16px;
  }

  #cart-subtotal {
    font-size: 20px;
  }
}

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

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

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

/* ============================================
   ACCESSIBILITY
   ============================================ */

.cart-button:focus,
.cart-close:focus,
.qty-btn:focus,
.btn-remove:focus,
.btn-checkout:focus,
.btn-continue:focus {
  outline: 2px solid var(--primary-color, #007bff);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .cart-button,
  .btn-checkout {
    border: 2px solid white;
  }

  .cart-item {
    border-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .cart-sidebar,
  .cart-panel,
  .cart-notification,
  .cart-button,
  .btn-checkout,
  .btn-continue {
    transition: none;
  }
}
