/* ════════════════════════════════════════════════════════════
   CHATBOT WIDGET — Replace existing chatbot CSS in portal.css
════════════════════════════════════════════════════════════ */

.chatbot-wrap {
    position: fixed !important;
    bottom: 28px !important;
    right: 24px !important;
    left: auto !important;
    top: auto !important;
    z-index: 1000 !important;
    width: 60px !important;
    height: 60px !important;
    pointer-events: none;
}
/* Bubble button */
.chatbot-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--forest), var(--forest-m));
    border: none;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: var(--white);
    box-shadow: 0 4px 20px rgba(43, 83, 64, .45);
    transition: transform .2s, box-shadow .2s;
    position: relative;
    pointer-events: all;
}
.chatbot-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 28px rgba(43, 83, 64, .55);
}

.chatbot-bubble.open {
    background: var(--dark)
}

/* Notification dot */
.cb-notif {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #EF4444;
    border-radius: 50%;
    border: 2px solid var(--white);
    animation: bl 2s infinite;
}

.cb-notif.hide {
    display: none
}

/* Chat window */
.chatbot-window {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 360px;
    max-height: 540px;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    transform-origin: bottom right;
    transform: translateY(12px) scale(.96);
    opacity: 0;
    visibility: hidden;
    transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), opacity .2s, visibility .2s;
    pointer-events: none;
}

.chatbot-window.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* Header */
.cb-header {
    background: linear-gradient(135deg, var(--forest), var(--forest-m));
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.cb-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    border: 2px solid rgba(255, 255, 255, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Lora', serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--white);
    flex-shrink: 0;
}

.cb-header-info {
    flex: 1
}

.cb-header-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--white);
    line-height: 1.2
}

.cb-header-status {
    font-size: 11.5px;
    color: rgba(255, 255, 255, .75);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px
}

.cb-online-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #6EDDB0;
    display: inline-block;
    animation: bl 2s infinite
}

.cb-close-btn {
    background: rgba(255, 255, 255, .15);
    border: none;
    border-radius: 8px;
    color: var(--white);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    transition: background .18s;
}

.cb-close-btn:hover {
    background: rgba(255, 255, 255, .25)
}

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

.cb-messages::-webkit-scrollbar {
    width: 4px
}

.cb-messages::-webkit-scrollbar-track {
    background: transparent
}

.cb-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px
}

.cb-msg {
    max-width: 85%;
    line-height: 1.55;
    font-size: 13.5px;
    animation: msgIn .2s ease
}

@keyframes msgIn {
    from {
        opacity: 0;
        transform: translateY(8px)
    }

    to {
        opacity: 1;
        transform: none
    }
}

.cb-msg-bot {
    align-self: flex-start;
    background: var(--cream);
    color: var(--dark);
    border-radius: 4px 16px 16px 16px;
    padding: 10px 14px;
    border: 1px solid var(--border)
}

.cb-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--forest), var(--forest-m));
    color: var(--white);
    border-radius: 16px 16px 4px 16px;
    padding: 10px 14px
}

.cb-msg-bot ul,
.cb-msg-bot ol {
    padding-left: 16px;
    margin: 6px 0
}

.cb-msg-bot li {
    margin-bottom: 3px
}

.cb-msg-bot a {
    color: var(--forest);
    font-weight: 700
}

.cb-msg-bot strong {
    color: var(--dark)
}

/* Typing */
.cb-typing {
    align-self: flex-start;
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: 4px 16px 16px 16px;
    padding: 12px 16px;
    display: flex;
    gap: 4px;
    align-items: center
}

.cb-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--faint);
    animation: cbtyping 1.2s infinite
}

.cb-dot:nth-child(2) {
    animation-delay: .2s
}

.cb-dot:nth-child(3) {
    animation-delay: .4s
}

@keyframes cbtyping {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: .4
    }

    30% {
        transform: translateY(-5px);
        opacity: 1
    }
}

/* Quick replies */
.cb-quick-replies {
    padding: 0 14px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0
}

.cb-quick-replies button {
    background: var(--forest-xl);
    border: 1px solid #C0DECE;
    color: var(--forest);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Nunito Sans', sans-serif;
    transition: background .18s;
    white-space: nowrap
}

.cb-quick-replies button:hover {
    background: var(--forest-l)
}

/* Input */
.cb-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    flex-shrink: 0
}

.cb-input {
    flex: 1;
    border: 1.5px solid var(--border);
    border-radius: 30px;
    padding: 9px 16px;
    font-size: 13.5px;
    font-family: 'Nunito Sans', sans-serif;
    color: var(--dark);
    background: var(--cream);
    outline: none;
    transition: border-color .2s;
    width: auto;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none
}

.cb-input:focus {
    border-color: var(--forest);
    background: var(--white);
    box-shadow: none
}

.cb-input::placeholder {
    color: var(--faint)
}

.cb-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--forest);
    color: var(--white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .18s, transform .15s;
    flex-shrink: 0
}

.cb-send-btn:hover {
    background: var(--forest-m);
    transform: scale(1.08)
}

.cb-send-btn:disabled {
    background: var(--faint);
    cursor: not-allowed;
    transform: none
}

.cb-footer-note {
    text-align: center;
    font-size: 10.5px;
    color: var(--faint);
    padding: 4px 14px 10px;
    flex-shrink: 0
}

/* Language switcher — ensure it's always above chatbot */
.lang-switcher {
    position: relative;
    z-index: 201
}

/* Mobile */
@media (max-width: 420px) {
    .chatbot-wrap {
        bottom: 16px !important;
        right: 14px !important;
        width: 56px !important;
        height: 56px !important;
    }

    .chatbot-bubble {
        width: 56px;
        height: 56px;
    }

    .chatbot-window {
        right: 0;
        bottom: 68px;
        width: min(360px, calc(100vw - 28px));
        max-height: 70vh;
    }
}