/* Floating banner (includes/float_banner.php, assets/js/float-banner.js).
   A small card in a bottom corner. Theme tokens from theme.css; no inline styles.
   --cts-float-lift (set by float-banner.js) is the room a phone bottom bar takes (product
   page / cart / checkout), so the card always sits above it. */
.cts-float {
    position: fixed;
    bottom: calc(20px + var(--cts-float-lift, 0px));
    z-index: 1033; /* under the chat (1035) and back-to-top (1034) buttons */
    width: 320px;
    max-width: calc(100vw - 40px);
    background-color: var(--color-white);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-top: 4px solid var(--color-primary);
    border-radius: 14px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.22);
    padding: 1rem 2.6rem 1rem 1rem;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.cts-float[hidden] {
    display: none;
}

.cts-float.is-visible {
    opacity: 1;
    transform: none;
}

.cts-float--left {
    left: 20px;
}

/* Bottom right: above the chat button and the back-to-top button. */
.cts-float--right {
    right: 20px;
    bottom: calc(150px + var(--cts-float-lift, 0px));
}

.cts-float-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background-color: var(--color-bg-secondary);
    color: var(--color-navy);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.cts-float-close:hover {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.cts-float-close:focus-visible {
    outline: none;
    box-shadow: var(--cts-focus-ring);
}

.cts-float-body {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
}

.cts-float-img {
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 10px;
    background-color: var(--color-bg-secondary);
}

.cts-float-content {
    min-width: 0;
}

.cts-float-heading {
    margin: 0 0 0.25rem;
    font-family: var(--font-family-heading);
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.3;
    color: var(--color-navy);
    overflow-wrap: anywhere;
}

.cts-float-text {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--color-text-muted);
    overflow-wrap: anywhere;
}

.cts-float-btn {
    display: inline-block;
    margin-top: 0.7rem;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    background-color: var(--color-primary);
    color: var(--color-white);
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.cts-float-btn:hover {
    background-color: var(--cts-red-hover);
    color: var(--color-white);
}

.cts-float-btn:focus-visible {
    outline: none;
    box-shadow: var(--cts-focus-ring);
}

/* Phones: small and out of the way - always on the left (the chat button is on
   the right), narrower, the message cut to three lines. */
@media (max-width: 575.98px) {
    .cts-float,
    .cts-float--right {
        left: 12px;
        right: auto;
        bottom: calc(16px + var(--cts-float-lift, 0px));
        width: calc(100vw - 96px);
        max-width: 300px;
        padding: 0.75rem 2.25rem 0.75rem 0.75rem;
        border-radius: 12px;
    }

    .cts-float-close {
        top: 6px;
        right: 6px;
        width: 30px;
        height: 30px;
    }

    .cts-float-body {
        gap: 0.6rem;
    }

    .cts-float-img {
        width: 44px;
        height: 44px;
    }

    .cts-float-heading {
        font-size: 0.9rem;
    }

    .cts-float-text {
        font-size: 0.8rem;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .cts-float-btn {
        margin-top: 0.5rem;
        padding: 0.35rem 0.8rem;
        font-size: 0.8rem;
    }
}

/* Admin preview (Manage -> Floating Banner): in place, not floating. */
.cts-float.is-preview {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    opacity: 1;
    transform: none;
    width: 320px;
    max-width: 100%;
}

@media (prefers-reduced-motion: reduce) {
    .cts-float {
        transition: none;
        transform: none;
    }
}
