/* OneEuroLabs Chatbot Widget */

@font-face {
    font-family: 'Nunito';
    src: url('https://oneeurolabs.com/wp-content/uploads/2026/05/Nunito-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Nunito';
    src: url('https://oneeurolabs.com/wp-content/uploads/2026/05/Nunito-Italic-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900; font-style: italic; font-display: swap;
}

/* Default values (overridden by inline :root block from PHP) */
:root {
    --oel-primary:      #635bff;
    --oel-primary-dark: #2d26d0;
    --oel-bg:           #07080f;
    --oel-header:       #0d0e1c;
    --oel-msg-bot:      #0f1020;
    --oel-text:         #c8cee8;
    --oel-bottom:       28px;
    --oel-side:         28px;
    --oel-pos-right:    28px;
    --oel-pos-left:     auto;
}

#oel-root * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

/* ── TOGGLE BUTTON ─────────────────────────────────────────── */
#oel-toggle {
    position: fixed;
    bottom: var(--oel-bottom);
    right: var(--oel-pos-right);
    left:  var(--oel-pos-left);
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--oel-primary-dark), var(--oel-primary));
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 91, 255, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2147483647;
    transition: transform 0.2s, box-shadow 0.2s;
    padding: 0;
}
#oel-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(99, 91, 255, 0.6);
}
#oel-toggle-logo-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
#oel-toggle-icon {
    width: 30px;
    height: 30px;
    fill: #ffffff;
    display: block;
    transition: transform 0.2s;
}
#oel-toggle.is-open #oel-toggle-icon {
    transform: rotate(90deg);
}
#oel-dot {
    position: absolute;
    top: 0; right: 0;
    width: 13px; height: 13px;
    background: #ff4f4f;
    border-radius: 50%;
    border: 2px solid var(--oel-bg);
    display: none;
    z-index: 2;
}

/* ── CHAT WINDOW ───────────────────────────────────────────── */
#oel-window {
    position: fixed;
    bottom: calc(var(--oel-bottom) + 78px);
    right: var(--oel-pos-right);
    left: var(--oel-pos-left);
    width: 370px;
    max-width: calc(100vw - 20px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: var(--oel-bg);
    border: 1px solid rgba(99, 91, 255, 0.25);
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(99, 91, 255, 0.1);
    z-index: 2147483646;
    transform: scale(0.92) translateY(16px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s cubic-bezier(.4, 0, .2, 1), opacity 0.22s;
}
#oel-window.oel-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* ── HEADER ────────────────────────────────────────────────── */
#oel-header {
    background: var(--oel-header);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 11px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(99, 91, 255, 0.15);
}
#oel-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--oel-primary-dark), var(--oel-primary));
    display: flex; align-items: center; justify-content: center;
    font-size: 19px;
    flex-shrink: 0;
}
#oel-header-info h3 {
    color: #e8eaff;
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: 0.2px;
}
#oel-header-info p {
    color: #7b78cc;
    font-size: 11.5px;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 5px;
}
#oel-status-dot {
    display: inline-block;
    width: 7px; height: 7px;
    background: #00d4a8;
    border-radius: 50%;
    animation: oel-pulse 2s infinite;
}
@keyframes oel-pulse {
    0%, 100% { opacity: 1; } 50% { opacity: 0.35; }
}
#oel-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #7b78cc;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 5px 6px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}
#oel-close:hover { color: #fff; background: rgba(255,255,255,0.1); }

.oel-header-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.oel-header-btn svg { width: 18px; height: 18px; fill: #7b78cc; }
.oel-header-btn:hover { background: rgba(255,255,255,0.1); }

/* ── MESSAGES ──────────────────────────────────────────────── */
#oel-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    scroll-behavior: smooth;
}
#oel-messages::-webkit-scrollbar { width: 4px; }
#oel-messages::-webkit-scrollbar-thumb { background: rgba(99,91,255,0.3); border-radius: 4px; }

.oel-msg {
    max-width: 86%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.52;
    word-break: break-word;
}
.oel-msg.oel-bot {
    background: var(--oel-msg-bot);
    color: var(--oel-text);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    border: 1px solid rgba(99, 91, 255, 0.2);
}
.oel-msg.oel-user {
    background: linear-gradient(135deg, var(--oel-primary-dark), var(--oel-primary));
    color: #ffffff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}
.oel-msg a { color: var(--oel-primary); text-decoration: underline; }

/* ── TYPING ────────────────────────────────────────────────── */
#oel-typing {
    background: var(--oel-msg-bot);
    border: 1px solid rgba(99, 91, 255, 0.2);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    padding: 12px 15px;
    align-self: flex-start;
    display: none;
    gap: 5px;
    align-items: center;
}
#oel-typing.oel-visible { display: flex; }
#oel-typing span {
    width: 7px; height: 7px;
    background: var(--oel-primary);
    border-radius: 50%;
    animation: oel-typing 1.2s infinite;
}
#oel-typing span:nth-child(2) { animation-delay: 0.2s; }
#oel-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes oel-typing {
    0%, 60%, 100% { transform: translateY(0);   opacity: 0.4; }
    30%           { transform: translateY(-5px); opacity: 1; }
}

/* ── MODE CHOOSER ──────────────────────────────────────────── */
#oel-mode-chooser {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(7, 8, 15, 0.93);
    z-index: 10;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
}
#oel-mode-chooser.oel-visible { display: flex; }
.oel-mode-inner { text-align: center; padding: 24px; }
.oel-mode-title { color: var(--oel-text); font-size: 16px; font-weight: 700; margin-bottom: 24px; }
.oel-mode-btns { display: flex; gap: 16px; justify-content: center; }
.oel-mode-btn {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    background: var(--oel-msg-bot);
    border: 2px solid rgba(99, 91, 255, 0.3);
    border-radius: 16px;
    padding: 22px 26px;
    cursor: pointer;
    color: var(--oel-text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.18s, transform 0.15s;
    min-width: 110px;
}
.oel-mode-btn:hover { border-color: var(--oel-primary); transform: translateY(-2px); }
.oel-mode-icon { font-size: 32px; line-height: 1; }

/* ── QUICK REPLIES ─────────────────────────────────────────── */
#oel-quick { padding: 0 14px 10px; display: flex; flex-wrap: wrap; gap: 6px; flex-shrink: 0; }
#oel-quick.oel-hidden { display: none; }
.oel-qbtn {
    background: var(--oel-msg-bot);
    border: 1px solid rgba(99, 91, 255, 0.4);
    color: #a09dff;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}
.oel-qbtn:hover { background: var(--oel-primary); color: #fff; }

/* ── INPUT ROW ─────────────────────────────────────────────── */
#oel-input-row {
    padding: 11px 14px;
    border-top: 1px solid rgba(99, 91, 255, 0.15);
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    background: rgba(7, 8, 15, 0.6);
}
#oel-input {
    flex: 1;
    background: var(--oel-msg-bot);
    border: 1px solid rgba(99, 91, 255, 0.2);
    border-radius: 12px;
    padding: 9px 13px;
    color: var(--oel-text);
    font-size: 13.5px;
    outline: none;
    resize: none;
    font-family: inherit;
    line-height: 1.4;
    max-height: 96px;
    transition: border-color 0.15s;
}
#oel-input:focus { border-color: var(--oel-primary); }
#oel-input::placeholder { color: rgba(200, 206, 232, 0.3); }
#oel-send {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--oel-primary-dark), var(--oel-primary));
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    align-self: flex-end;
    transition: opacity 0.15s;
}
#oel-send:hover { opacity: 0.85; }
#oel-send:disabled { opacity: 0.38; cursor: not-allowed; }
#oel-send svg { width: 18px; height: 18px; fill: #ffffff; }

/* ── VOICE ROW ─────────────────────────────────────────────── */
#oel-voice-row {
    padding: 10px 14px;
    border-top: 1px solid rgba(99, 91, 255, 0.15);
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    background: rgba(7, 8, 15, 0.6);
}
#oel-voice-status { font-size: 12px; color: rgba(200,206,232,0.5); text-align: center; }
#oel-mic-btn {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--oel-primary-dark), var(--oel-primary));
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: box-shadow 0.2s, transform 0.15s;
}
#oel-mic-btn svg { width: 24px; height: 24px; fill: #fff; }
#oel-mic-btn:hover { transform: scale(1.06); }
#oel-mic-btn.oel-recording {
    background: linear-gradient(135deg, #8b0000, #f44336);
    animation: oel-mic-pulse 1s infinite;
}
@keyframes oel-mic-pulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(244,67,54,0.4); }
    50%      { box-shadow: 0 0 0 12px rgba(244,67,54,0); }
}
#oel-mic-btn.oel-speaking {
    box-shadow: 0 0 0 6px rgba(99,91,255,0.3);
}
.oel-link-btn {
    background: none; border: none;
    color: #7b78cc;
    font-size: 11.5px;
    cursor: pointer; text-decoration: underline;
    font-family: inherit; padding: 0;
}
.oel-link-btn:hover { color: var(--oel-primary); }

/* ── DISCLAIMER ────────────────────────────────────────────── */
#oel-disclaimer {
    text-align: center;
    font-size: 10px;
    color: rgba(200, 206, 232, 0.3);
    padding: 5px 14px 9px;
    flex-shrink: 0;
    line-height: 1.4;
}

/* ── MOBILE ────────────────────────────────────────────────── */
@media (max-width: 480px) {
    #oel-window {
        /* Sit just above the toggle button, stretch to near top of screen */
        top: 12px !important;
        bottom: calc(var(--oel-bottom) + 74px) !important;
        right: 8px !important;
        left:  8px !important;
        width: auto !important;
        max-width: none !important;
        height: auto !important;
        max-height: none !important;
        border-radius: 16px !important;
    }
    #oel-toggle {
        bottom: var(--oel-bottom) !important;
        right:  var(--oel-pos-right) !important;
        left:   var(--oel-pos-left)  !important;
    }
}
