/* ============================================================
   Floating Form Slider Pro — Public Styles
   ============================================================ */

:root {
    --ffsp-accent:        #4f46e5;
    --ffsp-accent-dark:   #4338ca;
    --ffsp-panel-w:       380px;
    --ffsp-panel-h:       100vh;
    --ffsp-btn-size:      56px;
    --ffsp-btn-bottom:    28px;
    --ffsp-btn-side:      24px;
    --ffsp-glass-bg:      rgba(255, 255, 255, 0.15);
    --ffsp-glass-blur:    18px;
    --ffsp-border-color:  rgba(255, 255, 255, 0.25);
    --ffsp-shadow:        0 8px 32px rgba(0, 0, 0, 0.22);
    --ffsp-transition:    0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --ffsp-z:             999999;
}

/* ── Reset within wrapper ── */
#ffsp-wrapper,
#ffsp-wrapper * {
    box-sizing: border-box;
}

/* ── Wrapper ── */
#ffsp-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: var(--ffsp-z);
    pointer-events: none;
}

#ffsp-wrapper.ffsp-position-right {
    left: auto;
    right: 0;
}

/* ── Floating Button ── */
.ffsp-floating-btn {
    pointer-events: all;
    position: fixed;
    bottom: var(--ffsp-btn-bottom);
    left: var(--ffsp-btn-side);
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--ffsp-accent);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 0 20px 0 16px;
    height: var(--ffsp-btn-size);
    min-width: var(--ffsp-btn-size);
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.5);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    z-index: calc(var(--ffsp-z) + 1);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

#ffsp-wrapper.ffsp-position-right .ffsp-floating-btn {
    left: auto;
    right: var(--ffsp-btn-side);
}

.ffsp-floating-btn:hover {
    background: var(--ffsp-accent-dark);
    transform: scale(1.06);
    box-shadow: 0 6px 24px rgba(79, 70, 229, 0.6);
}

.ffsp-floating-btn:focus-visible {
    outline: 3px solid rgba(79, 70, 229, 0.5);
    outline-offset: 3px;
}

.ffsp-btn-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.ffsp-btn-icon svg {
    width: 22px;
    height: 22px;
}

.ffsp-btn-label {
    white-space: nowrap;
}

/* ── Pulse animation ── */
@keyframes ffsp-pulse {
    0%   { box-shadow: 0 0 0 0   rgba(79, 70, 229, 0.55); }
    70%  { box-shadow: 0 0 0 14px rgba(79, 70, 229, 0);    }
    100% { box-shadow: 0 0 0 0   rgba(79, 70, 229, 0);     }
}

.ffsp-floating-btn.ffsp-animated {
    animation: ffsp-pulse 2s infinite;
}

/* Stop pulse when panel is open */
.ffsp-floating-btn[aria-expanded="true"] {
    animation: none;
}

/* ── Backdrop ── */
.ffsp-backdrop {
    pointer-events: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: background var(--ffsp-transition);
    z-index: calc(var(--ffsp-z) - 1);
}

.ffsp-backdrop.ffsp-open {
    pointer-events: all;
    background: rgba(0, 0, 0, 0.35);
}

/* ── Panel ── */
.ffsp-panel {
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    width: var(--ffsp-panel-w);
    height: var(--ffsp-panel-h);
    transform: translateX(-100%);
    transition: transform var(--ffsp-transition);
    z-index: var(--ffsp-z);
    will-change: transform;
    max-width: 100vw;
}

#ffsp-wrapper.ffsp-position-right .ffsp-panel {
    left: auto;
    right: 0;
    transform: translateX(100%);
}

.ffsp-panel.ffsp-open {
    pointer-events: all;
    transform: translateX(0);
}

/* Fix: right-position open state must override the high-specificity rule above */
#ffsp-wrapper.ffsp-position-right .ffsp-panel.ffsp-open {
    transform: translateX(0);
}

/* ── Glass UI ── */
.ffsp-panel-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(var(--ffsp-glass-blur));
    -webkit-backdrop-filter: blur(var(--ffsp-glass-blur));
    border-right: 1px solid var(--ffsp-border-color);
    box-shadow: var(--ffsp-shadow);
}

#ffsp-wrapper.ffsp-position-right .ffsp-panel-inner {
    border-right: none;
    border-left: 1px solid var(--ffsp-border-color);
    border-radius: 16px 0 0 16px;
}

#ffsp-wrapper.ffsp-position-left .ffsp-panel-inner {
    border-radius: 0 16px 16px 0;
}

/* ── Panel Header ── */
.ffsp-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: var(--ffsp-accent);
    color: #fff;
    flex-shrink: 0;
}

#ffsp-wrapper.ffsp-position-left .ffsp-panel-header {
    border-radius: 0 16px 0 0;
}

#ffsp-wrapper.ffsp-position-right .ffsp-panel-header {
    border-radius: 16px 0 0 0;
}

.ffsp-panel-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.ffsp-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.ffsp-close-btn:hover {
    background: rgba(255, 255, 255, 0.32);
}

.ffsp-close-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.7);
    outline-offset: 2px;
}

.ffsp-close-btn svg {
    pointer-events: none;
}

/* ── Panel Body ── */
.ffsp-panel-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 20px;
    scroll-behavior: smooth;
}

/* Scrollbar */
.ffsp-panel-body::-webkit-scrollbar {
    width: 5px;
}

.ffsp-panel-body::-webkit-scrollbar-track {
    background: transparent;
}

.ffsp-panel-body::-webkit-scrollbar-thumb {
    background: rgba(79, 70, 229, 0.3);
    border-radius: 3px;
}

/* ── Fluent Forms inside panel ── */
.ffsp-panel-body .fluentform,
.ffsp-panel-body .ff-form-wrap {
    max-width: 100% !important;
}

.ffsp-panel-body .ff_submit_btn_wrapper {
    margin-top: 8px;
}

.ffsp-panel-body .ff-btn-submit {
    width: 100%;
    background: var(--ffsp-accent) !important;
    border-color: var(--ffsp-accent) !important;
}

.ffsp-panel-body .ff-btn-submit:hover {
    background: var(--ffsp-accent-dark) !important;
    border-color: var(--ffsp-accent-dark) !important;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    :root {
        --ffsp-panel-w: 100vw;
        --ffsp-btn-bottom: 20px;
        --ffsp-btn-side:   16px;
    }

    .ffsp-floating-btn {
        padding: 0 14px 0 12px;
        height: 48px;
        font-size: 13px;
    }

    .ffsp-panel-inner {
        border-radius: 0 !important;
    }

    .ffsp-panel-header {
        border-radius: 0 !important;
    }
}

@media (max-width: 360px) {
    .ffsp-btn-label {
        display: none;
    }

    .ffsp-floating-btn {
        padding: 0;
        width: var(--ffsp-btn-size);
        height: var(--ffsp-btn-size);
        border-radius: 50%;
        justify-content: center;
    }
}
