/* lrob-toolkit / chatbot — floating + inline widget (no build) */

.lrob-tk-chatbot {
    --lrob-tk-chatbot-color: #00315F;
    --lrob-tk-chatbot-btn: 60px;
    --lrob-tk-chatbot-w: 350px;
    --lrob-tk-chatbot-h: 500px;
    --lrob-tk-chatbot-speed: 0.5s;
    --lrob-tk-chatbot-curve: ease;
    --lrob-tk-chatbot-scale: 0.85;
    --lrob-tk-chatbot-slide: 24px;
    --lrob-tk-chatbot-crop: 0px;
    /* Position translate kept separate from the open/close scale so centered
       positions (bottom-center, middle-*) never lose their offset on open. */
    --lrob-tk-chatbot-pos: none;
}

/* ===== Launcher bubble ===== */
.lrob-tk-chatbot-launcher {
    position: fixed;
    z-index: 9998;
    width: var(--lrob-tk-chatbot-btn);
    height: var(--lrob-tk-chatbot-btn);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: var(--lrob-tk-chatbot-color);
    color: #fff;
    font-size: calc(var(--lrob-tk-chatbot-btn) * 0.45);
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: opacity var(--lrob-tk-chatbot-speed) var(--lrob-tk-chatbot-curve),
                transform var(--lrob-tk-chatbot-speed) var(--lrob-tk-chatbot-curve);
}
.lrob-tk-chatbot-launcher.is-hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

/* ===== Panel ===== */
.lrob-tk-chatbot-panel {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Floating panel: fixed, animated open/close. */
.is-mode-floating .lrob-tk-chatbot-panel {
    position: fixed;
    z-index: 9999;
    width: var(--lrob-tk-chatbot-w);
    height: var(--lrob-tk-chatbot-h);
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    opacity: 1;
    transform: var(--lrob-tk-chatbot-pos) scale(1);
    transition: opacity var(--lrob-tk-chatbot-speed) var(--lrob-tk-chatbot-curve),
                transform var(--lrob-tk-chatbot-speed) var(--lrob-tk-chatbot-curve),
                visibility 0s linear 0s;
}
/* Closed state — hidden, shifted/scaled per enabled animations. */
.is-mode-floating .lrob-tk-chatbot-panel[aria-hidden="true"] {
    visibility: hidden;
    pointer-events: none;
    transform: var(--lrob-tk-chatbot-pos)
               translateY(var(--lrob-tk-chatbot-slide))
               scale(var(--lrob-tk-chatbot-scale));
    transition: opacity var(--lrob-tk-chatbot-speed) var(--lrob-tk-chatbot-curve),
                transform var(--lrob-tk-chatbot-speed) var(--lrob-tk-chatbot-curve),
                visibility 0s linear var(--lrob-tk-chatbot-speed);
}
.has-fade.is-mode-floating .lrob-tk-chatbot-panel[aria-hidden="true"] {
    opacity: 0;
}

/* Fullscreen toggle. */
.is-mode-floating .lrob-tk-chatbot-panel.is-fullscreen {
    width: 90vw;
    height: 90vh;
}

/* Inline embed: a plain live iframe in the content flow (no header/launcher). */
.is-mode-inline {
    display: block;
}
.is-mode-inline .lrob-tk-chatbot-frame-wrap {
    height: var(--lrob-tk-chatbot-h);
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* ===== Positions (floating only) ===== */
.is-pos-bottom-right .lrob-tk-chatbot-launcher,
.is-pos-bottom-right.is-mode-floating .lrob-tk-chatbot-panel { bottom: 20px; right: 20px; }

.is-pos-bottom-left .lrob-tk-chatbot-launcher,
.is-pos-bottom-left.is-mode-floating .lrob-tk-chatbot-panel { bottom: 20px; left: 20px; }

.is-pos-bottom-center .lrob-tk-chatbot-launcher,
.is-pos-bottom-center.is-mode-floating .lrob-tk-chatbot-panel { bottom: 20px; left: 50%; }
.is-pos-bottom-center { --lrob-tk-chatbot-pos: translateX(-50%); }

.is-pos-middle-right .lrob-tk-chatbot-launcher,
.is-pos-middle-right.is-mode-floating .lrob-tk-chatbot-panel { top: 50%; right: 20px; }
.is-pos-middle-right { --lrob-tk-chatbot-pos: translateY(-50%); }

.is-pos-middle-left .lrob-tk-chatbot-launcher,
.is-pos-middle-left.is-mode-floating .lrob-tk-chatbot-panel { top: 50%; left: 20px; }
.is-pos-middle-left { --lrob-tk-chatbot-pos: translateY(-50%); }

/* The launcher uses the position offsets but never the panel's centering
   transform, so reset it for centered positions. */
.is-pos-bottom-center .lrob-tk-chatbot-launcher { transform: translateX(-50%); }
.is-pos-bottom-center .lrob-tk-chatbot-launcher.is-hidden { transform: translateX(-50%) scale(0.8); }
.is-pos-middle-right .lrob-tk-chatbot-launcher,
.is-pos-middle-left .lrob-tk-chatbot-launcher { transform: translateY(-50%); }
.is-pos-middle-right .lrob-tk-chatbot-launcher.is-hidden,
.is-pos-middle-left .lrob-tk-chatbot-launcher.is-hidden { transform: translateY(-50%) scale(0.8); }

/* ===== Header ===== */
.lrob-tk-chatbot-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: var(--lrob-tk-chatbot-color);
    color: #fff;
    font-size: 16px;
}
.lrob-tk-chatbot-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lrob-tk-chatbot-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.lrob-tk-chatbot-expand,
.lrob-tk-chatbot-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    opacity: 0.85;
}
.lrob-tk-chatbot-expand:hover,
.lrob-tk-chatbot-close:hover,
.lrob-tk-chatbot-expand:focus-visible,
.lrob-tk-chatbot-close:focus-visible { opacity: 1; }

/* ===== Iframe + crop ===== */
.lrob-tk-chatbot-frame-wrap {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    overflow: hidden; /* clips the cropped top of the iframe */
}
.lrob-tk-chatbot-frame {
    position: absolute;
    left: 0;
    top: calc(-1 * var(--lrob-tk-chatbot-crop));
    width: 100%;
    height: calc(100% + var(--lrob-tk-chatbot-crop));
    border: none;
}
