/* ----------------------------------------- */
/* 1. Google Fonts Import
/* ----------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ----------------------------------------- */
/* 2. Root Variables
/* ----------------------------------------- */
:root {
    /* Updated color scheme to match JM Bullion style */
    --chat-primary-color: #1a73e8; /* Blue for primary actions */
    --chat-secondary-color: #0056b3; /* Darker blue */
    --chat-user-message-bg: #1a73e8; /* Blue for user messages */
    --chat-bot-message-bg: #e8f5e9; /* Light green background for bot messages */
    --chat-bot-message-color: #1b5e20; /* Dark green text for bot messages */
    --chat-bg-color: #ffffff;
    --chat-panel-bg: #f8f9fa;
    --chat-text-color: #202124;
    --chat-border-color: #e0e0e0;
    --chat-header-bg: #ffffff;
    --chat-input-bg: #ffffff;
    --chat-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    --chat-accent-color: #34a853; /* Green for assistant responses */
    --chat-success-color: #34a853;
    --chat-text-secondary: #5f6368;
    --chat-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    --chat-shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.2);
}

/* ----------------------------------------- */
/* 3. Main Container & Toggle Button
/* ----------------------------------------- */
#bullion-chat-container {
    font-family: var(--chat-font-family);
    position: fixed;
    bottom: 20px;
    left: 20px; /* Changed from right to left */
    z-index: 999999;
}

/* Chat Launcher - Updated to rounded square with icon */
#bullion-chat-launcher {
    cursor: pointer;
}

#bullion-chat-open-button {
    background-color: var(--chat-primary-color);
    color: white;
    border: none;
    border-radius: 16px; /* Rounded square */
    width: 60px;
    height: 60px;
    font-size: 0; /* Hide text */
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

#bullion-chat-open-button:hover {
    background-color: var(--chat-secondary-color);
    box-shadow: 0 6px 20px rgba(26, 115, 232, 0.4);
    transform: translateY(-2px);
}

#bullion-chat-open-button .icon {
    width: 28px;
    height: 28px;
    position: relative;
}

#bullion-chat-open-button .icon svg {
    width: 100%;
    height: 100%;
}

/* Add plus sign to chat icon */
#bullion-chat-open-button::after {
    content: '+';
    position: absolute;
    bottom: 8px;
    right: 8px;
    font-size: 16px;
    font-weight: bold;
    color: white;
    background: var(--chat-accent-color);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Chat Window - Side panel design with overlay */
#bullion-chat-window {
    position: fixed;
    right: 0;
    bottom: 0;
    top: 0;
    width: 50%;
    max-width: 600px;
    min-width: 420px;
    background-color: var(--chat-bg-color);
    border-radius: 0;
    box-shadow: var(--chat-shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    transform-origin: center right;
    z-index: 999999;
}

#bullion-chat-window.hidden {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
}

/* Full-page overlay backdrop */
.chat-overlay-backdrop,
#bullion-chat-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999998;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.3s ease;
}

.chat-overlay-backdrop.hidden,
#bullion-chat-backdrop.hidden {
    opacity: 0;
    pointer-events: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Chat Header - Clean design */
#bullion-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--chat-border-color);
    background: #fff;
}

#bullion-chat-header .logo-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

#bullion-chat-header .chat-logo {
    height: 36px;
    width: 108px; /* 3:1 aspect ratio (36 * 3) */
    object-fit: contain;
}

#bullion-chat-header .title-text .main-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--chat-text-color);
}

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

#bullion-chat-clear-button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--chat-text-secondary);
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

#bullion-chat-clear-button:hover {
    background: #f3f4f6;
    color: var(--chat-text-color);
}

#bullion-chat-clear-button svg {
    width: 20px;
    height: 20px;
}

#bullion-chat-close-button {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--chat-text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0 8px;
    transition: color 0.2s ease;
}

#bullion-chat-close-button:hover {
    color: var(--chat-text-color);
}

/* Messages Area */
#bullion-chat-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-color: var(--chat-panel-bg);
}

/* Custom scrollbar */
#bullion-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#bullion-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#bullion-chat-messages::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 3px;
}

#bullion-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #b0b0b0;
}

.message {
    max-width: 85%;
    display: flex;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message .message-content {
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 15px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.message.assistant {
    align-self: flex-start;
}

.message.assistant .message-content {
    background-color: var(--chat-bot-message-bg);
    color: var(--chat-bot-message-color);
    border-top-left-radius: 4px;
}

.message.user {
    align-self: flex-end;
}

.message.user .message-content {
    background-color: var(--chat-user-message-bg);
    color: white;
    border-top-right-radius: 4px;
}

/* Suggested Prompts - Better styling */
.suggested-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.prompt-btn {
    background-color: var(--chat-bg-color);
    border: 1px solid var(--chat-border-color);
    border-radius: 20px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    color: var(--chat-text-color);
    font-weight: 500;
    white-space: nowrap;
}

.prompt-btn:hover {
    background-color: #e8f0fe;
    border-color: var(--chat-primary-color);
    color: var(--chat-primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Input Container */
#bullion-chat-input-container {
    padding: 20px;
    border-top: 1px solid var(--chat-border-color);
    background-color: var(--chat-bg-color);
}

.input-area {
    display: flex;
    align-items: center;
    border: 1px solid var(--chat-border-color);
    border-radius: 25px;
    background-color: var(--chat-input-bg);
    padding: 4px;
    transition: all 0.3s ease;
}

.input-area:focus-within {
    border-color: var(--chat-primary-color);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

/* File upload button */
.file-upload-btn {
    background: none;
    border: none;
    color: var(--chat-text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    margin-left: 4px;
}

.file-upload-btn:hover {
    background-color: #f5f5f5;
    color: var(--chat-text-color);
}

.file-upload-btn svg {
    width: 20px;
    height: 20px;
}

#bullion-chat-input {
    flex-grow: 1;
    border: none;
    background: none;
    padding: 10px 15px;
    font-size: 15px;
    resize: none;
    height: 24px;
    max-height: 100px;
    outline: none;
    color: var(--chat-text-color);
    font-family: var(--chat-font-family);
}

#bullion-chat-send-button {
    background-color: var(--chat-primary-color);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 4px;
}

#bullion-chat-send-button:hover {
    background-color: var(--chat-secondary-color);
    transform: scale(1.05);
}

#bullion-chat-send-button:disabled {
    background-color: #cbd5e1;
    cursor: not-allowed;
}

#bullion-chat-send-button svg {
    width: 20px;
    height: 20px;
}

/* Image Preview Styles */
.image-preview-container {
    padding: 12px;
    background: #f8fafc;
    border-bottom: 1px solid var(--chat-border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.image-preview {
    position: relative;
    display: inline-block;
}

.preview-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--chat-border-color);
}

.remove-image-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #ef4444;
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.remove-image-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.remove-image-btn svg {
    width: 14px;
    height: 14px;
}

.image-name {
    font-size: 13px;
    color: var(--chat-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.disclaimer {
    font-size: 11px;
    color: var(--chat-text-secondary);
    margin-top: 8px;
    text-align: center;
}

/* Enhanced Loading Animation */
.loading-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background-color: var(--chat-accent-color);
    border-radius: 50%;
    animation: pulse 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes pulse {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
    opacity: 1;
    }
}

/* Loading Facts Display */
.loading-facts-container {
    padding: 20px !important;
    background: linear-gradient(135deg, #f6f9fc 0%, #e9f0f8 100%);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}

.loading-fact-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.loading-fact-header .loading-dots {
    flex-shrink: 0;
}

.loading-text {
    font-size: 14px;
    color: var(--chat-text-secondary);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.loading-fact-content {
    transition: opacity 0.3s ease;
    min-height: 80px;
}

.fact-category {
    font-size: 13px;
    font-weight: 600;
    color: var(--chat-primary-color);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fact-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--chat-text-color);
    font-weight: 400;
    min-height: 48px;
    display: flex;
    align-items: center;
}

.fact-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.fact-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--chat-primary-color), var(--chat-accent-color));
    width: 0%;
    transition: width 5s linear;
    box-shadow: 0 0 8px rgba(26, 115, 232, 0.3);
}

/* Enhanced loading message styling */
.loading-message .message-content {
    background: white !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--chat-border-color);
}

/* Mobile responsiveness for facts display */
@media (max-width: 768px) {
    .loading-facts-container {
        padding: 16px !important;
    }
    
    .loading-fact-header {
        margin-bottom: 16px;
    }
    
    .loading-text {
        font-size: 13px;
    }
    
    .fact-category {
        font-size: 12px;
    }
    
    .fact-text {
        font-size: 14px;
        min-height: 40px;
    }
}

@media (max-width: 480px) {
    .loading-facts-container {
        padding: 14px !important;
    }
    
    .loading-fact-header {
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .loading-text {
        font-size: 12px;
    }
    
    .fact-text {
        font-size: 13px;
        line-height: 1.5;
    }
}

/* Dark mode support for facts display */
@media (prefers-color-scheme: dark) {
    .loading-facts-container {
        background: linear-gradient(135deg, #1e1e1e 0%, #2a2a2a 100%);
    }
    
    .loading-message .message-content {
        background: #2a2a2a !important;
        border-color: #444;
    }
    
    .fact-progress {
        background: rgba(255, 255, 255, 0.05);
    }
}

/* Product Display - Enhanced carousel style */
.products-container {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.product-category {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.product-category h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--chat-text-color);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--chat-accent-color);
}

.products-carousel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-behavior: smooth;
}

.products-carousel::-webkit-scrollbar {
    height: 6px;
}

.products-carousel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.products-carousel::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 3px;
}

.product-card {
    min-width: 200px;
    max-width: 200px; /* Add max-width to prevent expansion */
    flex: 0 0 200px; /* Prevent flex grow/shrink, maintain fixed size */
    border: 1px solid var(--chat-border-color);
    border-radius: 12px;
    padding: 12px;
    background-color: #fff;
    transition: all 0.3s ease;
    cursor: pointer;
}

.product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: var(--chat-primary-color);
}

.product-card .product-image {
    width: 100%;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

.product-card .product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-card .product-info {
    text-align: center;
}

.product-card .product-info .product-name {
    font-weight: 600;
    color: var(--chat-text-color);
    text-decoration: none;
    font-size: 14px;
    display: block;
    margin-bottom: 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .product-info .product-name:hover {
    color: var(--chat-primary-color);
}

.product-card .product-info .product-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--chat-accent-color);
    margin: 4px 0 8px 0;
}

/* New styles for product attributes */
.product-attributes {
    margin: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

.product-attribute {
    font-size: 12px;
    color: var(--chat-text-secondary);
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.product-card .product-info .product-description {
    font-size: 12px;
    color: var(--chat-text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 8px;
}

/* ----------------------------------------- */
/* 4. Carousel Styles  
/* ----------------------------------------- */

.products-carousel-container {
    border-color: var(--chat-border-color);
}

.products-carousel-header {
    border-bottom-color: var(--chat-border-color);
}

.products-carousel-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 12px 12px 0 0;
}

.products-carousel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--chat-border-color);
}

.products-carousel-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 6px;
}

.products-carousel-header h4::before {
    content: '🛍️';
    font-size: 14px;
}

.carousel-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f9fafb;
    padding: 6px 10px;
    border-radius: 20px;
    border: 1px solid var(--chat-border-color);
}

.carousel-btn {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.3);
}

.carousel-btn:hover {
    background: #2563eb;
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
}

.carousel-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.carousel-counter {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
    min-width: 35px;
    text-align: center;
    background: white;
    padding: 2px 6px;
    border-radius: 10px;
    border: 1px solid var(--chat-border-color);
}

.products-carousel {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #fafafa;
    border: 1px solid var(--chat-border-color);
}

.products-track {
    display: flex;
    transition: transform 0.4s ease;
    will-change: transform;
}

.product-slide {
    min-width: 100%;
    flex-shrink: 0;
    opacity: 0;
    transform: scale(0.98);
    transition: all 0.4s ease;
}

.product-slide.active {
    opacity: 1;
    transform: scale(1);
}

.product-slide .product-card {
    margin: 0;
    border: none;
    box-shadow: none;
    padding: 16px;
    background: white;
    border-radius: 8px;
    height: auto;
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

.product-slide .product-header {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: flex-start;
}

.product-slide .product-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.product-slide:hover .product-image {
    transform: scale(1.05);
}

.product-slide .product-info {
    flex: 1;
    min-width: 0;
}

.product-slide .product-info h4 {
    font-size: 14px;
    margin: 0 0 6px 0;
    line-height: 1.3;
    color: #374151;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-slide .product-price {
    font-size: 16px;
    margin: 0;
    font-weight: 700;
    color: #059669;
}

.product-attributes {
    margin: 12px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.product-attributes .attribute {
    background: #f3f4f6;
    color: #6b7280;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid var(--chat-border-color);
}

.product-actions {
    margin-top: auto;
    padding-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--chat-border-color);
}

.product-link {
    background: #3b82f6;
    color: white;
    padding: 8px 16px;
    border-radius: 16px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.product-link:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.stock-info {
    font-size: 10px;
    color: #059669;
    background: #ecfdf5;
    padding: 4px 8px;
    border-radius: 10px;
    font-weight: 600;
    border: 1px solid #d1fae5;
    flex-shrink: 0;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--chat-border-color);
}

.carousel-dot {
    background: #d1d5db;
    border: none;
    border-radius: 50%;
    width: 8px;
    height: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.carousel-dot.active {
    background: #3b82f6;
    transform: scale(1.2);
}

.carousel-dot:hover:not(.active) {
    background: #9ca3af;
    transform: scale(1.1);
}

/* ----------------------------------------- */
/* 5. Responsive Design
/* ----------------------------------------- */
@media (max-width: 768px) {
    #bullion-chat-container {
        bottom: 15px;
        left: 15px;
    }
    
    #bullion-chat-open-button {
        width: 56px;
        height: 56px;
    }
    
    #bullion-chat-open-button .icon {
        width: 24px;
        height: 24px;
    }
    
    #bullion-chat-window {
        right: 0;
        left: 0;
        bottom: 0;
        top: 0;
        width: 100%; /* Full width on mobile */
        max-width: 100%;
        min-width: auto;
        border-radius: 0;
        height: 100vh;
    }
    
    #bullion-chat-window.hidden {
        transform: translateY(100%);
    }
    
    #bullion-chat-header {
        padding: 16px;
        position: sticky;
        top: 0;
        z-index: 10;
        background: white;
    }
    
    #bullion-chat-header .chat-logo {
        height: 30px;
        width: 90px; /* Maintain 3:1 ratio */
    }
    
    #bullion-chat-header .title-text .main-title {
        font-size: 14px;
    }
    
    .chat-header-actions {
        gap: 4px;
    }
    
    #bullion-chat-clear-button svg {
        width: 18px;
        height: 18px;
    }
    
    #bullion-chat-messages {
        padding: 16px;
    }
    
    .message {
        max-width: 100%;
    }
    
    .suggested-prompts {
        padding: 0 8px;
    }
    
    .prompt-btn {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .product-card {
        min-width: 160px;
        max-width: 160px;
        flex: 0 0 160px;
    }
    
    .product-card .product-image {
        height: 100px;
    }
    
    .product-card .product-info .product-name {
        font-size: 12px;
    }
    
    .product-card .product-info .product-price {
        font-size: 16px;
    }
    
    .product-attributes {
        gap: 2px;
    }
    
    .product-attribute {
        font-size: 10px;
    }
    
    .carousel-dots {
        margin-top: 12px;
    }
    
    .carousel-dot {
        width: 6px;
        height: 6px;
    }
    
    #bullion-chat-input-container {
        padding: 12px 16px;
    }
    
    .image-preview-container {
        padding: 10px;
    }
    
    .preview-image {
        width: 50px;
        height: 50px;
    }
    
    .image-name {
        font-size: 12px;
    }
    
    .chat-overlay-backdrop,
    #bullion-chat-backdrop {
        display: block !important;
    }
}

@media (max-width: 480px) {
    #bullion-chat-container {
        bottom: 10px;
        left: 10px;
    }

    #bullion-chat-open-button {
        width: 50px;
        height: 50px;
    }

    #bullion-chat-open-button::after {
        width: 18px;
        height: 18px;
        font-size: 14px;
        bottom: 6px;
        right: 6px;
    }

    #bullion-chat-header .title-text .main-title {
        font-size: 16px;
    }

    #bullion-chat-header .chat-logo {
        width: 36px;
        height: 36px;
    }

    .message .message-content {
        font-size: 14px;
        padding: 10px 14px;
    }

    .product-category h4 {
        font-size: 14px;
    }

    .product-card {
        min-width: 140px;
        padding: 10px;
    }

    .product-card .product-image {
        height: 80px;
    }

    .product-card .product-info .product-name {
        font-size: 12px;
}

    .product-card .product-info .product-price {
        font-size: 14px;
    }

    .disclaimer {
        font-size: 11px;
    }
}

/* Landscape mode adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    #bullion-chat-window {
        top: 10px;
        height: calc(100vh - 20px);
    }

    #bullion-chat-messages {
        padding: 12px;
    }

    .suggested-prompts {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

/* ----------------------------------------- */
/* 6. Loading Animation
/* ----------------------------------------- */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background-color: var(--chat-secondary-color);
    border-radius: 50%;
    animation: loading-bounce 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes loading-bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ----------------------------------------- */
/* 7. Accessibility & Theme Support
/* ----------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    #bullion-chat-window {
        border: 2px solid var(--chat-text-color);
    }

    .message.assistant .message-content {
        border: 1px solid var(--chat-text-color);
    }

    .prompt-btn {
        border-width: 2px;
    }

    .product-card {
        border-width: 2px;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --chat-bg-color: #1e1e1e;
        --chat-panel-bg: #121212;
        --chat-text-color: #e0e0e0;
        --chat-border-color: #333;
        --chat-header-bg: #1e1e1e;
        --chat-input-bg: #2a2a2a;
        --chat-text-secondary: #999;
        --chat-bot-message-bg: #1a3a1a;
        --chat-bot-message-color: #90ee90;
    }

    .product-card {
        background-color: #2a2a2a;
        border-color: #444;
    }
    
    .product-card:hover {
        border-color: var(--chat-primary-color);
    }

    .prompt-btn {
        background-color: #2a2a2a;
        border-color: #444;
    }

    .prompt-btn:hover {
        background-color: #3a3a3a;
    }

    #bullion-chat-close-button:hover {
        background-color: #333;
    }
    
    .file-upload-btn:hover {
        background-color: #333;
    }
    
    .input-area {
        background-color: var(--chat-input-bg);
        border-color: #444;
    }
    
    .product-category {
        background: #2a2a2a;
    }
}



/* Print styles */
@media print {
    #bullion-chat-container {
        display: none;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    #bullion-chat-open-button {
        width: 48px;
        height: 48px;
    }
    
    #bullion-chat-open-button .icon {
        width: 20px;
        height: 20px;
    }
    
    #bullion-chat-open-button::after {
        display: none; /* Hide plus sign on very small screens */
    }
    
    .product-card {
        min-width: 120px;
    }
}

/* Carousel wrapper for auto-scroll functionality */
.carousel-wrapper {
    position: relative;
}

/* ----------------------------------------- */
/* 8. Enhanced Message Formatting
/* ----------------------------------------- */
.message-content h4.chat-headline {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 16px 0 8px 0;
    line-height: 1.4;
}

.message-content h4.chat-headline:first-child {
    margin-top: 0;
}

.message-content .chat-link {
    color: #0066cc;
    text-decoration: none;
    border-bottom: 1px solid #cce0ff;
    transition: all 0.2s ease;
}

.message-content .chat-link:hover {
    color: #0052cc;
    border-bottom-color: #0066cc;
    background-color: #f0f7ff;
}

.message-content .chat-list {
    margin: 12px 0;
}

.message-content .list-item {
    margin: 8px 0;
    padding-left: 24px;
    position: relative;
}

.message-content .list-number {
    position: absolute;
    left: 0;
    font-weight: 600;
    color: #666;
}

.message-content strong {
    font-weight: 600;
    color: #333;
}

.message-content .list-bullet {
    position: absolute;
    left: 0;
    font-weight: 600;
    color: #666;
    font-size: 16px;
} 