/**
 * The ConvoWise AI Chatbot — Frontend Widget Styles
 */

:root {
    --ttb-primary: #4F46E5;
    --ttb-primary-dark: #D88E05;
    --ttb-secondary: #0F172A;
    --ttb-secondary-light: #2A3E66;
    --ttb-bg-light: #F8FAFC;
    --ttb-border: #E2E8F0;
    --cw-text-main: #1E293B;
    --cw-text-muted: #64748B;
    --ttb-user-bubble: #0F172A;
    --cw-bot-bubble: #FFFFFF;
    --ttb-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 4px 10px rgba(0, 0, 0, 0.05);
    --ttb-z-index: 2147483647;
    --ttb-radius: 16px;
    --ttb-width: 400px;
    --ttb-height: 600px;
    --cw-launcher-size: 60px;
}

/* ==========================================================================
   Base Container & Positioning
   ========================================================================== */

.convowise-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--cw-text-main);
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.convowise-container *,
.convowise-container *::before,
.convowise-container *::after {
    box-sizing: inherit;
}

/* Theme button resets */
.convowise-container button {
    text-transform: none;
    letter-spacing: normal;
    font-family: inherit;
}

.cw-mode-floating {
    position: fixed;
    z-index: var(--ttb-z-index);
}

.cw-pos-bottom-right {
    bottom: var(--cw-bottom-offset, 24px);
    right: var(--cw-side-offset, 24px);
}

.cw-pos-bottom-left {
    bottom: var(--cw-bottom-offset, 24px);
    left: var(--cw-side-offset, 24px);
}

/* Inline shortcode mode */
.cw-mode-inline {
    position: relative;
    max-width: 100%;
    width: 100%;
    margin: 20px 0;
}

.cw-mode-inline .cw-chat-window {
    position: relative;
    display: flex;
    opacity: 1;
    visibility: visible;
    transform: none;
    width: 100%;
    max-width: 600px;
    height: 620px;
    margin: 0 auto;
    box-shadow: var(--ttb-shadow);
}

/* ==========================================================================
   Launcher Button
   ========================================================================== */

.cw-launcher-btn {
    width: var(--cw-launcher-size);
    height: var(--cw-launcher-size);
    border-radius: 50%;
    background: var(--ttb-secondary);
    border: 3px solid var(--ttb-primary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
    padding: 0;
    outline: none;
}

.cw-launcher-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(247, 168, 13, 0.4);
}

.cw-launcher-btn:focus-visible {
    outline: 3px solid var(--ttb-primary);
    outline-offset: 3px;
}

.cw-launcher-icon-open,
.cw-launcher-icon-close {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.cw-launcher-icon-open img {
    border-radius: 50%;
    display: block;
}

.cw-launcher-icon-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
    color: #FFFFFF;
}

.ttb-is-open .cw-launcher-icon-open {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.ttb-is-open .cw-launcher-icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.cw-launcher-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: #EF4444;
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 700;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #FFFFFF;
    animation: ttbPulse 2s infinite;
}

@keyframes ttbPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ==========================================================================
   Chat Window
   ========================================================================== */

.cw-chat-window {
    position: absolute;
    bottom: calc(var(--cw-launcher-size) + 16px);
    right: 0;
    width: var(--ttb-width);
    height: var(--ttb-height);
    max-height: calc(100vh - 120px);
    background: var(--ttb-bg-light);
    border-radius: var(--ttb-radius);
    box-shadow: var(--ttb-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
    border: 1px solid var(--ttb-border);
}

.cw-pos-bottom-left .cw-chat-window {
    right: auto;
    left: 0;
    transform-origin: bottom left;
}

.ttb-is-open .cw-chat-window {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ==========================================================================
   Header
   ========================================================================== */

.cw-chat-header {
    background: var(--ttb-secondary);
    color: #FFFFFF;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--ttb-primary);
    flex-shrink: 0;
}

.cw-launcher-btn.cw-icon-style-chat_bubble .cw-launcher-icon-open svg {
    color: var(--ttb-primary);
}

.cw-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cw-header-logo-wrap {
    max-width: 110px;
    max-height: 36px;
    display: flex;
    align-items: center;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    padding-right: 10px;
    margin-right: 2px;
}

.cw-header-logo-img {
    max-width: 100%;
    max-height: 32px;
    object-fit: contain;
    display: block;
}

.cw-header-avatar {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #FFFFFF;
    padding: 2px;
    flex-shrink: 0;
}

.cw-header-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.cw-status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: #10B981;
    border-radius: 50%;
    border: 2px solid var(--ttb-secondary);
}

.cw-bot-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: -0.01em;
}

.cw-bot-subtitle {
    display: block;
    font-size: 11px;
    color: #94A3B8;
    margin-top: 1px;
}

.cw-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cw-header-btn {
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    color: #FFFFFF !important;
    padding: 0 !important;
    border-radius: 8px !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    box-shadow: none !important;
    line-height: 1 !important;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease !important;
}

.cw-header-btn:hover {
    background: rgba(255, 255, 255, 0.28) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    color: #FFFFFF !important;
    transform: scale(1.05);
}

.cw-header-btn svg {
    display: block;
    stroke: #FFFFFF !important;
}

/* ==========================================================================
   Conversation Messages Area
   ========================================================================== */

.cw-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.cw-chat-messages::-webkit-scrollbar {
    width: 5px;
}

.cw-chat-messages::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 10px;
}

.ttb-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: ttbMessageIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes ttbMessageIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ttb-msg-user {
    align-self: flex-end;
    align-items: flex-end;
}

.ttb-msg-assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.ttb-msg-bubble {
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    word-break: break-word;
}

.ttb-msg-user .ttb-msg-bubble {
    background: var(--ttb-user-bubble);
    color: #FFFFFF;
    border-bottom-right-radius: 4px;
}

.ttb-msg-assistant .ttb-msg-bubble {
    background: var(--cw-bot-bubble);
    color: var(--cw-text-main);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--ttb-border);
}

.ttb-msg-bubble p {
    margin: 0 0 8px;
}

.ttb-msg-bubble p:last-child {
    margin-bottom: 0;
}

.ttb-msg-bubble strong {
    font-weight: 600;
    color: inherit;
}

.ttb-msg-bubble ul, .ttb-msg-bubble ol {
    margin: 6px 0;
    padding-left: 20px;
}

.ttb-msg-bubble li {
    margin-bottom: 4px;
}

.ttb-msg-time {
    font-size: 10px;
    color: var(--cw-text-muted);
    margin-top: 4px;
    padding: 0 4px;
}

/* Source Citations */
.ttb-msg-sources {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #E2E8F0;
    font-size: 11px;
}

.ttb-sources-title {
    display: block;
    font-weight: 600;
    color: var(--cw-text-muted);
    margin-bottom: 6px;
    font-size: 11px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.ttb-sources-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ttb-source-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #F1F5F9;
    color: #1E293B;
    text-decoration: none !important;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    border: 1px solid #E2E8F0;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
    word-break: break-word;
}

.ttb-source-chip:hover {
    background: #E2E8F0;
    border-color: #CBD5E1;
    color: #0F172A;
    transform: translateY(-1px);
}

.ttb-source-chip-icon {
    flex-shrink: 0;
    font-size: 13px;
}

.ttb-source-chip-text {
    flex: 1;
}

/* Typing Indicator */
.ttb-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 18px;
    background: #FFFFFF;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--ttb-border);
    width: fit-content;
}

.ttb-dot {
    width: 6px;
    height: 6px;
    background: #94A3B8;
    border-radius: 50%;
    animation: ttbBounce 1.4s infinite ease-in-out both;
}

.ttb-dot:nth-child(1) { animation-delay: -0.32s; }
.ttb-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes ttbBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ==========================================================================
   Quick Suggestions Chips
   ========================================================================== */

.cw-quick-suggestions {
    padding: 8px 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #F8FAFC;
    border-top: 1px solid #E2E8F0;
    flex-shrink: 0;
    max-height: 150px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 transparent;
}

.cw-quick-suggestions::-webkit-scrollbar {
    width: 4px;
}

.cw-quick-suggestions::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

.cw-chip,
.ttb-chip {
    background: #FFFFFF !important;
    border: 1px solid #E2E8F0 !important;
    color: #1E293B !important;
    padding: 8px 12px !important;
    border-radius: 10px !important;
    font-size: 12.5px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    white-space: normal !important;
    word-break: break-word !important;
    text-align: left !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    margin: 0 !important;
    line-height: 1.35 !important;
    box-sizing: border-box !important;
}

.cw-chip::after,
.ttb-chip::after {
    content: "→";
    font-size: 13px;
    font-weight: 600;
    color: #94A3B8;
    margin-left: 8px;
    flex-shrink: 0;
    transition: transform 0.2s ease, color 0.2s ease;
}

.cw-chip:hover,
.ttb-chip:hover {
    background: #F1F5F9 !important;
    border-color: var(--ttb-primary, #4F46E5) !important;
    color: var(--ttb-primary, #4F46E5) !important;
    transform: translateX(2px) !important;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.12) !important;
}

.cw-chip:hover::after,
.ttb-chip:hover::after {
    color: var(--ttb-primary, #4F46E5);
    transform: translateX(2px);
}

/* ==========================================================================
   Lead Proposal Drawer (Slide Up)
   ========================================================================== */

.cw-lead-drawer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #FFFFFF;
    border-top: 2px solid var(--ttb-primary);
    border-top-left-radius: var(--ttb-radius);
    border-top-right-radius: var(--ttb-radius);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
    padding: 16px 20px 20px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
    max-height: 85%;
    overflow-y: auto;
}

.cw-lead-drawer.cw-drawer-open {
    transform: translateY(0);
}

.cw-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.cw-drawer-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--ttb-secondary);
}

.cw-drawer-close {
    background: transparent;
    border: none;
    font-size: 16px;
    color: #94A3B8;
    cursor: pointer;
}

.cw-lead-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cw-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cw-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.cw-form-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--cw-text-muted);
}

.cw-form-group input,
.cw-form-group textarea {
    padding: 8px 10px;
    border: 1px solid var(--ttb-border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    color: var(--cw-text-main);
    background: #F8FAFC;
    outline: none;
    transition: border 0.15s;
}

.cw-form-group input:focus,
.cw-form-group textarea:focus {
    border-color: var(--ttb-primary);
    background: #FFFFFF;
}

.cw-consent-group {
    margin-top: 4px;
}

.cw-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 11px;
    color: var(--cw-text-muted);
    cursor: pointer;
}

.cw-submit-btn {
    background: var(--ttb-primary);
    color: var(--ttb-secondary);
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 6px;
}

.cw-submit-btn:hover {
    background: var(--ttb-primary-dark);
}

/* ==========================================================================
   Input Bar
   ========================================================================== */

.cw-chat-input-wrap {
    padding: 12px 16px 10px;
    background: #FFFFFF;
    border-top: 1px solid var(--ttb-border);
    flex-shrink: 0;
}

.cw-input-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--ttb-bg-light);
    border: 1px solid var(--ttb-border);
    border-radius: 24px;
    padding: 6px 6px 6px 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.cw-input-container:focus-within {
    border-color: var(--ttb-primary);
    box-shadow: 0 0 0 2px rgba(247, 168, 13, 0.2);
}

.cw-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 100px;
    padding: 4px 0;
    line-height: 1.4;
    color: var(--cw-text-main);
}

.cw-voice-btn {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    border-radius: 50% !important;
    background: #F1F5F9 !important;
    color: #64748B !important;
    border: 1px solid #E2E8F0 !important;
    padding: 0 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.cw-voice-btn:hover {
    background: #E2E8F0 !important;
    color: #0F172A !important;
    transform: scale(1.05);
}

.cw-voice-btn.cw-mic-listening {
    background: #EF4444 !important;
    color: #FFFFFF !important;
    border-color: #DC2626 !important;
    animation: cwMicPulse 1.2s infinite ease-in-out !important;
}

@keyframes cwMicPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1.12); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.cw-send-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    border-radius: 50% !important;
    background: var(--ttb-primary) !important;
    color: #FFFFFF !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    transition: transform 0.15s, background 0.15s !important;
}

.cw-send-btn:hover {
    background: var(--ttb-primary-dark) !important;
    transform: scale(1.06);
}

.cw-send-btn svg {
    display: block !important;
    stroke: #FFFFFF !important;
    fill: none !important;
    width: 18px !important;
    height: 18px !important;
}

.cw-input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    padding: 0 4px;
    font-size: 10px;
    color: var(--cw-text-muted);
}

.cw-open-drawer-link {
    background: transparent;
    border: none;
    color: var(--ttb-primary-dark);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.cw-open-drawer-link:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Mobile Responsiveness (Fullscreen App Layout)
   ========================================================================== */

@media (max-width: 768px) {
    .cw-pos-bottom-right,
    .cw-pos-bottom-left {
        bottom: 16px;
        right: 16px;
        left: auto;
    }

    .convowise-container.ttb-is-open {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100% !important;
        height: 100dvh !important;
        z-index: 999999999 !important;
    }

    .cw-chat-window {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100% !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        transform: translateY(100%);
        display: flex !important;
        flex-direction: column !important;
        z-index: 999999999 !important;
        margin: 0 !important;
    }

    .ttb-is-open .cw-chat-window {
        transform: translateY(0) !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .ttb-is-open #cw-chat-launcher {
        display: none !important;
    }

    .cw-chat-header {
        padding: 12px 16px !important;
        flex-shrink: 0 !important;
    }

    .cw-chat-messages {
        flex: 1 1 0 !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 14px 16px !important;
    }

    .cw-quick-suggestions {
        flex-shrink: 0 !important;
        padding: 0 14px 8px !important;
    }

    .cw-chat-input-wrap {
        flex-shrink: 0 !important;
        padding: 10px 14px !important;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important;
        background: #FFFFFF !important;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05) !important;
    }

    .cw-chat-input {
        font-size: 15px !important; /* Prevents auto-zoom in iOS Safari */
    }

    /* Suppress overlapping third-party floating buttons (e.g. WhatsApp, Chat badges) when chat is open — exclude ConvoWise's own buttons */
    body.cw-chat-active .whatsapp-button:not(.convowise-container *),
    body.cw-chat-active [class*="whatsapp"]:not(.convowise-container *):not([class*="cw-"]):not([class*="ttb-"]),
    body.cw-chat-active [id*="whatsapp"]:not(.convowise-container *):not([id*="cw-"]):not([id*="ttb-"]),
    body.cw-chat-active [href*="whatsapp.com"]:not(.convowise-container *),
    body.cw-chat-active [href*="wa.me"]:not(.convowise-container *),
    body.cw-chat-active .joinchat,
    body.cw-chat-active .chaty-widget,
    body.cw-chat-active .ht-ctc-chat,
    body.cw-chat-active .qlwapp,
    body.cw-chat-active .wame_box,
    body.cw-chat-active .nj-facebook-messenger,
    body.cw-chat-active .crisp-client,
    body.cw-chat-active #tidio-chat,
    body.cw-chat-active #hubspot-messages-iframe-container {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
        visibility: hidden !important;
        z-index: -1 !important;
    }
}

/* ==========================================================================
   🤝 Human Handoff / Live Escalation Bar
   ========================================================================== */

.cw-handoff-bar {
    display: none;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    margin: 0;
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.95), rgba(241, 245, 249, 0.95));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--ttb-border);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.cw-handoff-bar.cw-handoff-visible {
    display: flex !important;
    opacity: 1;
    transform: translateY(0);
    animation: cwHandoffSlideIn 0.4s ease forwards;
}

@keyframes cwHandoffSlideIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cw-handoff-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--cw-text-main);
}

.cw-handoff-icon {
    font-size: 16px;
    line-height: 1;
}

.cw-handoff-title {
    font-size: 13px;
    font-weight: 600;
}

.cw-handoff-channels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cw-handoff-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--ttb-border);
    border-radius: 10px;
    background: #fff;
    color: var(--cw-text-main);
    font-size: 12.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    white-space: nowrap;
}

.cw-handoff-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.cw-handoff-btn:active {
    transform: translateY(0);
}

.cw-handoff-btn svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* WhatsApp brand color */
.cw-handoff-whatsapp {
    border-color: #25D366;
    color: #128C7E;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}

.cw-handoff-whatsapp:hover {
    background: #25D366;
    color: #fff;
    border-color: #25D366;
}

.cw-handoff-whatsapp:hover svg {
    fill: #fff;
}

/* Phone accent */
.cw-handoff-phone {
    border-color: #3B82F6;
    color: #1D4ED8;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
}

.cw-handoff-phone:hover {
    background: #3B82F6;
    color: #fff;
    border-color: #3B82F6;
}

.cw-handoff-phone:hover svg {
    stroke: #fff;
}

/* Email accent */
.cw-handoff-email {
    border-color: #F59E0B;
    color: #B45309;
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
}

.cw-handoff-email:hover {
    background: #F59E0B;
    color: #fff;
    border-color: #F59E0B;
}

.cw-handoff-email:hover svg {
    stroke: #fff;
}

/* Custom link accent */
.cw-handoff-custom {
    border-color: var(--ttb-primary);
    color: var(--ttb-primary);
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
}

.cw-handoff-custom:hover {
    background: var(--ttb-primary);
    color: #fff;
    border-color: var(--ttb-primary);
}

.cw-handoff-custom:hover svg {
    stroke: #fff;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .cw-handoff-channels {
        gap: 6px;
    }

    .cw-handoff-btn {
        padding: 7px 10px;
        font-size: 11.5px;
        gap: 4px;
    }

    .cw-handoff-btn svg {
        width: 14px;
        height: 14px;
    }
}

/* ==========================================================================
   🔝 Header Quick Action Handoff Buttons
   ========================================================================== */

.cw-header-handoff {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 4px;
}

.cw-header-handoff-btn {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    border: 1px solid transparent !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
    outline: none !important;
}

.cw-header-handoff-btn:hover {
    transform: scale(1.12) !important;
}

.cw-header-handoff-btn:active {
    transform: scale(0.95) !important;
}

.cw-header-handoff-whatsapp {
    background: #25D366 !important;
    color: #FFFFFF !important;
    border-color: #20BA5A !important;
    box-shadow: 0 2px 10px rgba(37, 211, 102, 0.45) !important;
}

.cw-header-handoff-whatsapp svg {
    fill: #FFFFFF !important;
    width: 17px !important;
    height: 17px !important;
}

.cw-header-handoff-phone {
    background: #3B82F6 !important;
    color: #FFFFFF !important;
    border-color: #2563EB !important;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.45) !important;
}

.cw-header-handoff-phone svg {
    stroke: #FFFFFF !important;
    width: 15px !important;
    height: 15px !important;
}

.cw-header-handoff-email {
    background: #F59E0B !important;
    color: #FFFFFF !important;
    border-color: #D97706 !important;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.45) !important;
}

.cw-header-handoff-email svg {
    stroke: #FFFFFF !important;
    width: 15px !important;
    height: 15px !important;
}

.cw-header-handoff-custom {
    background: var(--ttb-primary) !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 10px rgba(79, 70, 229, 0.45) !important;
}

.cw-header-handoff-custom svg {
    stroke: #FFFFFF !important;
    width: 15px !important;
    height: 15px !important;
}

/* ==========================================================================
   🔽 Footer Quick Action Handoff Links
   ========================================================================== */

.cw-footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cw-footer-handoff {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cw-footer-handoff-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 10.5px;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid var(--ttb-border);
    background: #FFFFFF;
    color: var(--cw-text-main);
    cursor: pointer;
    line-height: 1.2;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.cw-footer-handoff-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.cw-footer-handoff-whatsapp {
    border-color: #25D366;
    color: #128C7E;
    background: #f0fdf4;
}

.cw-footer-handoff-whatsapp:hover {
    background: #25D366;
    color: #FFFFFF;
}

.cw-footer-handoff-whatsapp svg {
    fill: currentColor;
    width: 12px;
    height: 12px;
}

.cw-footer-handoff-phone {
    border-color: #3B82F6;
    color: #1D4ED8;
    background: #eff6ff;
}

.cw-footer-handoff-phone:hover {
    background: #3B82F6;
    color: #FFFFFF;
}

.cw-footer-handoff-phone svg {
    stroke: currentColor;
    width: 12px;
    height: 12px;
}

.cw-footer-handoff-email {
    border-color: #F59E0B;
    color: #B45309;
    background: #fffbeb;
}

.cw-footer-handoff-email:hover {
    background: #F59E0B;
    color: #FFFFFF;
}

.cw-footer-handoff-email svg {
    stroke: currentColor;
    width: 12px;
    height: 12px;
}

.cw-footer-handoff-custom {
    border-color: var(--ttb-primary);
    color: var(--ttb-primary);
    background: #eef2ff;
}

.cw-footer-handoff-custom:hover {
    background: var(--ttb-primary);
    color: #FFFFFF;
}

.cw-footer-handoff-custom svg {
    stroke: currentColor;
    width: 12px;
    height: 12px;
}

