/* eComplex ChatBot Widget Styles */

:root {
    --cb-primary: #BF3D32;
    --cb-primary-hover: #a8352b;
    --cb-bg-light: rgba(255, 255, 255, 0.72);
    --cb-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
    --cb-border: 1px solid rgba(255, 255, 255, 0.45);
    --cb-radius: 16px;
    --cb-font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#ecomplex-chatbot-wrapper {
    font-family: var(--cb-font-family);
}

/* Chat bubble launcher button */
#ecomplex-chat-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background-color: var(--cb-primary);
    color: #ffffff;
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(191, 61, 50, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2147483647;
    border: none;
    outline: none;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

#ecomplex-chat-launcher:hover {
    background-color: var(--cb-primary-hover);
    transform: scale(1.08);
}

#ecomplex-chat-launcher svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

/* Heartbeat pulse effect */
.cb-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--cb-primary);
    opacity: 0.4;
    z-index: -1;
    animation: cb-heartbeat 2s infinite;
}

@keyframes cb-heartbeat {
    0% {
        transform: scale(1);
        opacity: 0.4;
    }

    50% {
        transform: scale(1.3);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* Chat window container */
#ecomplex-chat-container {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    height: 520px;
    max-height: calc(100vh - 120px);
    max-width: calc(100vw - 48px);
    background: var(--cb-bg-light);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--cb-border);
    border-radius: var(--cb-radius);
    box-shadow: var(--cb-shadow);
    z-index: 2147483647;
    display: flex;
    flex-direction: column;
    overflow: hidden;

    /* Smooth scaling open/close animations */
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}

#ecomplex-chat-container.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Chat Header */
.cb-header {
    background-color: #1a1a1a;
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.cb-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
}

.cb-header-status {
    width: 8px;
    height: 8px;
    background-color: #2ec4b6;
    border-radius: 50%;
    display: inline-block;
}

.cb-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    padding: 0;
    transition: color 0.2s ease;
}

.cb-close-btn:hover {
    color: #ffffff;
}

/* Chat message display area */
.cb-messages-area {
    flex: 1;
    padding: 20px 20px 30px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    background: rgba(245, 246, 248, 0.4);
}

/* Individual message bubbles */
.cb-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
}

/* User message */
.cb-message.user {
    align-self: flex-end;
    background-color: var(--cb-primary);
    color: #ffffff;
    border-bottom-right-radius: 2px;
    box-shadow: 0 2px 8px rgba(191, 61, 50, 0.15);
}

/* Assistant message */
.cb-message.assistant {
    align-self: flex-start;
    background-color: #ffffff;
    color: #2d3748;
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.cb-message.assistant a {
    color: var(--cb-primary);
    text-decoration: underline;
    font-weight: 600;
}

.cb-message.assistant a:hover {
    color: var(--cb-primary-hover);
}

/* Typing indicator bubble */
.cb-typing-indicator {
    align-self: flex-start;
    background-color: #ffffff;
    padding: 12px 18px;
    border-radius: 12px;
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: none;
    align-items: center;
    gap: 4px;
}

.cb-dot {
    width: 6px;
    height: 6px;
    background-color: #718096;
    border-radius: 50%;
    animation: cb-bounce 1.4s infinite ease-in-out both;
}

.cb-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.cb-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes cb-bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1.0);
    }
}

/* Chat Input Footer */
.cb-input-footer {
    padding: 12px 16px;
    background: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    gap: 8px;
    align-items: center;
}

.cb-input-field {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.cb-input-field:focus {
    border-color: var(--cb-primary);
    box-shadow: 0 0 0 3px rgba(191, 61, 50, 0.15);
}

.cb-send-btn {
    background-color: var(--cb-primary);
    color: #ffffff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.cb-send-btn:hover {
    background-color: var(--cb-primary-hover);
    transform: scale(1.05);
}

.cb-send-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    transform: rotate(45deg);
}

/* Custom Scrollbar for messages area */
.cb-messages-area::-webkit-scrollbar {
    width: 6px;
}

.cb-messages-area::-webkit-scrollbar-track {
    background: transparent;
}

.cb-messages-area::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

/* Products horizontal carousel list */
.cb-products-carousel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 4px 10px 4px;
    margin-top: 4px;
    margin-bottom: 8px;
    align-self: flex-start;
    width: 100%;
    box-sizing: border-box;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    flex-shrink: 0;
    min-height: 195px;
}

/* Product Card */
.cb-product-card {
    flex: 0 0 145px;
    width: 145px;
    min-height: 180px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    text-decoration: none !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    scroll-snap-align: start;
    box-sizing: border-box;
}

.cb-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: rgba(191, 61, 50, 0.2);
}

/* Image wrapper */
.cb-card-img-wrap {
    width: 100%;
    height: 95px;
    background-color: #fcfcfc;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    box-sizing: border-box;
}

.cb-card-img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: none;
}

/* Product details wrapper */
.cb-card-info {
    padding: 10px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
}

.cb-card-title {
    font-size: 11px;
    font-weight: 600;
    color: #2d3748;
    line-height: 1.4;
    height: 32px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 8px;
    text-align: left;
}

.cb-card-footer {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cb-card-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--cb-primary);
    text-align: left;
}

.cb-card-stock {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    text-align: left;
}

.cb-card-stock.in-stock {
    color: #2ec4b6;
}

.cb-card-stock.out-of-stock {
    color: #e63946;
}

/* Carousel scrollbar style */
.cb-products-carousel::-webkit-scrollbar {
    height: 4px;
}

.cb-products-carousel::-webkit-scrollbar-track {
    background: transparent;
}

.cb-products-carousel::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

/* Lead Overlay form */
.cb-lead-overlay {
    position: absolute;
    top: 50px;
    /* Below header */
    left: 0;
    width: 100%;
    height: calc(100% - 50px);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: cb-fade-in 0.25s ease-out;
}

@keyframes cb-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.cb-lead-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 24px;
    width: 82%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    text-align: center;
}

.cb-lead-card h4 {
    margin-top: 0;
    margin-bottom: 8px;
    color: #1a1a1a;
    font-size: 16px;
    font-weight: 700;
}

.cb-lead-card p {
    margin: 0 0 16px 0;
    font-size: 12px;
    color: #718096;
    line-height: 1.45;
}

.cb-lead-error {
    color: #e63946;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.35;
    text-align: left;
}

.cb-form-group {
    margin-bottom: 12px;
    width: 100%;
}

.cb-form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.cb-form-group input:focus {
    border-color: var(--cb-primary);
    box-shadow: 0 0 0 3px rgba(191, 61, 50, 0.1);
}

.cb-lead-submit-btn {
    width: 100%;
    background-color: var(--cb-primary);
    color: #ffffff;
    border: none;
    padding: 11px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.cb-lead-submit-btn:hover {
    background-color: var(--cb-primary-hover);
}

.cb-lead-submit-btn:active {
    transform: scale(0.98);
}

/* Mobile responsive styles */
@media (max-width: 480px) {
    #ecomplex-chat-container {
        bottom: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        max-width: 100% !important;
        border-radius: 0 !important;
        border: none !important;
    }
}

/* Custom Header actions layout */
.cb-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cb-reset-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.2s ease, transform 0.2s ease;
}

.cb-reset-btn:hover {
    color: #ffffff;
    transform: rotate(35deg);
}

.cb-reset-btn svg {
    display: block;
}

/* Quick Suggestion Chips Styling */
.cb-suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
    padding: 0 4px;
    align-self: flex-start;
    animation: cb-fade-in 0.3s ease-out;
}

.cb-suggestion-chip {
    background-color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 18px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 500;
    color: #2d3748;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.cb-suggestion-chip:hover {
    background-color: #ffffff;
    border-color: var(--cb-primary);
    color: var(--cb-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.cb-suggestion-chip:active {
    transform: scale(0.97);
}

/* Recommended Product Add-to-cart Button Styling */
.cb-add-to-cart-btn {
    background-color: var(--cb-primary);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    width: 100%;
    margin-top: 4px;
    outline: none;
    box-sizing: border-box;
    display: inline-block;
    text-align: center;
}

.cb-add-to-cart-btn:hover {
    background-color: var(--cb-primary-hover);
    transform: translateY(-1px);
}

.cb-add-to-cart-btn:active {
    transform: scale(0.97);
}

.cb-add-to-cart-btn.loading {
    background-color: #a0aec0;
    color: #ffffff;
    cursor: not-allowed;
    transform: none;
    pointer-events: none;
}

.cb-add-to-cart-btn.added {
    background-color: #2ec4b6;
    color: #ffffff;
    cursor: default;
    transform: none;
}