/**
 * OpenAI Chatbot Frontend Styles (v1.2.0)
 * Styles for shortcode version with lead capture form.
 */

/* Container placed by shortcode */
.oac-chatbot-shortcode-container {
    position: relative; /* Or fixed if you want the toggle button back */
    z-index: 999;
    /* Add margin/padding if needed when placed inline */
     margin-bottom: 20px;
}

/* Chatbot Window */
#oac-chatbot-window {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    width: 350px; /* Slightly wider */
    max-width: calc(100vw - 30px); /* Responsive */
    /* position: fixed; */ /* Removed for shortcode, positioned relative to container */
    /* bottom: 80px; */
    /* right: 20px; */
    z-index: 1001;
    display: flex; /* Use flex for layout */
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #333;
}

/* Header */
#oac-chatbot-header {
    background: linear-gradient(135deg, #0073aa, #005a87); /* Gradient background */
    color: #fff;
    padding: 12px 18px;
    border-bottom: 1px solid #005a87;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 9px; /* Match window radius */
    border-top-right-radius: 9px;
}

#oac-chatbot-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    font-weight: 300;
    line-height: 1;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 0 5px;
    transition: color 0.2s ease;
}
#oac-chatbot-close-btn:hover {
    color: #fff;
}


/* User Info Form */
#oac-user-info-form {
    padding: 20px;
    background-color: #f9f9f9;
    border-bottom: 1px solid #e0e0e0;
}
#oac-user-info-form h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 15px;
    color: #444;
    text-align: center;
}
#oac-user-info-form p {
    margin-bottom: 12px;
}
#oac-user-info-form label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 500;
    color: #555;
}
#oac-user-info-form input[type="text"],
#oac-user-info-form input[type="email"],
#oac-user-info-form input[type="tel"],
#oac-user-info-form textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 14px;
    box-sizing: border-box; /* Include padding in width */
    transition: border-color 0.2s ease;
}
#oac-user-info-form input:focus,
#oac-user-info-form textarea:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 1px #0073aa;
}
#oac-user-info-form textarea {
    resize: vertical;
    min-height: 60px;
}
#oac-user-info-form .required {
    color: #d63638;
    margin-left: 2px;
}
#oac-user-info-form button#oac-start-chat-button {
    display: block;
    width: 100%;
    background-color: #0073aa;
    color: white;
    border: none;
    padding: 10px 15px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 15px;
}
#oac-user-info-form button#oac-start-chat-button:hover {
    background-color: #005a87;
}
#oac-user-info-form button#oac-start-chat-button:disabled {
     background-color: #a0a5aa;
     cursor: not-allowed;
}

/* Spinner inside the form */
#oac-start-chat-spinner {
    text-align: center;
    margin-top: 10px;
    font-size: 13px;
    color: #555;
}
#oac-start-chat-spinner .spinner {
    float: none;
    vertical-align: middle;
    margin-right: 5px;
    opacity: 0.7;
}

/* Error Message Styling */
.oac-error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 13px;
}


/* Chat Interface Area */
#oac-chat-interface {
    display: flex; /* Use flex for layout */
    flex-direction: column;
    height: 400px; /* Default height, can be adjusted */
    max-height: 70vh; /* Prevent excessive height on large screens */
}

/* Messages Area */
#oac-chatbot-messages {
    flex-grow: 1; /* Take up available space */
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px; /* Spacing between messages */
    background-color: #f7f7f7; /* Light background for message area */
}

.oac-message {
    padding: 9px 14px;
    border-radius: 18px; /* More rounded */
    max-width: 85%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.oac-message-user {
    background-color: #0073aa;
    color: #fff;
    border-bottom-right-radius: 6px; /* Slightly flatten corner */
    align-self: flex-end;
    margin-left: auto; /* Push to right */
}

.oac-message-assistant {
    background-color: #e5e5e5;
    color: #333;
    border-bottom-left-radius: 6px; /* Slightly flatten corner */
    align-self: flex-start;
    margin-right: auto; /* Push to left */
}

/* Input Area */
#oac-chatbot-input-area {
    display: flex;
    align-items: flex-end; /* Align items to bottom */
    padding: 10px 12px;
    border-top: 1px solid #e0e0e0;
    background-color: #ffffff;
    position: relative;
}

#oac-chatbot-input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 8px 15px;
    margin-right: 8px;
    resize: none;
    overflow-y: auto; /* Allow scrolling if content exceeds max height */
    font-size: 14px;
    line-height: 1.4;
    min-height: 38px; /* Min height for one line */
    max-height: 100px; /* Limit growth */
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}
#oac-chatbot-input:focus {
    border-color: #0073aa;
    outline: none;
}

#oac-chatbot-send {
    background-color: #0073aa;
    color: white;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
    align-self: flex-end; /* Align button to bottom */
    margin-bottom: 1px; /* Align baseline with textarea */
}

#oac-chatbot-send:hover {
    background-color: #005a87;
}

#oac-chatbot-send:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#oac-chatbot-send svg {
    position: relative;
    left: 1px; /* Fine-tune icon position */
}

/* Typing Indicator */
#oac-chatbot-typing-indicator {
    position: absolute;
    bottom: 55px; /* Position above input area */
    left: 15px;
    font-size: 12px;
    color: #777;
    padding: 3px 8px;
    background-color: rgba(240, 240, 240, 0.9);
    border-radius: 10px;
    z-index: 1;
}


/* Optional Toggle Button Styling (If you re-add it) */
/*
#oac-chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #0073aa;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease, transform 0.2s ease;
    z-index: 1000;
}
#oac-chatbot-toggle:hover {
    background-color: #005a87;
    transform: scale(1.05);
}
#oac-chatbot-toggle svg { width: 26px; height: 26px; }
*/

/* Simple Responsive */
@media (max-width: 400px) {
    #oac-chatbot-window {
        width: calc(100% - 20px); /* Adjust width for small screens */
        max-width: none;
        /* Adjust positioning if it were fixed */
    }
    #oac-chat-interface {
         height: 350px;
         max-height: 65vh;
    }
}