/* Debug: button_color = #880808, header_color = #630330 */
.hidden {
    display: none !important;
}

#ai-chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    background-color: #880808;
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

#ai-chat-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 400px;
    max-height: 85vh;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Media query for desktop (screens larger than 768px) */
@media (min-width: 769px) {
    #ai-chat-container {
        max-height: 75vh;
    }

    #ai-chat-messages {
        height: 40vh;
    }

    .ai-chat-product-carousel {
        height: 250px;
    }
}

#ai-chat-header {
    background-color: #630330;
    color: white;
    padding: 8px 15px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#ai-chat-close, #ai-chat-clear, #ai-chat-storefront {
    background: none;
    border: none;
    color: white;
    font-size: 25px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    position: relative; /* Add position for pseudo-element */
}

#ai-chat-clear::before {
    content: '\21BB'; /* Unicode for a refresh/clear icon (↻) */
    font-family: Arial, sans-serif;
    display: inline-block;
}

#ai-chat-storefront::before {
    content: '\1F6D2'; /* Unicode for a shopping cart/storefront icon (🛒) */
    font-family: Arial, sans-serif;
    display: inline-block;
}

#ai-chat-messages {
    height: 40vh;
    padding: 15px;
    overflow-y: auto;
    background: #f9f9f9;
}

#ai-chat-input {
    padding: 15px;
    border-top: 1px solid #ddd;
    background: #fff;
    width: 100%;
    box-sizing: border-box;
}

#ai_chat_question {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: none;
    height: 60px;
    box-sizing: border-box;
    margin-bottom: 10px;
}

#ai-chat-input .ai-chat-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

#ai-chat-submit {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
}

#ai-chat-cs {
    background: none;
    border: none;
    color: #28a745;
    cursor: pointer;
    font-size: 14px;
}

#ai-chat-contact-form {
    padding: 15px;
}

#ai-chat-human {
    border-top: 1px solid #ddd;
}

.ai-chat-product-carousel {
    padding: 5px;
    overflow-x: auto;
    white-space: nowrap;
    border-top: 1px solid #ddd;
    height: 250px;
    background: #f9f9f9;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.ai-chat-product-item {
    flex: 0 0 auto;
    width: 140px;
    text-align: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 5px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: 200px;
}

.ai-chat-product-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
    margin: 0 auto;
    margin-top: 5px;
}

.ai-chat-product-item p {
    margin: 3px 0;
    font-size: 11px;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    flex-grow: 1;
}

.ai-chat-product-item button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    margin: 2px 0;
    width: 100%;
}

.ai-chat-product-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 380px;
    max-height: 95vh;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.3);
    z-index: 10000;
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
}

.ai-chat-product-popup img {
    width: 60%;
    height: auto;
    max-height: 230px;
    margin: 0 auto;
   // object-fit: contain;
    border-radius: 8px;
}

.ai-chat-product-popup .popup-content {
    margin-top: 15px;
}

.ai-chat-product-popup h3 {
    margin: 0 0 8px;
    font-size: 15px;
}

.ai-chat-product-popup p {
    margin: 5px 0;
    font-size: 11px;
    max-height: 100px;
    overflow-y: auto;
}

/* Close button styles */
.ai-chat-product-popup .close-popup {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 28px;
    cursor: pointer;
    background: none;
    border: none;
    color: #020202;
    line-height: 1;
    z-index: 10001;
    width: 30px;
    height: 30px;
    text-align: center;
}

.ai-chat-product-popup .close-popup::before {
    content: '\00D7';
    font-family: Arial, sans-serif;
    display: inline-block;
    font-weight: bold;
    color: #333;
}

.ai-chat-product-popup .close-popup:hover {
    color: #ff0000;
}

/* Wrapper for the description */
.ai-chat-product-popup .description-content {
    text-align: left;
    font-size: 13px;
    line-height: 1.7;
}

/* Center images and iframes, override inline styles */
.ai-chat-product-popup .description-content img,
.ai-chat-product-popup .description-content iframe {
    display: block !important;
    margin: 0 auto;
//    margin: 10px auto !important;
    float: none !important;
    max-width: 100% !important;
}

/* Style for small icons in the description (e.g., Wood, Water, Earth icons) */
.ai-chat-product-popup .description-content img[src*="icon"],
.ai-chat-product-popup .description-content img[src*="emoji"] {
    width: 20px !important;
    height: 20px !important;
    display: inline-block !important;
    margin: 0 5px 0 0 !important;
    vertical-align: middle;
}

/* Style for larger images like video thumbnails */
.ai-chat-product-popup .description-content img:not([src*="icon"]):not([src*="emoji"]),
.ai-chat-product-popup .description-content iframe {
    width: 260px !important;
    height: 330px !important;
    margin: 0 auto;
}

/* Mobile: Ensure the popup fits within the screen */
@media (max-width: 768px) {
    .ai-chat-product-popup {
        width: 90%;
        max-width: 350px;
        margin: 0 auto;
        padding: 15px;
    }
    .ai-chat-product-popup img {
        max-height: 230px;
        margin: 0 auto; /* Center the image horizontally */
    display: block; /* Ensure the image behaves like a block element */
     border-radius: 8px;
    }

    .ai-chat-product-popup .description-content img:not([src*="icon"]):not([src*="emoji"]),
    .ai-chat-product-popup .description-content iframe {
        width: 300px !important;
        margin: 0 auto;
        
    }
}

/* Desktop: Wider popup and left-aligned description */
@media (min-width: 769px) {
    .ai-chat-product-popup {
        width: 500px;
        max-width: none;
        max-height: 85vh;
        padding: 25px;
    }

    .ai-chat-product-popup img {
        max-height: 230px;
        margin: 0 auto; /* Center the image horizontally */
    display: block; /* Ensure the image behaves like a block element */
     border-radius: 8px;
    }

    .ai-chat-product-popup h3 {
        font-size: 23px;
        text-align: left;
    }

    .ai-chat-product-popup p {
        font-size: 13px;
    }

    .ai-chat-product-popup .description-content {
        text-align: left;
    }

    .ai-chat-product-popup .description-content img:not([src*="icon"]):not([src*="emoji"]),
    .ai-chat-product-popup .description-content iframe {
        margin: 0 10px 10px 0 !important;
              float: center !important;
        width: 300px !important;
    }
}

/* Media query for very small screens (screens smaller than 400px) */
@media (max-width: 400px) {
    #ai-chat-container {
    margin: 0 auto; 
        width: 318px;
        max-height: 78vh;
        bottom: 50px;
        right: auto;
        left: 50%;
        transform: translateX(-50%);
    }
    #ai-chat-messages {
        height: 30vh;
    }
    .ai-chat-product-carousel {
        height: 220px;
    }
}

/* Force text wrapping for page content */
.entry-content, .page-content, p {
    white-space: normal !important;
    word-wrap: break-word !important;
    max-width: 100% !important;
}