/* Shopping Cart Styles */

/* Cart Icon in Header */
.cart-icon {
  position: relative;
  cursor: pointer;
  padding: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 32px;
  font-size: 18px;
}

.cart-icon:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.cart-icon svg {
  width: 20px;
  height: 20px;
  fill: white;
}

/* Cart Badge */
.cart-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: rgb(219, 84, 75);
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 10px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  min-width: 18px;
}

.cart-badge.hidden {
  display: none;
}

/* Cart Sidebar */
.cart-sidebar {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100vh;
  background: white;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
  transition: right 0.3s ease;
  z-index: 9999999;
  display: flex;
  flex-direction: column;
}

.cart-sidebar.open {
  right: 0;
}

/* Cart Overlay */
.cart-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.cart-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Cart Header */
.cart-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f9fa;
  z-index: 9999999;
}

.cart-title {
  font-size: 20px;
  font-weight: bold;
  color: rgb(40, 40, 123);
  margin: 0;
}

.cart-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 5px;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.cart-close:hover {
  background: #eee;
  color: #333;
}

/* Cart Content */
.cart-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.cart-empty {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.cart-empty-icon {
  font-size: 48px;
  color: #ddd;
  margin-bottom: 15px;
}

.cart-empty-text {
  font-size: 16px;
  margin-bottom: 20px;
}

/* Cart Items */
.cart-items {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.cart-item {
  display: flex;
  gap: 15px;
  padding: 15px;
  border: 1px solid #eee;
  border-radius: 10px;
  background: #fafafa;
  transition: all 0.3s ease;
}

.cart-item:hover {
  background: #f0f0f0;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.cart-item-image {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 8px;
  background: white;
  border: 1px solid #eee;
}

.cart-item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cart-item-name {
  font-weight: bold;
  color: rgb(40, 40, 123);
  font-size: 14px;
  margin-bottom: 5px;
  line-height: 1.3;
}

.cart-item-price {
  color: rgb(219, 84, 75);
  font-weight: bold;
  font-size: 16px;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 5px;
}

.quantity-btn {
  background: rgb(40, 40, 123);
  color: white;
  border: none;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.quantity-btn:hover {
  background: rgb(20, 20, 103);
  transform: scale(1.1);
}

.quantity-display {
  min-width: 30px;
  text-align: center;
  font-weight: bold;
  color: #333;
}

.remove-btn {
  background: rgb(219, 84, 75);
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.3s ease;
  margin-left: auto;
}

.remove-btn:hover {
  background: rgb(199, 64, 55);
  transform: scale(1.05);
}

/* Cart Footer */
.cart-footer {
  padding: 20px;
  border-top: 1px solid #eee;
  background: #f8f9fa;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-size: 18px;
  font-weight: bold;
}

.cart-total-label {
  color: #333;
}

.cart-total-amount {
  color: rgb(219, 84, 75);
}

.cart-checkout {
  width: 100%;
  background: rgb(0, 140, 190);
  color: white;
  border: none;
  padding: 15px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.cart-checkout:hover {
  background: rgb(0, 120, 170);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 140, 190, 0.3);
}

.cart-checkout:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Animations */
@keyframes cartItemSlideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.cart-item.new {
  animation: cartItemSlideIn 0.3s ease-out;
}

@keyframes badgePulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.cart-badge.pulse {
  animation: badgePulse 0.3s ease-out;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .cart-sidebar {
    width: 100vw;
    right: -100vw;
  }

  .cart-sidebar.open {
    right: 0;
  }

  .cart-item {
    padding: 10px;
  }

  .cart-item-image {
    width: 60px;
    height: 60px;
  }

  .cart-item-name {
    font-size: 13px;
  }

  .cart-item-price {
    font-size: 14px;
  }
}

/* Success Message */
.cart-success-message {
  position: fixed;
  top: 70px;
  right: 20px;
  background: #4caf50;
  color: white;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  z-index: 1001;
  transform: translateX(400px);
  opacity: 0;
  transition: all 0.3s ease;
}

.cart-success-message.show {
  transform: translateX(0);
  opacity: 1;
}

.cart-success-message .close-success {
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  margin-left: 10px;
  padding: 0;
  line-height: 1;
}

button[onclick*="toggleCart"]:active {
  transform: rotate(90deg) scale(0.9) !important;
}

/* Cart Icon Hover Animation */
.cart-icon {
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
  border-radius: 8px !important;
}

.cart-icon:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  transform: scale(1.1) !important;
}

.cart-icon:active {
  transform: scale(0.95) !important;
}

/* Cart Items Container - No Horizontal Scroll */
#cart-items {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  box-sizing: border-box !important;
  word-wrap: break-word !important;
}

#cart-items::-webkit-scrollbar {
  width: 6px;
}

#cart-items::-webkit-scrollbar-track {
  background: #f1f1f1;
}

#cart-items::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

#cart-items::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Cart Items Hover Effect */
#cart-items > div {
  transition: all 0.3s ease !important;
  border-radius: 8px !important;
  margin: 5px 0 !important;
}

#cart-items > div:hover {
  background: rgba(0, 122, 204, 0.05) !important;
  transform: translateX(5px) !important;
}

/* Prevent horizontal scroll when cart is open */
body {
  overflow-x: hidden !important;
}

/* Cart Sidebar - Prevent horizontal scroll */
#cart-sidebar {
  transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

#cart-sidebar::-webkit-scrollbar {
  width: 6px;
}

#cart-sidebar::-webkit-scrollbar-track {
  background: #f1f1f1;
}

#cart-sidebar::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

#cart-sidebar::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Cart Overlay Fade Animation */
#cart-overlay {
  transition: opacity 0.3s ease !important;
}

/* Enhanced Additional Cart Animations */

/* Pulse effect for cart count */
#cart-count {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* Shopping cart shake animation when item added */
.cart-added-shake {
  animation: cartShake 0.5s ease-in-out;
}

@keyframes cartShake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-3px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(3px);
  }
}

/* Cart items slide in animation */
@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Enhanced Cart Button Animations - Match desktops.html */
#checkout-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #007acc, #0056b3);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(0, 122, 204, 0.3);
  box-sizing: border-box;
  max-width: 100%;
}

#checkout-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

#checkout-btn:hover {
  background: linear-gradient(135deg, #0056b3, #003d82);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 122, 204, 0.4);
}

#checkout-btn:hover::before {
  left: 100%;
}

#checkout-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 15px rgba(0, 122, 204, 0.3);
}

/* Remove button hover glow effect - Match desktops.html */
button[onclick*="removeFromCart"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

button[onclick*="removeFromCart"]:hover::before {
  left: 100%;
}

/* Enhanced cart overlay fade */
#cart-overlay.show {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Cart item bounce effect when added */
.cart-item-added {
  animation: bounceIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Loading animation for checkout button */
.checkout-loading {
  opacity: 0.7;
  pointer-events: none;
  position: relative;
}

.checkout-loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #fff;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
