/**
 * All of the CSS for the public-facing chatbot widget.
 *
 * @package    ChatAI_Support
 * @subpackage ChatAI_Support/public/css
 * @author     Mr. WordPress <support@aiziip.com>
 */

/* Chat Widget Bubble */
#chatai-bubble {
    position: fixed;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--chatai-primary-color, #0073aa);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 99998;
    transition: transform 0.2s ease-in-out;
}
#chatai-bubble:hover {
    transform: scale(1.1);
}
#chatai-bubble.chatai-bottom-right {
    bottom: 20px;
    right: 20px;
}
#chatai-bubble.chatai-bottom-left {
    bottom: 20px;
    left: 20px;
}
#chatai-bubble svg {
    width: 32px;
    height: 32px;
    fill: white;
}

/* Chat Widget Window */
#chatai-widget-window {
    position: fixed;
    width: 370px;
    max-width: 90vw;
    height: 70vh;
    max-height: 600px;
    background: #f9f9f9;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    transform: scale(0.5);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}
#chatai-widget-window.chatai-open {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}
#chatai-widget-window.chatai-bottom-right {
    bottom: 90px;
    right: 20px;
}
#chatai-widget-window.chatai-bottom-left {
    bottom: 90px;
    left: 20px;
}

/* Header */
.chatai-header {
    background-color: var(--chatai-primary-color, #0073aa);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}
.chatai-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
}
.chatai-close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

/* Messages Area */
.chatai-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #fff;
    display: flex;
    flex-direction: column;
}

/* Individual Messages */
.chatai-message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    margin-bottom: 10px;
    line-height: 1.4;
    font-size: 15px;
    word-wrap: break-word;
}
.chatai-message.chatai-bot {
    background-color: #f1f0f0;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.chatai-message.chatai-user {
    background-color: var(--chatai-primary-color, #0073aa);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.chatai-typing-indicator {
    display: flex;
    align-items: center;
    padding: 10px 15px;
}
.chatai-typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #aaa;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: chatai-typing-bounce 1.4s infinite ease-in-out both;
}
.chatai-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.chatai-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes chatai-typing-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}


/* Input Area */
.chatai-input-area {
    border-top: 1px solid #e0e0e0;
    padding: 10px;
    background-color: #f9f9f9;
}
.chatai-input-area form {
    display: flex;
    align-items: center;
}
#chatai-user-input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 15px;
    resize: none;
    margin-right: 10px;
}
#chatai-user-input:focus {
    outline: none;
    border-color: var(--chatai-primary-color, #0073aa);
}
#chatai-send-btn {
    background: var(--chatai-primary-color, #0073aa);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}
#chatai-send-btn:disabled {
    background-color: #a0a0a0;
    cursor: not-allowed;
}
#chatai-send-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}


.chatai-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatai-expand-btn {
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.35);
    color: #fff;
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 16px;
    line-height: 1;
}

.chatai-hidden {
    display: none !important;
}

.chatai-full-page-container {
    width: 100%;
}

.chatai-page-shell {
    width: 100%;
    max-width: 1180px;
    margin: 24px auto;
    padding: 0 16px;
}

.chatai-page-window {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    max-width: none !important;
    height: min(78vh, 860px) !important;
    max-height: none !important;
    display: flex !important;
    flex-direction: column;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: none !important;
    border-radius: 24px !important;
    overflow: hidden;
    box-shadow: 0 18px 60px rgba(15, 23, 42, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: #fff;
}

.chatai-page-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 28px 32px;
    background: linear-gradient(135deg, rgba(0,115,170,0.12), rgba(255,255,255,0.96));
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.chatai-page-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(0,115,170,0.1);
    color: var(--chatai-primary-color, #0073aa);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.chatai-page-hero h2 {
    margin: 0 0 8px;
    font-size: 32px;
    line-height: 1.15;
    color: #0f172a;
}

.chatai-page-hero p {
    margin: 0;
    max-width: 720px;
    color: #475569;
    font-size: 16px;
}

.chatai-page-overlay-trigger {
    background: var(--chatai-primary-color, #0073aa);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 12px 18px;
    cursor: pointer;
    font-weight: 600;
}

.chatai-page-window .chatai-header {
    border-radius: 0;
}

.chatai-page-window .chatai-messages {
    padding: 24px;
}

.chatai-page-window .chatai-input-area {
    padding: 16px;
}

#chatai-widget-window.chatai-overlay-active {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    bottom: 20px !important;
    left: 20px !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    border-radius: 24px !important;
    z-index: 999999 !important;
    transform: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

body.chatai-overlay-open {
    overflow: hidden;
}

#chatai-widget-window.chatai-overlay-active .chatai-messages {
    padding: 24px;
}

#chatai-widget-window.chatai-overlay-active .chatai-input-area {
    padding: 16px;
}

#chatai-send-btn {
    background: var(--chatai-primary-color, #0073aa);
    color: #fff;
    border: none;
    border-radius: 20px;
    min-width: 52px;
    height: 42px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#chatai-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#chatai-send-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

@media (max-width: 782px) {
    .chatai-page-shell {
        padding: 0;
        margin: 12px auto;
    }

    .chatai-page-hero {
        padding: 20px;
        flex-direction: column;
        align-items: flex-start;
    }

    .chatai-page-hero h2 {
        font-size: 26px;
    }

    .chatai-page-window {
        height: 82vh !important;
        border-radius: 18px !important;
    }

    #chatai-widget-window.chatai-overlay-active {
        top: 10px !important;
        right: 10px !important;
        bottom: 10px !important;
        left: 10px !important;
        border-radius: 18px !important;
    }
}
