/* Webvezér AI Chatbot - Chat Widget Stílusok */

:root {
    --wvai-primary: #2563eb;
    --wvai-primary-dark: #1d4ed8;
    --wvai-bg: #ffffff;
    --wvai-bg-secondary: #f8fafc;
    --wvai-text: #1e293b;
    --wvai-text-light: #64748b;
    --wvai-border: #e2e8f0;
    --wvai-shadow: 0 10px 40px rgba(0,0,0,0.15);
    --wvai-radius: 16px;
    --wvai-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --wvai-z: 999999;
}

/* ── Widget konténer ── */
.wvai-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: var(--wvai-z);
    font-family: var(--wvai-font);
    font-size: 14px;
    line-height: 1.5;
    /* Ne nyomja szét a többi elemet */
    width: 56px;
    height: 56px;
}

/* ── Lebegő gomb ── */
.wvai-toggle-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--wvai-primary);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: white;
    outline: none;
    position: relative;
    flex-shrink: 0;
}

.wvai-toggle-btn:hover {
    background: var(--wvai-primary-dark);
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(37, 99, 235, 0.5);
}

/* AI ikon a lebegő gombban */
.wvai-toggle-btn .wvai-icon-ai {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wvai-toggle-btn .wvai-icon-ai svg {
    width: 28px;
    height: 28px;
    fill: white;
}

/* Bezárás ikon */
.wvai-toggle-btn .wvai-icon-close {
    width: 22px;
    height: 22px;
    display: none;
    align-items: center;
    justify-content: center;
}

.wvai-toggle-btn .wvai-icon-close svg {
    width: 22px;
    height: 22px;
    fill: white;
}

/* ── Chat ablak ── */
.wvai-window {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 370px;
    max-width: calc(100vw - 32px);
    background: var(--wvai-bg);
    border-radius: var(--wvai-radius);
    box-shadow: var(--wvai-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--wvai-border);
    animation: wvai-slide-up 0.25s ease;
    /* Magasság: flexibilis, de korlátozott */
    max-height: calc(100vh - 120px);
}

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

/* ── Fejléc ── */
.wvai-header {
    background: var(--wvai-primary);
    color: white;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.wvai-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.wvai-avatar {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.wvai-name {
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wvai-status {
    font-size: 11px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 1px;
}

.wvai-dot {
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    animation: wvai-pulse 2s infinite;
}

@keyframes wvai-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.wvai-close-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 15px;
    padding: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
    line-height: 1;
}

.wvai-close-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* ── Üzenetek terület ── */
.wvai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--wvai-bg-secondary);
    min-height: 180px;
    max-height: 340px;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

.wvai-messages::-webkit-scrollbar { width: 4px; }
.wvai-messages::-webkit-scrollbar-track { background: transparent; }
.wvai-messages::-webkit-scrollbar-thumb { background: var(--wvai-border); border-radius: 2px; }

/* ── Üzenet buborékok ── */
.wvai-msg {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    max-width: 88%;
}

.wvai-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.wvai-msg-bot {
    align-self: flex-start;
}

.wvai-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
}

.wvai-msg-user .wvai-bubble {
    background: var(--wvai-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.wvai-msg-bot .wvai-bubble {
    background: white;
    color: var(--wvai-text);
    border: 1px solid var(--wvai-border);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ── Gépelés animáció ── */
.wvai-typing .wvai-bubble {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 13px 16px;
}

.wvai-typing-dot {
    width: 7px;
    height: 7px;
    background: var(--wvai-text-light);
    border-radius: 50%;
    animation: wvai-bounce 1.2s infinite;
    flex-shrink: 0;
}

.wvai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.wvai-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes wvai-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* ── Beviteli terület ── */
.wvai-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--wvai-bg);
    border-top: 1px solid var(--wvai-border);
    flex-shrink: 0;
    box-sizing: border-box;
    width: 100%;
}

.wvai-input {
    flex: 1 1 0%;
    min-width: 0;
    border: 2px solid var(--wvai-border);
    border-radius: 24px;
    padding: 12px 18px;
    font-size: 15px;
    font-family: var(--wvai-font);
    resize: none !important;
    outline: none !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: var(--wvai-bg-secondary);
    color: var(--wvai-text);
    max-height: 44px;
    min-height: 44px;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    line-height: 1.5;
    box-sizing: border-box;
    display: block;
}

.wvai-input:focus {
    border-color: var(--wvai-primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.wvai-input::placeholder {
    color: var(--wvai-text-light);
    font-size: 14px;
}

/* Textarea alapértelmezett böngésző stílusok teljes eltávolítása */
.wvai-input::-webkit-resizer { display: none !important; }
.wvai-input::-webkit-scrollbar { display: none !important; width: 0 !important; }
.wvai-input { -ms-overflow-style: none; scrollbar-width: none; }

/* ── Küldés gomb ── */
.wvai-send-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: var(--wvai-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    color: white;
    padding: 0;
}

.wvai-send-btn:hover {
    background: var(--wvai-primary-dark);
    transform: scale(1.08);
}

.wvai-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

/* Arrow karakter a küldés gombban */
.wvai-send-btn {
    font-size: 18px;
    line-height: 1;
    color: white;
    letter-spacing: 0;
}

.wvai-send-btn svg {
    width: 20px;
    height: 20px;
    margin-left: 1px;
}

/* ── Footer ── */
.wvai-footer {
    text-align: center;
    font-size: 10px;
    color: var(--wvai-text-light);
    padding: 5px 8px;
    background: var(--wvai-bg);
    border-top: 1px solid var(--wvai-border);
    flex-shrink: 0;
    letter-spacing: 0.01em;
}

/* ── Hibaüzenet ── */
.wvai-msg-error .wvai-bubble {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

/* ── Reszponzív: kis képernyők ── */
@media (max-width: 480px) {
    .wvai-widget {
        bottom: 16px;
        right: 16px;
    }

    .wvai-window {
        right: 8px;
        left: 8px;
        width: auto;
        max-width: 100%;
        bottom: 82px;
        max-height: calc(100vh - 100px);
    }

    .wvai-messages {
        max-height: calc(100vh - 280px);
        min-height: 150px;
    }

    .wvai-input-area {
        padding: 8px 10px;
    }

    .wvai-input {
        font-size: 16px; /* iOS zoom megelőzése */
    }
}

/* ── Nagyon kis képernyők (pl. 320px) ── */
@media (max-width: 360px) {
    .wvai-window {
        right: 4px;
        left: 4px;
    }
}
