/* Floating Chat Button */
.ai-sales-agent-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background-color: #062d2c;
    color: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 99999;
    transition: transform 0.2s;
}

.ai-sales-agent-button:hover {
    transform: scale(1.05);
}

.ai-sales-agent-button svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

/* Global Reset for Widget */
.ai-sales-agent-window * {
    box-sizing: border-box;
}

/* Chat Window */
.ai-sales-agent-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 650px;
    max-height: 80vh;
    background-color: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border-radius: 12px;

    /* Layout Enforced */
    display: flex;
    flex-direction: column;

    /* Visibility Animation */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);

    z-index: 99999;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.ai-sales-agent-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Header */
.ai-sales-agent-header {
    background-color: #000;
    /* Black header per reference */
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-header-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
}

.ai-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-header-info {
    display: flex;
    flex-direction: column;
}

.ai-header-name {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
}

.ai-header-status {
    font-size: 12px;
    opacity: 0.8;
}

.ai-sales-agent-close {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.ai-sales-agent-close:hover {
    opacity: 1;
}

.ai-sales-agent-close svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

/* Messages Area */
.ai-sales-agent-messages {
    flex: 1 1 auto;
    /* Grow and shrink */
    min-height: 0;
    /* Crucial for scrolling in nested flex containers */
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    /* Prevent horizontal scroll of the container */
    background-color: #fff;
    /* White background */
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-message {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 80%;
    word-wrap: break-word;
}

.ai-message.agent {
    background-color: #f4f4f4;
    /* Light gray for agent */
    color: #000;
    border-bottom-left-radius: 2px;
    margin-right: auto;
}

.ai-message.user {
    background-color: #fff;
    color: #000;
    border: 1px solid #e0e0e0;
    border-bottom-right-radius: 2px;
    margin-left: auto;
}

/* Suggestions / Chips */
.ai-suggestions {
    flex: 0 0 auto;
    /* Don't shrink */
    padding: 10px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    background-color: #fff;
    /* Ensure bg covers messages if needed */
}

.ai-suggestion-chip {
    background: #f4f4f4;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
    color: #333;
    white-space: nowrap;
}

.ai-suggestion-chip:hover {
    background: #e0e0e0;
}

/* Input Area (Capsule Style) */
.ai-sales-agent-input-area {
    flex: 0 0 auto;
    /* Don't shrink */
    padding: 10px 20px 20px 20px;
    background: #fff;
    position: relative;
    /* Context */
    z-index: 10;
}

.ai-input-wrapper {
    display: flex;
    align-items: center;
    background: #f4f4f4;
    /* Light gray container */
    border-radius: 12px;
    padding: 8px 12px;
    position: relative;
    border: 1px solid transparent;
    transition: border 0.2s;
}

.ai-input-wrapper:focus-within {
    border-color: #ccc;
    background: #fff;
    box-shadow: 0 0 0 1px #eee;
}

.ai-input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    padding: 8px;
    outline: none;
    color: #333;
    min-width: 0;
    /* Flexbox fix */
}

/* Input Wrapper Button */
.ai-input-wrapper button {
    flex: 0 0 auto;
    background: transparent;
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: #a0aec0;
    /* Disabled text color */
    cursor: not-allowed;
    transition: all 0.2s;
    background-color: #f1f5f9;
}

/* Enabled State */
.ai-input-wrapper input:not(:placeholder-shown)+button {
    background: #062d2c;
    color: #fff;
    cursor: pointer;
}

/* No SVG styles needed for button anymore */

/* Product Carousel */
.ai-product-carousel {
    display: flex;
    overflow-x: auto;
    /* Required for scrolling */
    gap: 12px;
    padding: 10px 10px 25px 10px;
    /* More padding to prevent shadow clipping */
    width: 100%;
    /* Strict width */
    max-width: 100%;
    scrollbar-width: none;
    /* Keep cleaner look */
    scroll-behavior: smooth;
    mask-image: linear-gradient(to right, black 95%, transparent 100%);
    /* Fade out effect */
    -webkit-mask-image: linear-gradient(to right, black 95%, transparent 100%);

    /* Layout Fixes */
    flex: 0 0 auto;
    /* Prevent shrinking */
    min-height: 280px;
    /* Ensure strictly visible */
    box-sizing: border-box;
    align-items: flex-start;
    /* Align Top */
}

.ai-product-carousel::-webkit-scrollbar {
    display: none;
}

/* Card Actions & Links */
.ai-card-actions {
    padding: 0 12px 12px 12px;
}

.ai-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    cursor: pointer;
}

.ai-card-link:hover h4 {
    color: #062d2c;
}

.ai-product-card {
    flex: 0 0 auto;
    /* CRITICAL: Prevent shrinking */
    width: 220px;
    /* Fixed width */
    min-width: 220px;
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s;
    overflow: hidden;
    position: relative;
    height: auto;
}

.ai-product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.ai-product-card img {
    width: 100% !important;
    height: 180px !important;
    /* Force height */
    min-height: 180px !important;
    object-fit: cover !important;
    background: #fafafa;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
}

.ai-card-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    /* Fill remaining space */
}

.ai-product-card h4 {
    font-size: 14px;
    margin: 0;
    line-height: 1.3;
    color: #333;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-product-card .price {
    font-weight: 700;
    font-size: 14px;
    color: #000;
}

/* "ADD" Button Style */
.ai-product-card .btn-shop {
    background-color: #3b82f6;
    /* Bright Blue like reference */
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 0;
    border-radius: 6px;
    text-align: center;
    width: 100%;
    display: block;
    margin-top: 5px;
    transition: background-color 0.2s;
}

.ai-product-card .btn-shop:hover {
    background-color: #2563eb;
}