/* ============================================
   CART ICON & BADGE
   ============================================ */
.cart-icon-btn {
  position: relative;
  background: var(--ghost-accent-color);
  color: var(--color-text);
  border: none;
  padding: 1rem;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 9999;
  transition: color 0.4s;
  display: none;
}

.cart-icon-btn.visible {
  display: block;
}

.cart-icon-btn:hover {
  color: var(--color-lightgrey);
}

.cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--color-red);
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   CART OVERLAY
   ============================================ */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9998;
  display: none;
}

.cart-overlay.visible {
  display: block;
}

/* ============================================
   CART PANEL
   ============================================ */
.cart-panel {
  position: fixed;
  top: 0;
  right: -100%;
  height: 100%;
  width: 100%;
  max-width: 28rem;
  background: var(--color-bg);
  box-shadow: -4px 0 24px rgba(0,0,0,0.2);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
}

.cart-panel.open {
  right: 0;
}

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

.cart-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--color-text);
}

.cart-close-btn {
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
  color: var(--color-text);
}

html:not(.dark-mode) .cart-close-btn:hover {
  background: #f0f0f0;
}
html.dark-mode .cart-close-btn:hover {
  background: var(--color-wash);
}

/* ============================================
   CART ITEMS
   ============================================ */
.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.cart-empty {
  text-align: center;
  padding: 3rem 0;
  color: var(--color-secondary-text);
}

.cart-empty-icon {
  color: var(--color-midgrey);
  margin: 0 auto 1rem;
}

.cart-item {
  display: flex;
  gap: 1rem;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

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

.cart-item-details {
  flex: 1;
}

.cart-item-name {
  text-align: left;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--color-text);
}

.cart-item-price {
  font-size: 1.1rem;
  text-align: left;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cart-qty-btn {
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
  color: var(--color-text);
}

html:not(.dark-mode) .cart-qty-btn:hover {
  background: #f0f0f0;
}
html.dark-mode .cart-qty-btn:hover {
  background: var(--color-wash);
}

.cart-quantity {
  width: 2rem;
  font-size: 1.2rem;
  text-align: center;
  font-weight: 600;
  color: var(--color-text);
  background: transparent;
  border: none;
}

.cart-remove-btn {
  margin-left: auto;
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--color-red);
  border-radius: 4px;
  transition: background 0.2s;
}

html:not(.dark-mode) .cart-remove-btn:hover {
  background: #fef2f2;
}
html.dark-mode .cart-remove-btn:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* ============================================
   CART FOOTER
   ============================================ */
.cart-footer {
  border-top: 1px solid var(--color-border);
  padding: 1.5rem;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.cart-total-label {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
}

.cart-total-amount {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--color-text);
}

.cart-checkout-btn {
  width: 100%;
  background: var(--ghost-accent-color);
  color: var(--color-text);
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: color 0.4s;
}

.cart-checkout-btn:hover {
  color: white;
}

.cart-checkout-btn:disabled {
  background: var(--color-midgrey);
  cursor: not-allowed;
}

/* ============================================
   PRODUCT CARDS (AUTO-GENERATED)
   ============================================ */
.auto-product-card {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  transition: all 0.3s ease;
  background: var(--color-bg);
}

.product-info {
  margin-bottom: 1rem;
  color: var(--color-text);
}

.product-title {
  display: none;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

.product-description {
  color: var(--color-secondary-text);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.product-type-badge {
  display: inline-block;
  background: var(--ghost-accent-color);
  color: var(--color-darkgrey);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.product-formats {
  color: var(--color-secondary-text);
  margin-bottom: 0.75rem;
}

.product-price {
  font-size: 1.75rem;
  font-weight: bold;
  color: var(--color-text);
  margin-bottom: 1rem;
}

.auto-add-to-cart-btn {
  width: 100%;
  background: var(--ghost-accent-color);
  color: white;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.auto-add-to-cart-btn:hover {
  background: var(--ghost-accent-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

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

.product-loading {
  text-align: center;
  padding: 2rem;
  color: var(--color-secondary-text);
}

.product-error {
  background: #1a0a0a;
  border: 2px solid var(--color-red);
  color: var(--color-red);
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
}

/* ============================================
   ADDITIONAL PRODUCTS (External Links)
   ============================================ */
.additional-products {
  margin-top: 1rem;
}

.additional-products-header {
  font-weight: 600;
  color: var(--color-secondary-text);
  margin-bottom: 0.75rem;
}

.additional-products-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.additional-product-item {
  color: var(--color-secondary-text);
  padding-left: 2rem;
}

.additional-product-on {
  color: var(--color-midgrey);
}

.additional-product-item a {
  color: var(--ghost-accent-color);
  text-decoration: none;
  transition: color 0.2s;
}

.additional-product-item a:hover {
  color: var(--color-lightgrey);
  text-decoration: underline;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

/* ============================================
   LOADING SKELETON
   ============================================ */
.product-card-wrapper {
  position: relative;
  min-height: 250px;
}

.product-skeleton {
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem;
  animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-image {
  background: linear-gradient(90deg, var(--color-bg) 25%, var(--color-wash) 50%, var(--color-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
  margin-bottom: 1rem;
  height: 120px;
}

.skeleton-content > div {
  height: 20px;
  background: linear-gradient(90deg, var(--color-bg) 25%, var(--color-wash) 50%, var(--color-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.skeleton-title {
  height: 28px;
  width: 80%;
}

.skeleton-text {
  width: 100%;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-badge {
  width: 120px;
  height: 24px;
}

.skeleton-price {
  height: 32px;
  width: 100px;
  margin: 1rem 0;
}

.skeleton-button {
  height: 48px;
  width: 100%;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.product-card-wrapper.loaded .product-skeleton {
  display: none;
}

/* ============================================
   ADD TO CART NOTIFICATION
   ============================================ */
.cart-notification {
  position: fixed;
  font-size: 1.4rem;
  top: -300px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  transition: top 0.7s;
  max-width: 500px;
  width: calc(100% - 2rem);
}

.cart-notification.show {
  top: 2rem;
}

.cart-notification-content {
  background: var(--color-bg);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 3rem;
  border: 2px solid var(--color-border);
}

.cart-notification-icon {
  width: 48px;
  height: 48px;
  background: var(--color-green);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  flex-shrink: 0;
  animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
  0% { transform: scale(0); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.cart-notification-text {
  flex: 1;
  color: var(--color-text);
}

.cart-notification-text strong {
  display: block;
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
  color: var(--color-text);
}

.cart-notification-text p {
  font-size: 1.33rem;
  margin: 0;
  color: var(--color-secondary-text);
}

.cart-notification-view {
  background: var(--ghost-accent-color);
  color: var(--color-lightgrey);
  border: none;
  padding: 0.7rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-size: 1rem;
  transition: background 0.2s;
}

.cart-notification-view:hover {
  background: var(--color-darkgrey);
  color: white;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
  .cart-notification-content {
    flex-direction: column;
    text-align: center;
  }
  
  .cart-notification-view {
    width: 100%;
  }
  
  .cart-panel {
    max-width: 100%;
  }
  
  .products-grid {
    grid-template-columns: 1fr;
  }
}