/* =========================================
   GWC AI Chat Widget – Elevenpark Theme
   ========================================= */

:root {
    --gwc-primary: #ffffff;
    --gwc-user-bg: #c94b8e; /* Elevenpark Pink */
    --gwc-bot-bg: #63509c;
    --gwc-bot-border: #63509c;
    --gwc-text: #4a3a78; /* Elevenpark Dark Purple */
    --gwc-muted: #64748b;
    --gwc-accent: #fec134; /* Elevenpark Yellow */
    --gwc-header-bg: #693e83; /* Elevenpark Purple */
    --gwc-radius: 16px;
    --gwc-font: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ROOT */
.gwc-ai2-chat-root {
    position: fixed;
    z-index: 9999999;
    right: 24px;
    bottom: 24px;
    font-family: var(--gwc-font);
}

/* ---- FLOATING BUTTON ---- */
.gwc-ai2-floating-btn {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    border: none;
    padding: 0;
    cursor: pointer;
    background: transparent;
    box-shadow: 0 8px 32px rgba(105, 62, 131, 0.25), 0 0 0 2px rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s ease, box-shadow .2s ease;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999999;
}
.gwc-ai2-floating-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 40px rgba(105, 62, 131, 0.35), 0 0 0 3px rgba(255, 255, 255, 0.8);
}
.gwc-ai2-floating-icon-svg {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    border-radius: 50%;
    overflow: hidden;
}

/* ---- EXTERNAL CLOSE (red pill below window) ---- */
.gwc-ai2-external-close {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: #c94b8e;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(201, 75, 142, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: fixed;
    right: 35px;
    bottom: 29px;
    z-index: 10000000;
    padding: 0;
    text-align: center;
}
.gwc-ai2-external-close:hover { background: #b03a78; transform: scale(1.1); }

.gwc-ai2-hidden { display: none !important; }

/* ---- CHAT WINDOW ---- */
.gwc-ai2-chat-window {
    width: 390px;
    max-height: 620px;
    background: #fdf7e7; /* Light Yellow / Cream */
    color: var(--gwc-text);
    border-radius: var(--gwc-radius);
    box-shadow: 0 24px 60px rgba(105, 62, 131, 0.15), 0 0 0 2px rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: fixed;
    right: 24px;
    bottom: 100px;
    z-index: 9999999;
}

/* ---- HEADER ---- */
.gwc-ai2-chat-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: var(--gwc-header-bg);
    border-bottom: 2px solid rgba(0,0,0,0.05);
    flex-shrink: 0;
    position: relative;
}
.gwc-ai2-chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    margin-right: 12px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
    padding: 0;
    overflow: hidden;
}
.gwc-ai2-chat-title { flex: 1; padding-right: 44px; }
.gwc-ai2-chat-name { font-weight: 800; font-size: 16px; color: #ffffff; letter-spacing: .5px; }
.gwc-ai2-chat-status {
    font-size: 11px;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}
.gwc-ai2-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px #22c55e;
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

/* close button inside header */
.gwc-ai2-chat-close.internal {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: all .2s;
    z-index: 10;
    padding: 0;
    text-align: center;
}
.gwc-ai2-chat-close.internal:hover {
    background: #c94b8e;
    transform: translateY(-50%) scale(1.1);
}

/* ---- BODY ---- */
.gwc-ai2-chat-body {
    flex: 1;
    padding: 16px 14px;
    overflow-y: auto;
    background: #fdf7e7;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.gwc-ai2-chat-body::-webkit-scrollbar { width: 4px; }
.gwc-ai2-chat-body::-webkit-scrollbar-track { background: transparent; }
.gwc-ai2-chat-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.gwc-ai2-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ---- MESSAGE ROW WRAPPER ---- */
.gwc-ai2-msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    width: 100%;
}
/* Bot row: avatar LEFT, bubble RIGHT */
.gwc-ai2-msg-row.bot-row {
    flex-direction: row;
    justify-content: flex-start;
}
/* User row: bubble on left, avatar on right, all pushed to the right */
.gwc-ai2-msg-row.user-row {
    flex-direction: row;
    justify-content: flex-end;
}

/* Bot mini-avatar */
.gwc-ai2-msg-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    align-self: flex-end;
    overflow: hidden;
}
.gwc-ai2-msg-avatar svg, .gwc-ai2-msg-avatar img { width: 32px; height: 32px; display: block; object-fit:cover; }
.gwc-ai2-msg-avatar.user-avatar { background: var(--gwc-user-bg); padding: 5px; box-shadow: none; color: white; font-weight: bold; font-size: 12px; }

/* Bubble wrapper */
.gwc-ai2-msg-bubble-wrap {
    display: flex;
    flex-direction: column;
    max-width: calc(100% - 44px); /* full width minus avatar+gap */
}
.gwc-ai2-msg-row.user-row .gwc-ai2-msg-bubble-wrap {
    align-items: flex-end;
}
.gwc-ai2-msg-row.bot-row .gwc-ai2-msg-bubble-wrap {
    align-items: flex-start;
}

/* ---- BUBBLE ---- */
.gwc-ai2-message {
    max-width: 100%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14.5px;
    line-height: 1.55;
    word-wrap: break-word;
    white-space: pre-wrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.gwc-ai2-message.bot {
    background: #63509c;
    color: #ffffff;
    border: none;
    border-bottom-left-radius: 6px;
}
.gwc-ai2-message.user {
    background: var(--gwc-user-bg);
    color: #ffffff;
    border-bottom-right-radius: 6px;
}

/* Message timestamp */
.gwc-ai2-msg-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
    display: block;
    padding: 0 4px;
}

/* Formatting helpers */
.gwc-ai2-message strong { font-weight: 800; }
.gwc-ai2-message a { color: #c94b8e; text-decoration: underline; font-weight: 700; }
.gwc-ai2-message.user a { color: #fec134; }
.gwc-ai2-message.bot a { color: #fde68a; }
.gwc-chat-list { margin: 8px 0 !important; padding-left: 20px !important; list-style-type: disc !important; display: block !important; }
.gwc-chat-list li { margin-bottom: 4px !important; display: list-item !important; }

/* ---- TYPING INDICATOR ---- */
.gwc-ai2-typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    background: #63509c;
    border: none;
    width: fit-content;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.gwc-ai2-typing-indicator > span {
    width: 7px;
    height: 7px;
    background: #ffffff;
    border-radius: 50%;
    opacity: 0;
    animation: typing-bounce 1.3s infinite;
}
.gwc-ai2-typing-indicator > span:nth-child(1) { animation-delay: 0s; }
.gwc-ai2-typing-indicator > span:nth-child(2) { animation-delay: .22s; }
.gwc-ai2-typing-indicator > span:nth-child(3) { animation-delay: .44s; }
@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: .6; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* ---- FOOTER ---- */
.gwc-ai2-chat-footer {
    padding: 14px 14px 18px;
    display: flex;
    align-items: flex-end;
    background: var(--gwc-header-bg);
    border-top: 1px solid rgba(0,0,0,0.1);
    flex-shrink: 0;
    box-sizing: border-box;
    width: 100%;
}

/* Input wrapper: takes up full width, button is positioned inside */
.gwc-ai2-input-wrap {
    position: relative;
    flex: 1;
    display: flex;
    align-items: flex-end;
    width: 100%;
    box-sizing: border-box;
}

.gwc-ai2-input {
    width: 100%;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 12px 52px 12px 18px; /* right padding makes room for the button */
    font-size: 15px;
    background: rgba(0, 0, 0, 0.2);
    color: #ffffff;
    outline: none;
    resize: none;
    height: 48px;
    min-height: 48px;
    max-height: 100px;
    line-height: 1.5;
    min-width: 0;
    transition: all .2s;
    font-family: var(--gwc-font);
    box-sizing: border-box;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
.gwc-ai2-input:focus { border-color: rgba(255,255,255,0.4); background: rgba(0, 0, 0, 0.3); box-shadow: inset 0 2px 4px rgba(0,0,0,0.15), 0 0 0 2px rgba(254, 193, 52, 0.5); }
.gwc-ai2-input::placeholder { color: rgba(255,255,255,0.5); }

.gwc-ai2-send-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--gwc-user-bg);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    font-size: 15px;
    transition: background .2s, transform .15s;
    box-shadow: 0 4px 10px rgba(201, 75, 142, 0.4);
    flex-shrink: 0;
}
.gwc-ai2-send-btn:hover { background: #b03a78; transform: translateY(-50%) scale(1.08); }

/* disclaimer */
.gwc-ai2-disclaimer {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    padding: 6px 14px 10px;
    background: var(--gwc-header-bg);
    flex-shrink: 0;
    font-weight: 500;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
    .gwc-ai2-chat-window { right: 8px; left: 8px; width: auto; bottom: 82px; max-height: 72vh; }
    .gwc-ai2-floating-btn { right: 16px; bottom: 16px; width: 60px; height: 60px; }
    .gwc-ai2-external-close { right: 16px; bottom: 20px; }
    .gwc-ai2-input { font-size: 16px !important; }
}