/* ================================================================
   BOB – Shillova chat assistant
   ----------------------------------------------------------------
   Reuses the design tokens from style.css (brand green, radii,
   shadows, Inter) so the widget looks part of the site rather than
   a bolted-on plugin.

   1. Shell and launcher
   2. Welcome bubble
   3. Panel and header
   4. Messages
   5. Quick replies
   6. Compose row
   7. Highlight on the page
   8. Mobile
   ================================================================ */

/* ================================================================
   1. SHELL AND LAUNCHER
   ================================================================ */
.bob {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 120;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    font-family: var(--font);
}

.bob-launcher {
    position: relative;
    width: 62px;
    height: 62px;
    padding: 0;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 6px 16px rgba(22, 33, 27, .18), 0 14px 34px rgba(22, 33, 27, .18);
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}

.bob-launcher:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 10px 22px rgba(22, 33, 27, .22), 0 20px 44px rgba(22, 33, 27, .22);
}

.bob-face {
    display: block;
    width: 100%;
    height: 100%;
}

/* Small green "online" dot */
.bob-launcher-dot {
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--accent);
}

.bob.is-open .bob-launcher-dot {
    display: none;
}

/* ================================================================
   2. WELCOME BUBBLE
   ================================================================ */
.bob-bubble {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 240px;
    padding: 11px 12px 11px 16px;
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    background: #fff;
    color: var(--ink);
    font-size: .9375rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    animation: bob-pop .28s ease both;
}

.bob-bubble[hidden] {
    display: none;
}

.bob-bubble-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex: none;
    border-radius: 50%;
    color: var(--muted);
    transition: background-color .2s, color .2s;
}

.bob-bubble-close:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.bob-bubble-close .icon {
    width: 14px;
    height: 14px;
    stroke-width: 2.6;
}

@keyframes bob-pop {
    from { opacity: 0; transform: translateY(8px) scale(.96); }
    to   { opacity: 1; transform: none; }
}

/* ================================================================
   3. PANEL AND HEADER
   ================================================================ */
.bob-panel {
    display: flex;
    flex-direction: column;
    width: 370px;
    height: min(536px, calc(100vh - 140px));
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: #fff;
    box-shadow: 0 12px 28px rgba(22, 33, 27, .14), 0 28px 64px rgba(22, 33, 27, .18);
    animation: bob-pop .22s ease both;
}

.bob-panel[hidden] {
    display: none;
}

.bob-head {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 14px;
    background: var(--brand);
    color: #fff;
}

.bob-head-avatar {
    display: block;
    width: 42px;
    height: 42px;
    flex: none;
    border: 2px solid rgba(255, 255, 255, .5);
    border-radius: 50%;
    overflow: hidden;
    background: var(--accent-soft);
}

.bob-head-text {
    display: flex;
    flex-direction: column;
    margin-right: auto;
    line-height: 1.25;
    min-width: 0;
}

.bob-head-text strong {
    color: #fff;
    font-size: 1.0625rem;
    font-weight: 800;
    letter-spacing: -.01em;
}

.bob-role {
    font-size: .8125rem;
    color: rgba(255, 255, 255, .82);
}

/* Language switch, same shape as the one in the site header */
.bob-lang {
    display: inline-flex;
    flex: none;
    padding: 2px;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .16);
}

.bob-lang button {
    min-width: 34px;
    padding: 5px 8px;
    border-radius: var(--r-pill);
    color: rgba(255, 255, 255, .85);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .03em;
    transition: background-color .2s, color .2s;
}

.bob-lang button:hover {
    color: #fff;
}

.bob-lang button.is-active {
    background: #fff;
    color: var(--brand);
}

.bob-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 50%;
    color: #fff;
    transition: background-color .2s;
}

.bob-close:hover {
    background: rgba(255, 255, 255, .18);
}

.bob-close .icon {
    width: 19px;
    height: 19px;
    stroke-width: 2.4;
}

/* ================================================================
   4. MESSAGES
   ================================================================ */
.bob-log {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 14px 6px;
    background: var(--surface-2);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bob-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 100%;
}

.bob-msg--user {
    justify-content: flex-end;
}

.bob-msg-avatar {
    display: block;
    width: 28px;
    height: 28px;
    flex: none;
    border-radius: 50%;
    overflow: hidden;
    background: var(--accent-soft);
}

.bob-msg-text {
    max-width: 78%;
    padding: 10px 13px;
    border-radius: 15px;
    font-size: .9375rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.bob-msg--bob .bob-msg-text {
    border: 1px solid var(--border);
    border-bottom-left-radius: 5px;
    background: #fff;
    color: var(--text);
}

.bob-msg--bob .bob-msg-text strong {
    display: inline-block;
    margin-bottom: 1px;
    color: var(--ink);
}

.bob-msg--user .bob-msg-text {
    border-bottom-right-radius: 5px;
    background: var(--brand);
    color: #fff;
    font-weight: 500;
}

/* Typing dots */
.bob-typing .bob-msg-text {
    display: flex;
    gap: 4px;
    padding: 13px;
}

.bob-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #b8c4bb;
    animation: bob-blink 1.1s infinite ease-in-out;
}

.bob-typing span:nth-child(2) { animation-delay: .18s; }
.bob-typing span:nth-child(3) { animation-delay: .36s; }

@keyframes bob-blink {
    0%, 80%, 100% { opacity: .35; transform: translateY(0); }
    40%           { opacity: 1;   transform: translateY(-3px); }
}

/* ================================================================
   5. QUICK REPLIES
   ================================================================ */
.bob-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding-left: 36px;
}

.bob-reply {
    padding: 8px 14px;
    border: 1.5px solid #cfe0cb;
    border-radius: var(--r-pill);
    background: #fff;
    color: var(--brand);
    font-size: .875rem;
    font-weight: 700;
    line-height: 1.3;
    text-align: left;
    transition: background-color .18s, border-color .18s, transform .18s;
}

.bob-reply:hover {
    background: var(--accent-soft);
    border-color: var(--brand);
    transform: translateY(-1px);
}

/* ================================================================
   6. COMPOSE ROW
   ================================================================ */
.bob-compose {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    background: #fff;
}

.bob-compose input {
    flex: 1;
    min-width: 0;
    height: 44px;
    padding: 0 15px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-pill);
    background: var(--surface-2);
    font-size: .9375rem;
    color: var(--ink);
    transition: border-color .2s, box-shadow .2s, background-color .2s;
}

.bob-compose input::placeholder {
    color: var(--muted);
}

.bob-compose input:focus {
    outline: none;
    background: #fff;
    border-color: var(--brand-mid);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, .13);
}

.bob-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    transition: background-color .2s, transform .2s;
}

.bob-send:hover {
    background: var(--brand-dark);
    transform: scale(1.05);
}

.bob-send .icon {
    width: 20px;
    height: 20px;
    stroke-width: 2.2;
}

/* ================================================================
   7. HIGHLIGHT WHEN BOB SENDS YOU SOMEWHERE
   ================================================================ */
.is-bob-target {
    animation: bob-highlight 2.2s ease;
}

@keyframes bob-highlight {
    0%   { box-shadow: 0 0 0 0 rgba(124, 179, 66, 0); }
    18%  { box-shadow: 0 0 0 5px rgba(124, 179, 66, .55); }
    70%  { box-shadow: 0 0 0 5px rgba(124, 179, 66, .38); }
    100% { box-shadow: 0 0 0 0 rgba(124, 179, 66, 0); }
}

/* Service cards get a rounded ring that follows their own corners */
.service-card.is-bob-target {
    border-color: var(--accent);
}

/* ================================================================
   8. MOBILE
   ================================================================ */

/* The site has its own fixed call bar on phones - keep Bob above it. */
@media (max-width: 760px) {
    .bob {
        right: 14px;
        bottom: calc(84px + env(safe-area-inset-bottom));
        left: 14px;
        align-items: flex-end;
        pointer-events: none;
    }

    .bob > * {
        pointer-events: auto;
    }

    .bob-launcher {
        width: 56px;
        height: 56px;
    }

    /* While the chat is open the site's call bar would sit on top of
       the input, so it steps aside - Bob offers Kontakt himself. */
    body.bob-open .mobile-bar {
        display: none;
    }

    .bob.is-open {
        right: 0;
        left: 0;
        bottom: 0;
        gap: 0;
    }

    .bob.is-open .bob-launcher {
        display: none;
    }

    .bob-panel {
        width: 100%;
        height: min(88vh, 620px);
        height: min(88dvh, 620px);
        border-radius: var(--r-lg) var(--r-lg) 0 0;
        border-bottom: 0;
    }

    .bob-compose {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }

    .bob-msg-text {
        max-width: 82%;
    }
}

@media (max-width: 400px) {
    .bob-replies {
        padding-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bob-bubble,
    .bob-panel,
    .is-bob-target {
        animation: none;
    }

    .bob-typing span {
        animation: none;
        opacity: .5;
    }
}
