/**
 * Shopping Cart Styles for Ariel's Doodles
 */

/* Cart Icon Widget in Header */
.cart-widget {
  position: relative;
  display: inline-block;
  cursor: pointer;
  padding: 0.5rem 1rem;
  color: inherit;
  text-decoration: none;
}

.cart-widget:hover {
  opacity: 0.8;
}

.cart-icon {
  font-size: 1.5rem;
  position: relative;
}

.cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff6b6b;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  display: none;
}

.cart-count.has-items {
  display: flex;
}

/* Cart Modal/Overlay */
.cart-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9998;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.cart-overlay.active {
  display: block;
  opacity: 1;
}

.cart-modal {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background: white;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
}

.cart-modal.active {
  right: 0;
}

.cart-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.cart-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  color: #666;
  line-height: 1;
}

.cart-close:hover {
  color: #333;
}

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.empty-cart {
  text-align: center;
  color: #999;
  padding: 2rem;
  font-style: italic;
}

/* Cart Item */
.cart-item {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 1rem;
  align-items: start;
  padding: 1rem;
  background: #f9f9f9;
  border-radius: 8px;
  position: relative;
}

.cart-item-image {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}

.cart-item-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-right: 2rem;
}

.cart-item-details h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.cart-item-price {
  margin: 0;
  color: #666;
  font-size: 0.875rem;
}

.cart-item-quantity {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  border-radius: 4px;
  padding: 0.25rem;
  margin-top: 0.25rem;
  border: 1px solid #e0e0e0;
}

.qty-decrease,
.qty-increase {
  background: #f0f0f0;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.qty-decrease:hover,
.qty-increase:hover {
  background: #e0e0e0;
}

.qty-input {
  width: 40px;
  text-align: center;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 0.25rem;
  font-size: 0.875rem;
}

.cart-item-total {
  font-weight: 600;
  font-size: 1rem;
  text-align: right;
  padding-right: 2rem;
}

.cart-item-remove {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1.25rem;
  transition: color 0.2s;
  line-height: 1;
}

.cart-item-remove:hover {
  color: #ff6b6b;
}

/* Cart Footer */
.cart-footer {
  padding: 1.5rem;
  border-top: 1px solid #e0e0e0;
  background: #f9f9f9;
}

.cart-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.cart-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.checkout-button,
.clear-cart-button {
  padding: 1rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.checkout-button {
  background: #4CAF50;
  color: white;
}

.checkout-button:hover:not(:disabled) {
  background: #45a049;
  transform: translateY(-1px);
}

.checkout-button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.clear-cart-button {
  background: transparent;
  color: #666;
  border: 1px solid #ddd;
}

.clear-cart-button:hover {
  background: #f0f0f0;
}

/* Loading State */
.cart-loading {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 1rem;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.cart-loading::after {
  content: '';
  display: block;
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #4CAF50;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Notifications */
.cart-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  background: white;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s ease;
}

.cart-notification.show {
  opacity: 1;
  transform: translateX(0);
}

.cart-notification-success {
  border-left: 4px solid #4CAF50;
}

.cart-notification-error {
  border-left: 4px solid #ff6b6b;
}

/* Add to Cart Button */
.add-to-cart-btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: #4CAF50;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.add-to-cart-btn:hover {
  background: #45a049;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

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

.add-to-cart-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

/* Responsive Design */
@media (max-width: 768px) {
  .cart-modal {
    width: 100vw;
    right: -100vw;
  }

  .cart-item {
    grid-template-columns: 50px 1fr auto;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .cart-item-image {
    width: 50px;
    height: 50px;
  }

  .cart-item-details {
    gap: 0.375rem;
  }

  .cart-item-details h4 {
    font-size: 0.9rem;
    padding-right: 1.5rem;
  }

  .cart-item-price {
    font-size: 0.8rem;
  }

  .cart-item-quantity {
    gap: 0.375rem;
    padding: 0.2rem;
  }

  .qty-decrease,
  .qty-increase {
    width: 22px;
    height: 22px;
    font-size: 0.9rem;
  }

  .qty-input {
    width: 35px;
    font-size: 0.8rem;
  }

  .cart-item-total {
    font-size: 0.9rem;
    min-height: auto;
  }

  .cart-item-remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 1rem;
    padding: 0.25rem;
  }
}
