/* VPG Chatbot Widget CSS — v4.0
   Stilius: Poppins šriftas, #01075b primary, #F74900 accent (oranžinis)
   Mygtukai: border-radius 4px kaip svetainėje
   ----------------------------------------------------------------- */

#vpg-cb, #vpg-cb * {
    box-sizing: border-box;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Wrapper */
#vpg-cb {
    position: fixed;
    z-index: 999999;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 10px;
    transition: bottom 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === BURBULAS === */
#vpg-bubble {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

#vpg-badge {
    background: var(--vpg-primary);
    color: #fff;
    padding: 11px 18px;
    border-radius: 20px 20px 4px 20px;
    font-size: 14px;
    font-weight: 500;
    max-width: 240px;
    line-height: 1.45;
    box-shadow: 0 4px 18px rgba(1, 7, 91, 0.28);
    animation: vpgPulse 3s ease-in-out infinite;
    transition: opacity 0.3s, transform 0.3s;
    cursor: pointer;
    position: relative;
}

#vpg-badge::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 18px;
    width: 0; height: 0;
    border-left: 8px solid transparent;
    border-right: 4px solid transparent;
    border-top: 8px solid var(--vpg-primary);
}

#vpg-btn {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--vpg-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(1, 7, 91, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: flex-end;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

#vpg-btn:hover { transform: scale(1.08); box-shadow: 0 6px 26px rgba(1, 7, 91, 0.42); }

#vpg-notif {
    position: absolute;
    top: -2px; right: -2px;
    width: 14px; height: 14px;
    background: #F74900;
    border-radius: 50%;
    border: 2px solid #fff;
    animation: vpgNotif 1.6s ease-in-out infinite;
}

#vpg-btn svg, #vpg-reset svg, #vpg-close svg,
#vpg-send svg, .vpg-mini-av svg { display: block; flex-shrink: 0; }

/* === CHAT LANGAS === */
#vpg-win {
    display: none;
    width: 380px;
    flex-direction: column;
    border-radius: 12px;
    margin-bottom: 0;
    box-shadow: 0 12px 50px rgba(1, 7, 91, 0.18);
    overflow: hidden;
    border: 1px solid rgba(1, 7, 91, 0.08);
    background: #ffffff;
}

#vpg-win.vpg-open { animation: vpgSlideUp 0.22s ease; }

/* Header — tamsiai mėlynas kaip svetainės header */
#vpg-header {
    background: var(--vpg-primary);
    padding: 13px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#vpg-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}

#vpg-header-info { flex: 1; }
#vpg-header-name { color: #fff; font-weight: 600; font-size: 15px; line-height: 1.3; font-family: 'Poppins', sans-serif; }
#vpg-header-subtitle { color: rgba(255,255,255,0.6); font-size: 11px; margin-top: 1px; }

#vpg-reset, #vpg-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.65);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    transition: background 0.15s, color 0.15s;
}

#vpg-reset:hover, #vpg-close:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* Žinutės */
#vpg-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 340px;
    max-height: min(440px, calc(100vh - 220px));
    background: #f5f6fa;
    scroll-behavior: smooth;
}

#vpg-msgs::-webkit-scrollbar { width: 4px; }
#vpg-msgs::-webkit-scrollbar-track { background: transparent; }
#vpg-msgs::-webkit-scrollbar-thumb { background: rgba(1,7,91,0.12); border-radius: 4px; }

.vpg-row-bot  { display: flex; align-items: flex-end; gap: 7px; }
.vpg-row-user { display: flex; justify-content: flex-end; }

.vpg-mini-av {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--vpg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}

.vpg-bub-bot {
    background: #ffffff;
    color: #333;
    border-radius: 12px 12px 12px 3px;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.65;
    max-width: 86%;
    border: 1px solid #e8eaf2;
    word-break: break-word;
    font-family: 'Poppins', sans-serif;
}

.vpg-bub-bot a {
    color: #F74900;
    text-decoration: underline;
    word-break: break-all;
}
.vpg-bub-bot a:hover { opacity: 0.8; }

.vpg-bub-user {
    background: var(--vpg-primary);
    color: #fff;
    border-radius: 12px 12px 3px 12px;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.65;
    max-width: 86%;
    word-break: break-word;
    font-family: 'Poppins', sans-serif;
}

/* Typing */
.vpg-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 14px;
    background: #ffffff;
    border-radius: 12px 12px 12px 3px;
    width: fit-content;
    border: 1px solid #e8eaf2;
}

.vpg-typing span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--vpg-primary);
    opacity: 0.4;
    animation: vpgDot 1.2s infinite;
}
.vpg-typing span:nth-child(2) { animation-delay: .2s; }
.vpg-typing span:nth-child(3) { animation-delay: .4s; }

/* Feedback */
.vpg-feedback {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: -4px 0 2px 35px;
    min-height: 26px;
}

.vpg-feedback-btn {
    width: 30px; height: 26px;
    border: 1px solid #dde0ec;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    color: var(--vpg-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
    position: relative;
    overflow: hidden;
}

.vpg-feedback-icon {
    width: 18px !important; height: 18px !important;
    min-width: 18px; min-height: 18px;
    max-width: none !important;
    display: block;
    pointer-events: none;
    position: relative; z-index: 2;
}

.vpg-feedback-icon-missing .vpg-feedback-icon { display: none; }

.vpg-feedback-btn:hover {
    transform: translateY(-1px);
    border-color: var(--vpg-primary);
}

.vpg-feedback-btn:disabled { cursor: default; opacity: 0.55; transform: none; }
.vpg-feedback-selected { background: #f0f2fa; border-color: var(--vpg-primary); opacity: 1 !important; }
.vpg-feedback-status { color: #888; font-size: 12px; }

/* Fallback mygtukas — oranžinis kaip svetainės mygtukai */
.vpg-fb-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0 0 35px;
    padding: 9px 16px;
    background: #F74900;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    transition: opacity 0.2s, transform 0.15s;
}
.vpg-fb-btn:hover { opacity: 0.88; transform: scale(1.02); }

/* Quick Reply mygtukai — stilius kaip svetainės secondary mygtukai */
#vpg-qr-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 10px 12px 8px;
    border-top: 1px solid #eef0f7;
    background: #ffffff;
}

.vpg-qr-btn {
    background: transparent;
    color: var(--vpg-primary);
    border: 1.5px solid var(--vpg-primary);
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    transition: all 0.18s;
    white-space: nowrap;
}

.vpg-qr-btn:hover {
    background: var(--vpg-primary);
    color: #fff;
}

/* Input zona */
#vpg-input-wrap {
    padding: 10px 12px;
    border-top: 1px solid #eef0f7;
    display: flex;
    gap: 8px;
    background: #ffffff;
    align-items: center;
}

#vpg-input {
    flex: 1;
    border: 1.5px solid #dde0ec;
    border-radius: 4px;
    padding: 9px 14px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    outline: none;
    background: #fff;
    color: #333;
    transition: border-color 0.2s;
    min-width: 0;
}

#vpg-input:focus {
    border-color: var(--vpg-primary);
    box-shadow: 0 0 0 3px rgba(1,7,91,0.07);
}

#vpg-hp { display: none !important; position: absolute; left: -9999px; }

/* Siuntimo mygtukas — oranžinis kaip svetainės CTA */
#vpg-send {
    width: 42px; height: 42px;
    border-radius: 4px;
    background: #F74900;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s;
}

#vpg-send:hover  { background: #01075b; transform: scale(1.04); }
#vpg-send:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
#vpg-send svg { width: 20px; height: 20px; }

/* Kai atidarytas — slėpti apskritimą */
#vpg-cb.vpg-is-open #vpg-btn,
#vpg-cb.vpg-is-open #vpg-notif { display: none !important; }

/* === ANIMACIJOS === */
@keyframes vpgPulse {
    0%, 100% { box-shadow: 0 4px 18px rgba(1, 7, 91, 0.28); }
    50%       { box-shadow: 0 6px 28px rgba(1, 7, 91, 0.45), 0 0 0 6px rgba(1, 7, 91, 0.07); }
}
@keyframes vpgNotif {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.4); }
}
@keyframes vpgDot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%            { transform: translateY(-5px); opacity: 1; }
}
@keyframes vpgSlideUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* === MOBILŪS === */
@media (max-width: 480px) {
    #vpg-cb {
        right: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 100%;
    }
    #vpg-bubble {
        position: fixed;
        bottom: 16px; right: 16px;
        left: auto; width: auto;
    }
    #vpg-win {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        width: 100% !important;
        border-radius: 16px 16px 0 0;
        margin-bottom: 0 !important;
        max-height: 90vh;
        box-shadow: 0 -4px 30px rgba(1,7,91,0.18);
    }
    #vpg-msgs {
        min-height: 200px;
        max-height: calc(90vh - 200px);
    }
    #vpg-btn { position: fixed; bottom: 16px; right: 16px; }
    #vpg-badge {
        position: fixed; bottom: 90px; right: 12px;
        max-width: 180px; font-size: 13px;
    }
    #vpg-badge::after { display: none; }
}

@media (min-width: 481px) and (max-width: 600px) {
    #vpg-win { width: calc(100vw - 32px); }
}

/* Lead capture forma */
.vpg-lead-form {
    display: flex;
    gap: 7px;
    margin: 6px 0 0 35px;
    align-items: center;
}

.vpg-lead-input {
    flex: 1;
    border: 1.5px solid #dde0ec;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}
.vpg-lead-input:focus { border-color: #01075b; }

.vpg-lead-btn {
    background: #F74900;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.vpg-lead-btn:hover { background: #01075b; }

/* Markdown stiliai */
.vpg-bub-bot strong { font-weight: 700; color: #01075b; }
.vpg-bub-bot em { font-style: italic; }
.vpg-bullet {
    display: inline-block;
    width: 8px; height: 8px;
    margin-right: 6px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #F74900, #FFF71A);
    vertical-align: middle;
    position: relative;
    top: -1px;
}
.vpg-num { font-weight: 700; color: #01075b; margin-right: 4px; }
