#khria-products-widget {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #333;
  z-index: 9999;
  position: fixed;
}

/* Positioning */
.khria-position-bottom-right {
  bottom: 20px;
  right: 20px;
}

.khria-position-bottom-left {
  bottom: 20px;
  left: 20px;
}

.khria-position-top-right {
  top: 20px;
  right: 20px;
}

.khria-position-top-left {
  top: 20px;
  left: 20px;
}

/* Button */
#khria-products-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 24px;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

#khria-products-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.khria-products-icon {
  height: 20px;
  width: 20px;
}

/* Panel */
#khria-products-panel {
  position: fixed;
  width: 360px;
  max-width: 90vw;
  height: 480px;
  max-height: 80vh;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s, opacity 0.3s;
  z-index: 10000; /* Ensure it appears above catalog content */
}

/* Panel positioning based on button position */
.khria-position-bottom-right #khria-products-panel {
  bottom: 80px;
  right: 20px;
}

.khria-position-bottom-left #khria-products-panel {
  bottom: 80px;
  left: 20px;
  transform-origin: bottom left;
}

.khria-position-top-right #khria-products-panel {
  top: 80px;
  right: 20px;
}

.khria-position-top-left #khria-products-panel {
  top: 80px;
  left: 20px;
}

#khria-products-panel.visible {
  transform: scale(1);
  opacity: 1;
  pointer-events: all;
}

/* Header */
.khria-products-header {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.khria-products-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.khria-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.khria-catalog-icon {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  opacity: 0.7;
}

.khria-catalog-icon:hover {
  background-color: rgba(255, 255, 255, 0.1);
  opacity: 1;
  transform: scale(1.05);
}

.khria-catalog-icon svg {
  height: 18px;
  width: 18px;
}

#khria-products-close {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

#khria-products-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

#khria-products-close svg {
  height: 18px;
  width: 18px;
}

/* Content */
.khria-products-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}



/* Products list container */
.khria-products-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Product item */
.khria-product-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background-color: #f8f9fa;
  transition: transform 0.2s;
}

.khria-product-item:hover {
  transform: translateY(-2px);
}

.khria-product-item-image {
  width: 80px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.khria-product-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Image placeholder styling */
.khria-image-placeholder {
  background-color: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.khria-placeholder-icon {
  width: 32px;
  height: 32px;
  color: #9ca3af;
  stroke-width: 1.5;
}

.khria-product-item-content {
  flex: 1;
}

.khria-product-item-name {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
}

.khria-product-item-price {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 700;
}

.khria-product-item-inventory {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: #666;
}

.khria-product-item-description {
  margin: 0;
  font-size: 14px;
  color: #444;
  line-height: 1.4;
}

/* Product ordering styles */
.khria-product-item-purchase {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

.khria-product-quantity {
  display: flex;
  align-items: center;
}

.khria-product-quantity label {
  margin-right: 6px;
  font-size: 14px;
}

.khria-quantity-input {
  width: 50px;
  padding: 4px;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-align: center;
  font-size: 14px;
}

.khria-buy-button {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s;
}

.khria-buy-button:hover {
  background-color: #45a049;
}

.khria-checkout-section {
  border-top: 1px solid #eaeaea;
  padding: 12px 16px;
  background-color: #f8f9fa;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.khria-order-summary {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 500;
}

.khria-checkout-button {
  /* Background color will be set dynamically via JavaScript */
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.2s;
  flex: 1;
  text-align: center;
}

/* Hover effect will be set dynamically via JavaScript */

.khria-order-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: #ef4444;
  color: white;
  font-size: 12px;
  font-weight: bold;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Loading state */
.khria-products-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  color: #666;
}

.khria-products-spinner {
  height: 32px;
  width: 32px;
  margin-bottom: 16px;
  animation: spinner 1s linear infinite;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

/* Empty state */
.khria-products-empty {
  text-align: center;
  padding: 40px 0;
  color: #666;
}

/* Error state */
.khria-products-error {
  text-align: center;
  padding: 40px 0;
  color: #e53e3e;
}

/* Checkout actions container */
.khria-checkout-actions {
  display: flex;
  gap: 8px;
  width: 100%;
}

/* Cart icon button */
.khria-cart-icon-button {
  flex: 0 0 25%;
  background: #059669;
  color: white;
  border: none;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  position: relative;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.2);
}

.khria-cart-icon-button:hover {
  background: #047857;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(5, 150, 105, 0.3);
}

.khria-cart-icon-button svg {
  stroke: currentColor;
  width: 18px;
  height: 18px;
}

/* Cart modal - Exact copy from catalog */
.khria-cart-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.khria-cart-modal-content {
  background: white;
  border-radius: 8px;
  max-width: 600px;
  max-height: 80vh;
  width: 90%;
  display: flex;
  flex-direction: column;
}

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

.khria-cart-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.khria-close-cart-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6c757d;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

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

.khria-cart-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid #e0e0e0;
}

.khria-cart-item:last-child {
  border-bottom: none;
}

.khria-cart-item-image {
  width: 60px;
  height: 60px;
  background: #f8f9fa;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.khria-cart-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.khria-cart-item-image .placeholder {
  color: #6c757d;
  font-size: 1.5rem;
}

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

.khria-cart-item-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.khria-cart-item-price {
  color: #28a745;
  font-weight: 500;
}

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

.khria-quantity-controls {
  display: flex;
  align-items: center;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
}

.khria-quantity-btn {
  background: #f8f9fa;
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  transition: background 0.2s ease;
}

.khria-quantity-btn:hover {
  background: #e9ecef;
}

.khria-quantity-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.khria-quantity-display {
  padding: 0 0.75rem;
  font-weight: 600;
  min-width: 40px;
  text-align: center;
}

.khria-remove-item-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.2s ease;
}

.khria-remove-item-btn:hover {
  background: #c82333;
}

.khria-cart-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e0e0e0;
}

.khria-cart-modal-total {
  font-size: 1.25rem;
  font-weight: bold;
  margin-bottom: 1rem;
  text-align: center;
}

.khria-cart-modal-actions {
  display: flex;
  gap: 1rem;
}

.khria-clear-cart-btn {
  flex: 1;
  background: #6c757d;
  color: white;
  border: none;
  padding: 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.khria-clear-cart-btn:hover {
  background: #545b62;
}

.khria-checkout-from-cart-btn {
  flex: 2;
  /* Background color will be set dynamically via JavaScript */
  color: white;
  border: none;
  padding: 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}

/* Hover effect will be set dynamically via JavaScript */

.khria-empty-cart {
  text-align: center;
  padding: 2rem;
  color: #6c757d;
}

/* Inventory status styles */
.khria-cart-item-inventory {
  font-size: 0.85rem;
  color: #28a745;
  margin-top: 0.25rem;
}

.khria-inventory-warning {
  font-size: 0.8rem;
  color: #ff6b35;
  margin-top: 0.25rem;
}

.khria-cart-item.out-of-stock {
  opacity: 0.6;
  background: #f8f9fa;
}

.khria-cart-item.out-of-stock .khria-cart-item-inventory {
  color: #dc3545;
  font-weight: 600;
}

/* Responsive adjustments - Mobile styles from catalog */
@media (max-width: 768px) {
  .khria-cart-modal-content {
    width: 95%;
    max-height: 90vh;
  }
  
  .khria-cart-modal-header {
    padding: 0.75rem 1rem;
  }
  
  .khria-cart-modal-header h3 {
    font-size: 1.1rem;
  }
  
  .khria-cart-modal-body {
    padding: 0.75rem 1rem;
  }
  
  .khria-cart-modal-footer {
    padding: 0.75rem 1rem;
  }
  
  .khria-cart-item {
    gap: 0.75rem;
    padding: 0.75rem 0;
  }
  
  .khria-cart-item-image {
    width: 50px;
    height: 50px;
  }
  
  .khria-cart-item-controls {
    gap: 0.25rem;
  }
  
  .khria-quantity-controls {
    border-radius: 4px;
  }
  
  .khria-quantity-btn {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }
  
  .khria-quantity-display {
    padding: 0 0.5rem;
    min-width: 32px;
    font-size: 0.9rem;
  }
  
  .khria-remove-item-btn {
    padding: 0.375rem;
    font-size: 0.75rem;
  }
  
  .khria-cart-modal-actions {
    gap: 0.75rem;
  }
  
  .khria-cart-modal-total {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }
}

@media (max-width: 480px) {
  #khria-products-panel {
    width: 90vw;
    height: 70vh;
  }
  
  .khria-product-item {
    flex-direction: column;
  }
  
  .khria-product-item-image {
    width: 100%;
    height: 160px;
  }

  .khria-cart-modal-content {
    width: 95%;
    max-height: 95vh;
    margin: 1rem;
  }

  .khria-cart-item {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
    padding: 0.75rem 0;
  }

  .khria-cart-item-controls {
    justify-content: center;
    width: 100%;
  }
  
  .khria-cart-item-details {
    text-align: center;
  }
  
  .khria-cart-modal-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .khria-clear-cart-btn,
  .khria-checkout-from-cart-btn {
    flex: none;
  }
}