/* ==========================================================================
   SWC Floating CTA — Style A Expandable Contact Hub
   Scoped strictly to #swc-floating-cta
   ========================================================================== */

#swc-floating-cta {
    --swc-fcta-accent: #22717D;
    --swc-fcta-accent-dark: #195761;
    --swc-fcta-surface: #FFFFFF;
    --swc-fcta-ink: #0F172A;
    --swc-fcta-muted: #64748B;
    --swc-fcta-border: #E2E8F0;

    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99990;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    font-family: 'IBM Plex Sans Thai', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.4;
    transition: bottom 240ms cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

#swc-floating-cta.swc-fcta-shifted {
    bottom: 92px;
}

#swc-floating-cta *,
#swc-floating-cta *::before,
#swc-floating-cta *::after {
    box-sizing: border-box;
}

/* Action Bar (Back to Top + Launcher) */
#swc-floating-cta .swc-fcta-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
}

/* Back to Top Button */
#swc-floating-cta .swc-fcta-top {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: var(--swc-fcta-surface);
    color: var(--swc-fcta-ink);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.14);
    cursor: pointer;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 200ms ease, transform 200ms ease, background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

#swc-floating-cta .swc-fcta-top.is-visible {
    opacity: 1;
    transform: translateY(0);
}

#swc-floating-cta .swc-fcta-top[hidden] {
    display: none;
}

#swc-floating-cta .swc-fcta-top:hover {
    background: var(--swc-fcta-accent);
    border-color: var(--swc-fcta-accent);
    color: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.2);
}

/* Main Launcher Pill */
#swc-floating-cta .swc-fcta-launcher {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    height: 50px;
    padding: 0 20px 0 16px;
    border: none;
    border-radius: 999px;
    background: var(--swc-fcta-accent);
    color: #FFFFFF;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 10px 26px -4px rgba(15, 23, 42, 0.28), 0 4px 10px rgba(15, 23, 42, 0.12);
    transition: background-color 180ms ease, transform 180ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 180ms ease;
}

#swc-floating-cta .swc-fcta-launcher:hover {
    background: var(--swc-fcta-accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -4px rgba(15, 23, 42, 0.34), 0 6px 12px rgba(15, 23, 42, 0.14);
}

#swc-floating-cta .swc-fcta-launcher:active {
    transform: translateY(0);
}

#swc-floating-cta .swc-fcta-launcher-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

#swc-floating-cta .swc-fcta-icon-close {
    display: none;
}

#swc-floating-cta.is-open .swc-fcta-icon-chat {
    display: none;
}

#swc-floating-cta.is-open .swc-fcta-icon-close {
    display: inline-flex;
}

#swc-floating-cta .swc-fcta-launcher:focus-visible,
#swc-floating-cta .swc-fcta-top:focus-visible,
#swc-floating-cta .swc-fcta-close:focus-visible,
#swc-floating-cta .swc-fcta-item:focus-visible {
    outline: 2px solid var(--swc-fcta-accent);
    outline-offset: 2px;
}

/* Expandable Contact Panel */
#swc-floating-cta .swc-fcta-panel {
    width: 320px;
    max-width: calc(100vw - 32px);
    background: var(--swc-fcta-surface);
    border: 1px solid var(--swc-fcta-border);
    border-radius: 16px;
    box-shadow: 0 22px 48px -10px rgba(15, 23, 42, 0.24), 0 8px 20px -6px rgba(15, 23, 42, 0.12);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.97);
    transform-origin: bottom right;
    transition: opacity 200ms ease, transform 220ms cubic-bezier(0.22, 1, 0.36, 1), visibility 200ms ease;
    pointer-events: none;
}

#swc-floating-cta.is-open .swc-fcta-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

#swc-floating-cta .swc-fcta-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    background: var(--swc-fcta-accent);
    color: #FFFFFF;
}

#swc-floating-cta .swc-fcta-panel-head-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

#swc-floating-cta .swc-fcta-panel-title {
    font-size: 14.5px;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1.3;
}

#swc-floating-cta .swc-fcta-panel-sub {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.35;
}

#swc-floating-cta .swc-fcta-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #FFFFFF;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 150ms ease;
}

#swc-floating-cta .swc-fcta-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* Channel List */
#swc-floating-cta .swc-fcta-channels {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 6px;
    background: #F8FAFC;
}

#swc-floating-cta .swc-fcta-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 11px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    color: var(--swc-fcta-ink);
    text-decoration: none;
    transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

#swc-floating-cta .swc-fcta-item:hover {
    transform: translateY(-1px);
    border-color: #CBD5E1;
    box-shadow: 0 6px 16px -6px rgba(15, 23, 42, 0.14);
    text-decoration: none;
}

#swc-floating-cta .swc-fcta-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: #FFFFFF;
    flex-shrink: 0;
}

#swc-floating-cta .swc-fcta-item--line .swc-fcta-item-icon {
    background: #06C755;
}

#swc-floating-cta .swc-fcta-item--phone .swc-fcta-item-icon {
    background: #0284C7;
}

#swc-floating-cta .swc-fcta-item--quote .swc-fcta-item-icon {
    background: var(--swc-fcta-accent);
}

#swc-floating-cta .swc-fcta-item--messenger .swc-fcta-item-icon {
    background: #0084FF;
}

#swc-floating-cta .swc-fcta-item--maps .swc-fcta-item-icon {
    background: #EA4335;
}

#swc-floating-cta .swc-fcta-item-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

#swc-floating-cta .swc-fcta-item-label {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--swc-fcta-ink);
    line-height: 1.3;
}

#swc-floating-cta .swc-fcta-item-sub {
    font-size: 11.5px;
    color: var(--swc-fcta-muted);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#swc-floating-cta .swc-fcta-item-arrow {
    display: inline-flex;
    align-items: center;
    color: #94A3B8;
    flex-shrink: 0;
    transition: transform 150ms ease, color 150ms ease;
}

#swc-floating-cta .swc-fcta-item:hover .swc-fcta-item-arrow {
    transform: translateX(2px);
    color: var(--swc-fcta-accent);
}

/* Mobile Compact Mode (<= 480px) */
@media (max-width: 480px) {
    #swc-floating-cta {
        right: 16px;
        bottom: 16px;
    }

    #swc-floating-cta.swc-fcta-shifted {
        bottom: 86px;
    }

    #swc-floating-cta .swc-fcta-launcher {
        width: 54px;
        height: 54px;
        padding: 0;
        border-radius: 50%;
    }

    #swc-floating-cta .swc-fcta-launcher-label {
        display: none;
    }

    #swc-floating-cta .swc-fcta-top {
        width: 42px;
        height: 42px;
    }

    #swc-floating-cta .swc-fcta-panel {
        width: min(320px, calc(100vw - 32px));
    }
}

/* Reduced Motion Accessibility */
@media (prefers-reduced-motion: reduce) {
    #swc-floating-cta,
    #swc-floating-cta .swc-fcta-top,
    #swc-floating-cta .swc-fcta-launcher,
    #swc-floating-cta .swc-fcta-panel,
    #swc-floating-cta .swc-fcta-close,
    #swc-floating-cta .swc-fcta-item,
    #swc-floating-cta .swc-fcta-item-arrow {
        transition: none !important;
    }
}
