/* ========================================
   UPGADGET CHATBOT - Product Card Styles
   Scoped untuk n8n Chat UI
   ========================================
   
   Wrapper: .n8n-chat-ui-bot-container
   Ensures styles only apply to n8n chatbot
   and don't conflict with website styles
   
   Version: 2.0 (Optimized with wrapper)
   ======================================== */

/* Chat Response Container */
.n8n-chat-ui-bot-container .chat-response {
    margin: 10px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  }
  
  /* Greeting Message */
  .n8n-chat-ui-bot-container .chat-response .greeting {
    margin-bottom: 15px;
    color: #333;
    font-size: 15px;
    line-height: 1.5;
  }
  
  /* Product Card */
  .n8n-chat-ui-bot-container .product-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
  }
  
  /* Product Image */
  .n8n-chat-ui-bot-container .product-image-wrapper {
    text-align: center;
    margin-bottom: 15px;
  }
  
  .n8n-chat-ui-bot-container .product-image {
    width: 180px;
    height: 180px;
    border-radius: 12px;
    object-fit: contain;
    background: #f8f8f8;
    padding: 10px;
  }
  
  /* Product Info */
  .n8n-chat-ui-bot-container .product-info {
    text-align: center;
    margin-bottom: 15px;
  }
  
  .n8n-chat-ui-bot-container .product-name {
    font-size: 18px;
    font-weight: bold;
    color: #1a1a1a;
    margin-bottom: 10px;
    line-height: 1.3;
  }
  
  .n8n-chat-ui-bot-container .product-brand {
    display: inline-block;
    background: #5b7ce8;
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
  }
  
  /* Price Box */
  .n8n-chat-ui-bot-container .product-price-box {
    text-align: center;
    margin-bottom: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
  }
  
  .n8n-chat-ui-bot-container .product-price {
    font-size: 28px;
    font-weight: bold;
    color: #e74c3c;
    margin-bottom: 5px;
  }
  
  .n8n-chat-ui-bot-container .product-stock {
    font-size: 14px;
    color: #27ae60;
    font-weight: 600;
  }
  
  /* Low Stock Modifier */
  .n8n-chat-ui-bot-container .product-card.low-stock .product-stock {
    color: #e67e22;
  }
  
  .n8n-chat-ui-bot-container .product-card.low-stock .product-stock::after {
    content: " ⚠️";
  }
  
  /* Features Section */
  .n8n-chat-ui-bot-container .product-features {
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
  }
  
  .n8n-chat-ui-bot-container .features-title {
    font-size: 14px;
    color: #495057;
    margin-bottom: 10px;
    font-weight: 700;
    text-align: center;
  }
  
  .n8n-chat-ui-bot-container .features-list {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  
  .n8n-chat-ui-bot-container .features-list li {
    font-size: 14px;
    color: #495057;
    margin-bottom: 8px;
    padding-left: 24px;
    position: relative;
    line-height: 1.5;
  }
  
  .n8n-chat-ui-bot-container .features-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #27ae60;
    font-weight: bold;
  }
  
  /* Recommendation Box */
  .n8n-chat-ui-bot-container .product-recommendation {
    margin-bottom: 15px;
    padding: 12px 15px;
    background: linear-gradient(135deg, #e8f4f8 0%, #d1e7f0 100%);
    border-left: 4px solid #5b7ce8;
    border-radius: 8px;
    font-size: 14px;
    color: #2c3e50;
    line-height: 1.6;
  }
  
  /* Action Button */
  .n8n-chat-ui-bot-container .product-action {
    text-align: center;
  }
  
  .n8n-chat-ui-bot-container .btn-detail {
    display: inline-block;
    padding: 14px 28px;
    background: linear-gradient(135deg, #5b7ce8 0%, #4c6ddb 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(91, 124, 232, 0.3);
    transition: all 0.3s;
  }
  
  .n8n-chat-ui-bot-container .btn-detail:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(91, 124, 232, 0.4);
  }
  
  /* Discount Styles */
  .n8n-chat-ui-bot-container .product-card.has-discount .product-price-box {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
  }
  
  .n8n-chat-ui-bot-container .original-price {
    font-size: 18px;
    color: #999;
    text-decoration: line-through;
    margin-bottom: 5px;
  }
  
  .n8n-chat-ui-bot-container .discount-badge {
    display: inline-block;
    background: #e74c3c;
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: bold;
    margin-left: 8px;
  }
  
  /* Best Seller Badge */
  .n8n-chat-ui-bot-container .product-card.best-seller .product-brand::after {
    content: " ⭐";
  }
  
  .n8n-chat-ui-bot-container .best-seller-badge {
    display: inline-block;
    background: #f39c12;
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-left: 6px;
  }
  
  /* Summary Box (after multiple products) */
  .n8n-chat-ui-bot-container .summary-box {
    margin-top: 15px;
    padding: 16px;
    background: linear-gradient(135deg, #e8f4f8 0%, #d1e7f0 100%);
    border-radius: 12px;
    border-left: 4px solid #5b7ce8;
  }
  
  .n8n-chat-ui-bot-container .summary-box p {
    color: #2c3e50;
    font-size: 14px;
    margin: 0;
    line-height: 1.7;
  }
  
  /* Call to Action (WhatsApp) */
  .n8n-chat-ui-bot-container .cta-whatsapp {
    margin-top: 15px;
    color: #495057;
    font-size: 14px;
    text-align: center;
  }
  
  .n8n-chat-ui-bot-container .cta-whatsapp strong {
    color: #27ae60;
  }
  
  /* Mobile Responsive */
  @media (max-width: 480px) {
    .n8n-chat-ui-bot-container .product-card {
      padding: 15px;
    }
    
    .n8n-chat-ui-bot-container .product-image {
      width: 150px;
      height: 150px;
    }
    
    .n8n-chat-ui-bot-container .product-name {
      font-size: 16px;
    }
    
    .n8n-chat-ui-bot-container .product-price {
      font-size: 24px;
    }
    
    .n8n-chat-ui-bot-container .btn-detail {
      padding: 12px 24px;
      font-size: 14px;
    }
  }
  
  /* Tablet Responsive */
  @media (max-width: 768px) and (min-width: 481px) {
    .n8n-chat-ui-bot-container .product-image {
      width: 160px;
      height: 160px;
    }
    
    .n8n-chat-ui-bot-container .product-name {
      font-size: 17px;
    }
    
    .n8n-chat-ui-bot-container .product-price {
      font-size: 26px;
    }
  }
  
  /* Dark Mode Support (follows n8n theme) */
  @media (prefers-color-scheme: dark) {
    .n8n-chat-ui-bot-container .product-card {
      background: #2c2c2c;
      border-color: #444;
    }
    
    .n8n-chat-ui-bot-container .product-name {
      color: #fff;
    }
    
    .n8n-chat-ui-bot-container .features-list li {
      color: #ddd;
    }
    
    .n8n-chat-ui-bot-container .product-recommendation {
      background: linear-gradient(135deg, #2a4858 0%, #1f3540 100%);
      color: #e0e0e0;
      border-left-color: #4c6ddb;
    }
    
    .n8n-chat-ui-bot-container .summary-box {
      background: linear-gradient(135deg, #2a4858 0%, #1f3540 100%);
    }
    
    .n8n-chat-ui-bot-container .summary-box p {
      color: #e0e0e0;
    }
    
    .n8n-chat-ui-bot-container .cta-whatsapp {
      color: #ddd;
    }
    
    .n8n-chat-ui-bot-container .greeting {
      color: #ddd;
    }
  }
  
  /* Animation */
  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .n8n-chat-ui-bot-container .product-card {
    animation: fadeIn 0.3s ease-in;
  }
  
  /* Loading State */
  .n8n-chat-ui-bot-container .product-card.loading {
    opacity: 0.6;
    pointer-events: none;
  }
  
  .n8n-chat-ui-bot-container .product-card.loading .product-image {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
  }
  
  @keyframes shimmer {
    0% {
      background-position: -200% 0;
    }
    100% {
      background-position: 200% 0;
    }
  }
  
  /* Error State */
  .n8n-chat-ui-bot-container .product-card.error {
    border-color: #e74c3c;
    background: #fff5f5;
  }
  
  .n8n-chat-ui-bot-container .product-card.error .product-name {
    color: #e74c3c;
  }
  
  /* Out of Stock */
  .n8n-chat-ui-bot-container .product-card.out-of-stock .product-stock {
    color: #e74c3c;
  }
  
  .n8n-chat-ui-bot-container .product-card.out-of-stock .product-stock::before {
    content: "❌ ";
  }
  
  .n8n-chat-ui-bot-container .product-card.out-of-stock .btn-detail {
    background: #95a5a6;
    pointer-events: none;
    cursor: not-allowed;
  }
  
  /* High Specificity - Override any conflicting styles */
  .n8n-chat-ui-bot-container .n8n-chat-message-list .chat-response {
    margin: 10px 0 !important;
  }
  
  /* Ensure proper spacing in n8n chat container */
  .n8n-chat-ui-bot-container .n8n-chat-message {
    margin-bottom: 0 !important;
  }
  
  /* Fix if n8n has default padding that conflicts */
  .n8n-chat-ui-bot-container .product-card * {
    box-sizing: border-box;
  }
  
  /* Ensure images don't break layout */
  .n8n-chat-ui-bot-container .product-image {
    max-width: 100%;
    display: block;
    margin: 0 auto;
  }
  
  /* Link styling consistency */
  .n8n-chat-ui-bot-container a.btn-detail:visited {
    color: #fff;
  }
  
  .n8n-chat-ui-bot-container a.btn-detail:active {
    transform: translateY(0);
  }
  
  /* Prevent text selection on buttons for better UX */
  .n8n-chat-ui-bot-container .btn-detail {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }
  
  /* High contrast mode support */
  @media (prefers-contrast: high) {
    .n8n-chat-ui-bot-container .product-card {
      border: 2px solid #000;
    }
    
    .n8n-chat-ui-bot-container .btn-detail {
      border: 2px solid #000;
    }
  }
  
  /* Reduced motion support for accessibility */
  @media (prefers-reduced-motion: reduce) {
    .n8n-chat-ui-bot-container .product-card {
      animation: none;
    }
    
    .n8n-chat-ui-bot-container .btn-detail {
      transition: none;
    }
    
    .n8n-chat-ui-bot-container .btn-detail:hover {
      transform: none;
    }
  }
  
  /* Print styles (hide chatbot when printing) */
  @media print {
    .n8n-chat-ui-bot-container {
      display: none;
    }
  }