/* ============================================
   CHATBOT COSANZEANA — Widget Styles
   Campaign: Zero Griji / eContabilul.ro
   ============================================ */

/* --- Bubble (closed state) --- */
.cb-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: none;
    border: 3px solid #fff;
    padding: 0;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    transition: transform .2s ease, box-shadow .2s ease;
    animation: cb-pulse 2s ease-out 2s 1;
}
.cb-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0,0,0,.3);
}
.cb-bubble__img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
}
/* Green online dot */
.cb-bubble__dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 16px;
    height: 16px;
    background: #25D366;
    border: 2.5px solid #fff;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}

@keyframes cb-pulse {
    0%   { box-shadow: 0 4px 16px rgba(0,0,0,.25), 0 0 0 0 rgba(37,211,102,.4); }
    70%  { box-shadow: 0 4px 16px rgba(0,0,0,.25), 0 0 0 16px rgba(37,211,102,0); }
    100% { box-shadow: 0 4px 16px rgba(0,0,0,.25), 0 0 0 0 rgba(37,211,102,0); }
}

/* --- Window --- */
.cb-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.15);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(16px) scale(.96);
    opacity: 0;
    pointer-events: none;
    transition: transform .3s ease-out, opacity .3s ease-out;
}
.cb-window--open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* --- Header --- */
.cb-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #32373c;
    color: #fff;
    flex-shrink: 0;
}
.cb-header__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.cb-header__info { flex: 1; min-width: 0; }
.cb-header__name {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
}
.cb-header__sub {
    font-family: 'Inter Tight', sans-serif;
    font-size: 12px;
    opacity: .7;
}
.cb-header__close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: background .15s;
    flex-shrink: 0;
}
.cb-header__close:hover { background: rgba(255,255,255,.15); }

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

/* --- Message bubbles --- */
.cb-msg {
    max-width: 85%;
    padding: 10px 14px;
    font-family: 'Inter Tight', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    animation: cb-msg-in .25s ease-out;
}
.cb-msg--bot {
    align-self: flex-start;
    background: #f0f0f0;
    color: #32373c;
    border-radius: 4px 16px 16px 16px;
}
.cb-msg--user {
    align-self: flex-end;
    background: #32373c;
    color: #fff;
    border-radius: 16px 4px 16px 16px;
}

@keyframes cb-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Typing indicator --- */
.cb-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #f0f0f0;
    border-radius: 4px 16px 16px 16px;
}
.cb-typing__dot {
    width: 8px;
    height: 8px;
    background: #aaa;
    border-radius: 50%;
    animation: cb-bounce .6s ease-in-out infinite;
}
.cb-typing__dot:nth-child(2) { animation-delay: .15s; }
.cb-typing__dot:nth-child(3) { animation-delay: .3s; }

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

/* --- Footer / Input area --- */
.cb-footer {
    padding: 12px;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
    background: #fff;
}
.cb-input-row {
    display: flex;
    gap: 8px;
}
.cb-input {
    flex: 1;
    height: 44px;
    padding: 0 14px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-family: 'Inter Tight', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
}
.cb-input:focus { border-color: #32373c; }
.cb-input::placeholder { color: #aaa; }

.cb-send {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: #32373c;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s;
}
.cb-send:hover { background: #4a5058; }
.cb-send svg { width: 20px; height: 20px; fill: #fff; }

/* --- Choice buttons (start step) --- */
.cb-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cb-choice-btn {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #32373c;
    border-radius: 8px;
    background: #fff;
    color: #32373c;
    font-family: 'Inter Tight', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, color .15s;
    text-align: left;
}
.cb-choice-btn:hover {
    background: #32373c;
    color: #fff;
}

/* --- WhatsApp button (final step) --- */
.cb-wa-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background: #25D366;
    color: #fff;
    font-family: 'Inter Tight', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s;
}
.cb-wa-btn:hover { background: #1fb855; }
.cb-wa-btn svg { width: 20px; height: 20px; fill: #fff; flex-shrink: 0; }

/* --- Validation error --- */
.cb-input--error {
    border-color: #cf2e2e;
    animation: cb-shake .3s ease;
}
@keyframes cb-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* --- Scrollbar --- */
.cb-messages::-webkit-scrollbar { width: 4px; }
.cb-messages::-webkit-scrollbar-track { background: transparent; }
.cb-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* --- Preview tooltip (auto-shows after 5s) --- */
.cb-preview {
    position: fixed;
    bottom: 30px;
    right: 100px;
    z-index: 9998;
    cursor: pointer;
    animation: cb-preview-in .4s ease-out;
}
.cb-preview__bubble {
    background: #fff;
    border-radius: 20px;
    padding: 10px 32px 10px 16px;
    box-shadow: 0 2px 16px rgba(0,0,0,.15);
    white-space: nowrap;
    position: relative;
}
.cb-preview__text {
    font-family: 'Inter Tight', sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: #32373c;
}
.cb-preview__close {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #bbb;
    font-size: 15px;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
}
.cb-preview__close:hover { color: #32373c; }
/* Arrow pointing right toward the bubble */
.cb-preview__bubble::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -5px;
    margin-top: -6px;
    width: 10px;
    height: 10px;
    background: #fff;
    transform: rotate(45deg);
}

@keyframes cb-preview-in {
    from { opacity: 0; transform: translateX(10px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ============================================
   MOBILE (<480px)
   ============================================ */
@media (max-width: 480px) {
    .cb-window {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
    }
    .cb-window--open ~ .cb-bubble { display: none; }
}
