/* ═══════════════════════════════════════════════════════════════════════
   Mér-Szoft Chatbot – chatbot.css
   Dizájn: illeszkedik az oldal kék (#1a3c6e / #6B8FC9) színvilágához
   ═══════════════════════════════════════════════════════════════════════ */

/* ── CSS változók ───────────────────────────────────────────────────── */
:root {
    --cb-primary: #1a3c6e;
    --cb-primary-light: #6B8FC9;
    --cb-primary-hover: #153258;
    --cb-bg: #f5f7fa;
    --cb-white: #ffffff;
    --cb-text: #222222;
    --cb-text-muted: #6b7280;
    --cb-border: #e5e7eb;
    --cb-msg-bot: #ffffff;
    --cb-msg-user: #1a3c6e;
    --cb-msg-user-text: #ffffff;
    --cb-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    --cb-radius: 16px;
    --cb-fab-size: 60px;
    --cb-panel-w: 380px;
    --cb-panel-h: 520px;
    --cb-z: 9000;
    --cb-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Wrapper ────────────────────────────────────────────────────────── */
.chatbot-wrapper {
    position: fixed;
    bottom: 80px; /* footer (60px) fölé */
    right: 24px;
    z-index: var(--cb-z);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

/* ── FAB (lebegő gomb) ──────────────────────────────────────────────── */
.chatbot-fab {
    width: var(--cb-fab-size);
    height: var(--cb-fab-size);
    border-radius: 50%;
    border: none;
    background: var(--cb-primary);
    color: var(--cb-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(26, 60, 110, 0.35);
    transition: all var(--cb-transition);
    position: relative;
}

.chatbot-fab:hover {
    background: var(--cb-primary-hover);
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(26, 60, 110, 0.45);
}

.chatbot-fab:active {
    transform: scale(0.95);
}

.chatbot-fab--hidden {
    opacity: 0;
    transform: scale(0.5);
    pointer-events: none;
}

.chatbot-fab__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: var(--cb-white);
    font-size: 12px;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--cb-white);
    animation: cb-pulse 2s ease-in-out infinite;
}

/* ── Chat panel ─────────────────────────────────────────────────────── */
.chatbot-panel {
    position: absolute;
    bottom: 0;
    right: 0;
    width: var(--cb-panel-w);
    height: var(--cb-panel-h);
    background: var(--cb-bg);
    border-radius: var(--cb-radius);
    box-shadow: var(--cb-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Zárt állapot */
    opacity: 0;
    transform: translateY(20px) scale(0.92);
    pointer-events: none;
    transition: all var(--cb-transition);
}

.chatbot-panel--open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

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

.chatbot-header__info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-header__avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--cb-white);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.chatbot-header__avatar img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.chatbot-header__text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.chatbot-header__name {
    font-weight: 700;
    font-size: 15px;
}

.chatbot-header__status {
    font-size: 12px;
    opacity: 0.85;
}

.chatbot-header__close {
    background: transparent;
    border: none;
    color: var(--cb-white);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--cb-transition);
}

.chatbot-header__close:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ── Üzenetek terület ───────────────────────────────────────────────── */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Scrollbar stílus */
.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--cb-primary-light);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

/* ── Üzenet buborék ─────────────────────────────────────────────────── */
.chatbot-msg {
    display: flex;
    gap: 8px;
    max-width: 88%;
    animation: cb-fadeIn 0.3s ease;
}

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

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

.chatbot-msg__avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--cb-white);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--cb-border);
    margin-top: 2px;
}

.chatbot-msg__avatar img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.chatbot-msg__bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-break: break-word;
}

.chatbot-msg--bot .chatbot-msg__bubble {
    background: var(--cb-msg-bot);
    color: var(--cb-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.chatbot-msg--user .chatbot-msg__bubble {
    background: var(--cb-msg-user);
    color: var(--cb-msg-user-text);
    border-bottom-right-radius: 4px;
}

.chatbot-msg__bubble p {
    margin: 0 0 4px 0;
}

.chatbot-msg__bubble p:last-of-type {
    margin-bottom: 0;
}

.chatbot-msg__time {
    display: block;
    font-size: 10px;
    opacity: 0.55;
    margin-top: 4px;
    text-align: right;
}

/* ── Gépelés animáció ───────────────────────────────────────────────── */
.chatbot-typing {
    display: flex;
    gap: 5px;
    padding: 4px 2px;
    align-items: center;
}

.chatbot-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cb-primary-light);
    animation: cb-bounce 1.4s ease-in-out infinite;
}

.chatbot-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ── Javasolt kérdések ──────────────────────────────────────────────── */
.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-left: 38px; /* avatar width + gap */
    animation: cb-fadeIn 0.4s ease;
}

.chatbot-suggestion-btn {
    background: var(--cb-white);
    color: var(--cb-primary);
    border: 1.5px solid var(--cb-primary-light);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--cb-transition);
    white-space: nowrap;
}

.chatbot-suggestion-btn:hover {
    background: var(--cb-primary);
    color: var(--cb-white);
    border-color: var(--cb-primary);
}

/* ── Input mező ─────────────────────────────────────────────────────── */
.chatbot-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: var(--cb-white);
    border-top: 1px solid var(--cb-border);
    flex-shrink: 0;
}

.chatbot-input__field {
    flex: 1;
    border: 1.5px solid var(--cb-border);
    border-radius: 22px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color var(--cb-transition);
    font-family: inherit;
    background: var(--cb-bg);
}

.chatbot-input__field:focus {
    border-color: var(--cb-primary-light);
}

.chatbot-input__field::placeholder {
    color: var(--cb-text-muted);
}

.chatbot-input__field:disabled {
    opacity: 0.6;
}

.chatbot-input__send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--cb-primary);
    color: var(--cb-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--cb-transition);
}

.chatbot-input__send:hover:not(:disabled) {
    background: var(--cb-primary-hover);
    transform: scale(1.05);
}

.chatbot-input__send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Animációk ──────────────────────────────────────────────────────── */
@keyframes cb-fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes cb-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

/* ── Reszponzív ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .chatbot-wrapper {
        bottom: 70px;
        right: 12px;
    }

    .chatbot-panel {
        width: calc(100vw - 24px);
        height: calc(100vh - 160px);
        right: -12px;
        bottom: -10px;
        border-radius: 12px;
    }

    .chatbot-fab {
        width: 52px;
        height: 52px;
    }
}

@media (max-width: 380px) {
    .chatbot-panel {
        width: 100vw;
        height: calc(100vh - 140px);
        right: -12px;
        border-radius: 12px 12px 0 0;
    }
}
