/* ==================================================================
   VIDEOBOT
   ================================================================== */

.videobot {
    --bot-bg: #17161a;
    --bot-bg-2: #201e24;
    --bot-bg-3: #2a272f;
    --bot-border: rgba(255, 255, 255, 0.08);
    --bot-text: #f5f2ec;
    --bot-muted: rgba(245, 242, 236, 0.6);
    --bot-accent: #ff8a4c;
    --bot-accent-hover: #ffa06b;
    --bot-shadow: 0 20px 60px -15px rgba(0, 0, 0, 0.45),
                  0 8px 24px -8px rgba(0, 0, 0, 0.3);

    --bot-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI",
                Roboto, "Helvetica Neue", Arial, sans-serif;

    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2147483000;
    font-family: var(--bot-font);
}

/* ---- Minimerad bubbla ---- */
.videobot__bubble {
    position: relative;
    width: 116px;
    height: 116px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: none;
    padding: 0;
    background: #1a1a1a;
    box-shadow: var(--bot-shadow);
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 0.35s ease;
    animation: videobot-pop-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.4s backwards;
}

.videobot__bubble:hover {
    transform: scale(1.05);
    box-shadow: 0 24px 70px -15px rgba(0, 0, 0, 0.55),
                0 10px 28px -8px rgba(0, 0, 0, 0.35);
}

.videobot__bubble-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.videobot__bubble-fallback {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #ff8a4c 0%, #c05a20 100%);
}

.videobot__pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--bot-accent);
    opacity: 0;
    pointer-events: none;
    animation: videobot-pulse 2.4s ease-out infinite;
}

.videobot__play-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bot-accent);
    display: grid;
    place-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.videobot__play-badge svg {
    width: 14px;
    height: 14px;
    fill: #fff;
    margin-left: 2px;
}

.videobot__tag {
    position: absolute;
    top: 4px;
    left: -8px;
    transform: translateX(-100%);
    background: #fff;
    color: #1a1a1a;
    font-family: var(--bot-font);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 10px;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    animation: videobot-tag-bob 3.2s ease-in-out infinite;
}

.videobot__tag::after {
    content: "";
    position: absolute;
    right: -5px;
    top: 14px;
    width: 10px;
    height: 10px;
    background: #fff;
    transform: rotate(45deg);
}

/* ---- Expanderad panel (desktop) ---- */
.videobot__panel {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 340px;
    background: var(--bot-bg);
    background-image: radial-gradient(
        ellipse at top right,
        rgba(255, 138, 76, 0.12),
        transparent 60%
    );
    border: 1px solid var(--bot-border);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--bot-shadow);
    color: var(--bot-text);
    display: none;
    transform-origin: bottom right;
}

.videobot--open .videobot__bubble,
.videobot--open .videobot__tag {
    display: none;
}

.videobot--open .videobot__panel {
    display: block;
    animation: videobot-panel-in 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.videobot__video-wrap {
    position: relative;
    aspect-ratio: 9 / 16;
    background: #000;
    overflow: hidden;
}

.videobot__video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.videobot__video-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.35) 0%,
        transparent 18%,
        transparent 55%,
        rgba(23, 22, 26, 0.9) 100%
    );
    pointer-events: none;
}

.videobot__video-caption {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 20px;
    font-family: var(--bot-font);
    font-weight: 600;
    font-size: 1.35rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: #fff;
    pointer-events: none;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.videobot__video-caption em {
    font-style: normal;
    color: var(--bot-accent);
}

/* ---- Topp-knappar ---- */
.videobot__close,
.videobot__mute {
    position: absolute;
    top: 14px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(20, 20, 24, 0.55);
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
    z-index: 2;
    padding: 0;
}

.videobot__close { right: 14px; }
.videobot__mute  { left: 14px; }

.videobot__close:hover,
.videobot__mute:hover {
    background: rgba(20, 20, 24, 0.8);
    border-color: rgba(255, 255, 255, 0.28);
    transform: scale(1.05);
}

.videobot__close:active,
.videobot__mute:active {
    transform: scale(0.96);
}

/* ---- CTA-knappar ---- */
.videobot__actions {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.videobot__btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--bot-border);
    background: var(--bot-bg-2);
    color: var(--bot-text);
    font-family: var(--bot-font);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s, border-color 0.2s;
    text-align: left;
    line-height: 1.3;
}

.videobot__btn:hover {
    background: var(--bot-bg-3);
    border-color: rgba(255, 255, 255, 0.14);
    transform: translateY(-1px);
    color: var(--bot-text);
    text-decoration: none;
}

.videobot__btn--primary {
    background: var(--bot-accent);
    border-color: var(--bot-accent);
    color: #1a1010;
    font-weight: 600;
}

.videobot__btn--primary:hover {
    background: var(--bot-accent-hover);
    border-color: var(--bot-accent-hover);
    color: #1a1010;
}

.videobot__btn-arrow {
    flex-shrink: 0;
    opacity: 0.55;
    transition: transform 0.2s, opacity 0.2s;
    display: inline-flex;
}

.videobot__btn:hover .videobot__btn-arrow {
    transform: translateX(3px);
    opacity: 1;
}

/* ==================================================================
   HUBSPOT
   ================================================================== */
body.videobot-hide-hubspot #hubspot-messages-iframe-container {
    display: none !important;
}

body.videobot-hide-hubspot.videobot-chat-active #hubspot-messages-iframe-container {
    display: block !important;
}

body.videobot-chat-active .videobot {
    display: none;
}

/* ---- Stang-knapp ovanpa HubSpot-chatten ---- */
.videobot-chat-close {
    position: fixed;
    top: max(14px, env(safe-area-inset-top, 14px));
    right: 14px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(20, 20, 24, 0.85);
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    display: none !important;
    place-items: center;
    transition: background 0.2s ease, transform 0.15s ease;
    padding: 0;
    z-index: 2147483001;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

body.videobot-chat-active .videobot-chat-close {
    display: grid !important;
    animation: videobot-pop-in 0.25s ease;
}

.videobot-chat-close:hover {
    background: rgba(20, 20, 24, 0.95);
    transform: scale(1.05);
}

.videobot-chat-close:active {
    transform: scale(0.96);
}

/* ---- Animationer ---- */
@keyframes videobot-pop-in {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

@keyframes videobot-pulse {
    0%   { opacity: 0.6; transform: scale(1); }
    100% { opacity: 0;   transform: scale(1.25); }
}

@keyframes videobot-tag-bob {
    0%, 100% { transform: translateX(-100%) translateY(0); }
    50%      { transform: translateX(-100%) translateY(-3px); }
}

@keyframes videobot-panel-in {
    from { transform: scale(0.6); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

@keyframes videobot-panel-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

/* ==================================================================
   MOBIL
   ================================================================== */
@media (max-width: 640px) {
    .videobot {
        bottom: 16px;
        right: 16px;
        left: auto;
    }

    .videobot__bubble {
        margin-left: auto;
    }

    .videobot__tag {
        display: none;
    }

    .videobot.videobot--open {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        display: flex;
        align-items: flex-end;
        justify-content: center;
        animation: videobot-pop-in 0.25s ease;
    }

    .videobot--open .videobot__panel {
        position: relative;
        width: 100%;
        max-width: 420px;
        bottom: auto;
        right: auto;
        border-radius: 24px 24px 0 0;
        max-height: 92vh;
        max-height: 92dvh;
        display: flex;
        flex-direction: column;
        animation: videobot-panel-slide-up 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    .videobot--open .videobot__video-wrap {
        flex: 1 1 auto;
        min-height: 0;
        aspect-ratio: auto;
    }

    .videobot--open .videobot__actions {
        flex: 0 0 auto;
        padding: 14px 16px max(14px, env(safe-area-inset-bottom, 14px));
    }

    .videobot__close,
    .videobot__mute {
        width: 44px;
        height: 44px;
        top: max(14px, env(safe-area-inset-top, 14px));
    }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    .videobot__bubble,
    .videobot__pulse,
    .videobot__tag,
    .videobot__panel,
    .videobot.videobot--open,
    .videobot-chat-close {
        animation: none !important;
    }
    .videobot__btn,
    .videobot__bubble,
    .videobot__close,
    .videobot__mute,
    .videobot-chat-close {
        transition: none !important;
    }
}