/**
 * 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: 50%;
  right: -420px;
  transform: translateY(-50%);
  width: 380px;
  max-width: 95vw;
  max-height: 90vh;
  background: white;
  box-shadow: -2px 0 20px rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
  overflow: hidden;
}

.cart-modal.active {
  right: 1rem;
}

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

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

.cart-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #666;
  line-height: 1;
}

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

.cart-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 1.25rem;
  min-height: 0;
}

.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;
  gap: 0.75rem;
  align-items: start;
  padding: 1rem;
  background: #f9f9f9;
  border-radius: 8px;
}

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

.cart-item-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.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.25rem;
  background: white;
  border-radius: 4px;
  padding: 0.15rem;
  margin-top: 0.25rem;
  border: 1px solid #e0e0e0;
  align-self: flex-start;
}

.qty-decrease,
.qty-increase {
  background: #f0f0f0;
  border: none;
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  padding: 0;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

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

.qty-input {
  width: 24px;
  text-align: center;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 0.1rem 0;
  font-size: 0.75rem;
  -moz-appearance: textfield;
  appearance: textfield;
}

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

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

.cart-item-remove {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1rem;
  transition: color 0.2s;
  line-height: 1;
  margin-top: 0.1rem;
}

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

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

.cart-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 1.3rem;
  font-weight: 700;
}

.cart-total {
  color: #2a9d2a;
}

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

.checkout-button {
  padding: 0.75rem;
  border: none;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

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

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


/* 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;
  bottom: 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: translateY(100px);
  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 !important;
  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;
}

/* Shipping Step */
.cart-back-btn {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #666;
}

.cart-back-btn:hover {
  color: #333;
}

.shipping-step-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#cartStep2 {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#addressElement {
  width: 100%;
  min-height: 0;
}

.order-summary-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  background: #f0f0f0;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  user-select: none;
}

.order-summary-toggle:hover {
  background: #e8e8e8;
}

.order-summary-items {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
  margin-top: -0.25rem;
}

.order-summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border-bottom: 1px solid #f0f0f0;
}

.order-summary-item:last-child {
  border-bottom: none;
}

.order-summary-name {
  color: #444;
}

.order-summary-price {
  font-weight: 600;
  color: #2a9d2a;
}

.shipping-step-hint {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
}

.shipping-quote-btn {
  padding: 0.6rem 1rem;
  background: #4CAF50;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.shipping-quote-btn:hover:not(:disabled) {
  background: #45a049;
}

.shipping-quote-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.shipping-quote-result {
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
}

.shipping-quote-ok {
  background: #f0faf0;
  border: 1px solid #a5d6a7;
  color: #2e7d32;
}

.shipping-quote-error {
  background: #fff5f5;
  border: 1px solid #ffcdd2;
  color: #c62828;
}

.shipping-line {
  font-size: 1rem;
  font-weight: 500;
  margin-top: -0.25rem;
  margin-bottom: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .cart-modal {
    top: -100vh;
    bottom: auto;
    right: 0 !important;
    left: 0;
    transform: none;
    width: 100vw;
    max-width: 100vw;
    max-height: 85vh;
    border-radius: 0 0 16px 16px;
    transition: top 0.3s ease;
  }

  .cart-modal.active {
    top: 0;
    right: 0 !important;
  }

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

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

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

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

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

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