/* AuronicBot Chat Widget - all colors via CSS variables injected by JS */

#auronicbot-root {
    --ab-bubble-bg:    #1a1a2e;
    --ab-bubble-text:  #ffffff;
    --ab-header-bg:    #1a1a2e;
    --ab-header-text:  #ffffff;
    --ab-user-bubble:  #1a1a2e;
    --ab-user-text:    #ffffff;
    --ab-bot-bubble:   #f0f0f0;
    --ab-bot-text:     #1a1a2e;
    --ab-send-btn:     #1a1a2e;
    --ab-send-text:    #ffffff;
    --ab-window-bg:    #ffffff;

    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
}

/* ---- Bubble ---- */
#auronicbot-bubble {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--ab-bubble-bg);
    color: var(--ab-bubble-text);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}
#auronicbot-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
#auronicbot-bubble:focus-visible {
    outline: 3px solid var(--ab-bubble-bg);
    outline-offset: 3px;
}

/* ---- Window ---- */
#auronicbot-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 360px;
    max-height: 560px;
    background: var(--ab-window-bg);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: ab-slide-in 0.25s ease;
}

@keyframes ab-slide-in {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- Header ---- */
#auronicbot-header {
    background: var(--ab-header-bg);
    color: var(--ab-header-text);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

#auronicbot-persona {
    display: flex;
    align-items: center;
    gap: 10px;
}

#auronicbot-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
    flex-shrink: 0;
}

#auronicbot-persona-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

#auronicbot-persona-name {
    font-weight: 600;
    font-size: 15px;
}

#auronicbot-persona-flags {
    font-size: 13px;
    opacity: 0.85;
    letter-spacing: 2px;
}

#auronicbot-close {
    background: transparent;
    border: none;
    color: var(--ab-header-text);
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 6px;
    opacity: 0.8;
    transition: opacity 0.15s;
    line-height: 1;
}
#auronicbot-close:hover { opacity: 1; }

/* ---- Messages ---- */
#auronicbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

#auronicbot-messages::-webkit-scrollbar { width: 4px; }
#auronicbot-messages::-webkit-scrollbar-track { background: transparent; }
#auronicbot-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

.ab-message {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    animation: ab-msg-in 0.2s ease;
}

@keyframes ab-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ab-message-bot {
    background: var(--ab-bot-bubble);
    color: var(--ab-bot-text);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.ab-message-user {
    background: var(--ab-user-bubble);
    color: var(--ab-user-text);
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

/* ---- Typing indicator ---- */
.ab-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
    background: var(--ab-bot-bubble);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    width: fit-content;
}

.ab-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ab-bot-text);
    opacity: 0.4;
    animation: ab-bounce 1.2s infinite;
}
.ab-typing span:nth-child(2) { animation-delay: 0.2s; }
.ab-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ab-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%            { transform: translateY(-5px); opacity: 1; }
}

/* ---- Persona switch notice ---- */
.ab-persona-switch {
    text-align: center;
    font-size: 12px;
    color: #999;
    padding: 8px 12px;
    margin: 4px 0;
    font-style: italic;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px dashed #ddd;
}

/* ---- Handoff form ---- */
#auronicbot-handoff-form {
    padding: 14px 16px;
    border-top: 1px solid #eee;
    background: #fafafa;
    flex-shrink: 0;
}

#auronicbot-handoff-prompt {
    font-size: 13px;
    color: #555;
    margin: 0 0 10px;
}

#auronicbot-email-input,
#auronicbot-handoff-message {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 8px;
    outline: none;
    transition: border-color 0.15s;
    background: #fff;
    color: #333;
    resize: none;
}
#auronicbot-email-input:focus,
#auronicbot-handoff-message:focus {
    border-color: var(--ab-send-btn);
}

#auronicbot-handoff-submit {
    width: 100%;
    background: var(--ab-send-btn);
    color: var(--ab-send-text);
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
#auronicbot-handoff-submit:hover { opacity: 0.9; }
#auronicbot-handoff-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Input area ---- */
#auronicbot-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    background: var(--ab-window-bg);
}

#auronicbot-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    line-height: 1.4;
    max-height: 100px;
    overflow-y: auto;
    transition: border-color 0.15s;
    background: #fff;
    color: #333;
}
#auronicbot-input:focus { border-color: var(--ab-send-btn); }
#auronicbot-input:disabled { background: #f5f5f5; }
#auronicbot-input::placeholder { color: #aaa; }

#auronicbot-send {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--ab-send-btn);
    color: var(--ab-send-text);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s, transform 0.1s;
}
#auronicbot-send:hover { opacity: 0.9; }
#auronicbot-send:active { transform: scale(0.95); }
#auronicbot-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Closed state ---- */
#auronicbot-closed-msg {
    padding: 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

/* ---- Mobile ---- */
@media (max-width: 420px) {
    #auronicbot-root {
        bottom: 16px;
        right: 16px;
    }
    #auronicbot-window {
        width: calc(100vw - 32px);
        right: 0;
        max-height: 75vh;
    }
}
