/*
 * Plugin Name: AI Store Assistant
 * Description: Styles for the AI Chatbot interface.
 */

/* ======================================= */
/* Floating AI Bot Icon and Initial Popup  */
/* ======================================= */
#ai-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    pointer-events: none;
}

#ai-chatbot-container > * {
    pointer-events: auto;
}

/* Bot Icon Styles */
#ai-bot-icon {
    width: 60px;
    height: 60px;
    border: 1px solid rgba(38, 255, 0, 0.3);
    border-radius: 50%;
    box-shadow: inset 2px 2px 1px 0 rgba(255, 255, 255, 0.5),
    inset -1px -1px 1px 1px rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 2.2);
    backdrop-filter: blur(3px);
    isolation: isolate;
    -webkit-backdrop-filter: blur(3px);
    background: rgba(38, 255, 0, 0.08);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transform: scale(0);
    animation: scaleIn 0.3s forwards ease-out 1s;
}

#ai-bot-icon:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

#ai-bot-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Initial Message Popup Styles */
#ai-bot-message-popup {
    background-color: white;
    color: black;
    font-weight: bold;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    max-width: 200px;
    text-align: center;
    position: absolute;
    bottom: 75px;
    right: 10px;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    animation: fadeInSlideUp 0.5s forwards ease-out 1.2s;
}

/* Animations */
@keyframes scaleIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes fadeInSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.8); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ======================================= */
/* Main Chatbot Interface Styles         */
/* ======================================= */
#ai-chatbot-main {
    background-color: #f7f7f7;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    width: 340px; 
    height: 500px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    pointer-events: auto;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

#ai-chatbot-main.open {
    transform: scale(1);
    opacity: 1;
    display: flex;
}

#ai-chatbot-main.closed {
    transform: scale(0.9);
    opacity: 0;
    display: none;
}

/* Chatbox Header */
.chatbot-header {
    background-color: #114232;
    color: white;
    padding: 15px;
    font-size: 1.1em;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

.chatbot-header .close-button {
    background: none;
    border: none;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.chatbot-header .close-button:hover {
    transform: rotate(90deg);
}

/* Chat Messages Area */
.chatbot-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #e0eee8; /* Light green-ish background */
}

/* Individual Message Styles */
.chatbot-message {
    max-width: 85%;
    padding: 10px 15px;
    border-radius: 18px;
    word-wrap: break-word;
    font-size: 0.95em;
    line-height: 1.5;
    opacity: 0;
    transform: translateY(10px);
    animation: messageFadeIn 0.3s forwards;
}

@keyframes messageFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.chatbot-message.user-message {
    background-color: #D36A34;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.chatbot-message.bot-message {
    background-color: #ffffff;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Styling for Markdown content from the bot */
.bot-message strong, .bot-message b {
    color: #114232;
}
.bot-message ul, .bot-message ol {
    padding-left: 20px;
    margin-top: 5px;
    margin-bottom: 5px;
}
.bot-message li {
    margin-bottom: 4px;
}
.bot-message a {
    color: #D36A34;
    text-decoration: underline;
}
.bot-message a:hover {
    color: #a85429;
}


.chatbot-message.bot-message.typing-indicator {
    background-color: #e0e0e0;
    color: #555;
    font-style: italic;
}

/* Typing indicator dots */
.typing-indicator span {
    animation: blink 1.4s infinite both;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
    0% { opacity: .2; }
    20% { opacity: 1; }
    100% { opacity: .2; }
}

/* Input Area */
.chatbot-input-area {
    padding: 10px 15px;
    border-top: 1px solid #ddd;
    display: flex;
    align-items: center;
    background-color: #f0f0f0;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
}

.chatbot-input-area input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 20px;
    outline: none;
    font-size: 0.9em;
    margin-right: 10px;
    background-color: white;
    color: #333;
    transition: border-color 0.2s;
}
.chatbot-input-area input:focus {
    border-color: #114232;
}

.chatbot-input-area button {
    background-color: #114232;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.2em;
    transition: background-color 0.2s ease, transform 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.chatbot-input-area button:hover {
    background-color: #0d3024;
    transform: scale(1.05);
}
.chatbot-input-area button:disabled {
    background-color: #999;
    cursor: not-allowed;
    transform: none;
}

/* Scrollbar */
.chatbot-messages::-webkit-scrollbar { width: 6px; }
.chatbot-messages::-webkit-scrollbar-track { background: #f1f1f1; }
.chatbot-messages::-webkit-scrollbar-thumb { background: #aaa; border-radius: 3px; }
.chatbot-messages::-webkit-scrollbar-thumb:hover { background: #888; }

/* Responsive Adjustments */
@media (max-width: 480px) {
    #ai-chatbot-container {
        bottom: 0;
        right: 0;
        width: 100%;
    }

    #ai-bot-icon {
        position: fixed;
        bottom: 15px;
        right: 15px;
        width: 55px;
        height: 55px;
    }

    #ai-bot-message-popup {
        bottom: 80px;
        right: 15px;
    }

    #ai-chatbot-main {
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-width: 100%;
        max-height: 100%;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        transform: none !important; /* Override all transforms */
    }
}
