/* Dropify Live Chat - Core Front Styles (Scoped & Isolated) */
:root {
    --lc-primary: var(--primary-color, #0989ff);
    --lc-primary-hover: #0077e6;
    --lc-bg: #ffffff;
    --lc-text: #1e293b;
    --lc-text-muted: #64748b;
    --lc-bubble-user: var(--primary-color, #0989ff);
    --lc-bubble-user-text: #ffffff;
    --lc-bubble-agent: #f1f5f9;
    --lc-bubble-agent-text: #0f172a;
    --lc-border: #e2e8f0;
}

/* CSS Reset scoped strictly to .lc-widget */
.lc-widget,
.lc-widget *,
.lc-widget *::before,
.lc-widget *::after {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

#dropify-live-chat-root.lc-widget {
    position: fixed !important;
    z-index: 2147483000 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    font-size: 14px;
    pointer-events: none;
}

/* Screen Placement - Elevated above Amerce #goTop (bottom: 40px) */
#dropify-live-chat-root.pos-bottom-right {
    bottom: 92px !important;
    right: 20px !important;
}
#dropify-live-chat-root.pos-bottom-left {
    bottom: 92px !important;
    left: 20px !important;
}

/* Floating Launcher Button with "Chat Now" text */
.live-chat-toggle-btn.lc-launcher {
    pointer-events: auto !important;
    min-height: 48px !important;
    height: 48px !important;
    padding: 0 18px !important;
    border-radius: 9999px !important;
    background: var(--lc-primary) !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    cursor: pointer !important;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22) !important;
    border: none !important;
    outline: none !important;
    position: relative !important;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s ease, box-shadow 0.2s ease, width 0.2s ease !important;
}
.live-chat-toggle-btn.lc-launcher.is-open {
    width: 48px !important;
    height: 48px !important;
    padding: 0 !important;
}
.live-chat-toggle-btn.lc-launcher.is-open .lc-launcher-text {
    display: none !important;
}
.live-chat-toggle-btn.lc-launcher:hover {
    transform: scale(1.05) !important;
    background: var(--lc-primary-hover) !important;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28) !important;
}
.live-chat-toggle-btn.lc-launcher:active {
    transform: scale(0.96) !important;
}

/* Attachment button & file chip */
.live-chat-attach-btn {
    background: none !important;
    border: none !important;
    color: var(--lc-text-muted) !important;
    cursor: pointer !important;
    padding: 4px 6px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
    flex-shrink: 0 !important;
}
.live-chat-attach-btn:hover {
    color: var(--lc-primary) !important;
    background: rgba(0, 0, 0, 0.05) !important;
}
.lc-file-chip {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: #f1f5f9 !important;
    border-radius: 6px !important;
    padding: 4px 8px !important;
    margin-bottom: 6px !important;
    font-size: 12px !important;
    color: #334155 !important;
}
.lc-chip-remove {
    background: none !important;
    border: none !important;
    font-size: 16px !important;
    color: #94a3b8 !important;
    cursor: pointer !important;
    padding: 0 4px !important;
}
.lc-chip-remove:hover {
    color: #ef4444 !important;
}

/* Unread Badge */
.lc-unread-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    border-radius: 10px;
    text-align: center;
    padding: 0 5px;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Floating Popup Chatbox Window */
.live-chat-window.lc-popup {
    display: none;
    position: fixed !important;
    width: 380px !important;
    max-width: calc(100vw - 32px) !important;
    height: 540px !important;
    max-height: calc(100vh - 180px) !important;
    background: #ffffff !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22), 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    flex-direction: column !important;
    overflow: hidden !important;
    z-index: 2147483001 !important;
    pointer-events: auto !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    animation: lcPopupFadeSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#dropify-live-chat-root.pos-bottom-right .live-chat-window.lc-popup {
    bottom: 156px !important;
    right: 20px !important;
}
#dropify-live-chat-root.pos-bottom-left .live-chat-window.lc-popup {
    bottom: 156px !important;
    left: 20px !important;
}

.live-chat-window.lc-popup.active {
    display: flex !important;
}

@keyframes lcPopupFadeSlide {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.live-chat-header {
    background: var(--lc-primary) !important;
    color: #ffffff !important;
    padding: 14px 18px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-shrink: 0 !important;
}
.live-chat-title {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 15px !important;
    color: #ffffff !important;
}
.live-chat-title strong {
    font-weight: 600 !important;
    color: #ffffff !important;
}
.live-chat-subtitle {
    font-size: 11.5px !important;
    color: rgba(255, 255, 255, 0.9) !important;
    margin-top: 2px !important;
}
.live-chat-status-dot {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    background: #22c55e !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4) !important;
    display: inline-block !important;
}
.live-chat-close-btn {
    background: none !important;
    border: none !important;
    color: #ffffff !important;
    font-size: 26px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    padding: 0 4px !important;
    opacity: 0.85 !important;
    transition: opacity 0.15s !important;
}
.live-chat-close-btn:hover {
    opacity: 1 !important;
}

/* Pre-Chat Card */
.live-chat-prechat-card {
    padding: 20px !important;
    background: #ffffff !important;
    border-bottom: 1px solid var(--lc-border) !important;
}
.live-chat-prechat-card h5 {
    margin: 0 0 4px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: var(--lc-text) !important;
}
.lc-form-group {
    display: flex !important;
    flex-direction: column !important;
    text-align: left !important;
    margin-bottom: 8px !important;
}
.lc-label {
    font-size: 12px !important;
    font-weight: 500 !important;
    margin-bottom: 4px !important;
    color: var(--lc-text) !important;
}
.lc-input {
    border: 1px solid var(--lc-border) !important;
    border-radius: 8px !important;
    padding: 8px 10px !important;
    font-size: 13px !important;
    outline: none !important;
    background: #ffffff !important;
    color: var(--lc-text) !important;
    transition: border-color 0.15s !important;
}
.lc-input:focus {
    border-color: var(--lc-primary) !important;
}

/* Messages Flow */
.live-chat-messages {
    flex: 1 !important;
    padding: 16px !important;
    overflow-y: auto !important;
    background: #f8fafc !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
}
.live-chat-message {
    max-width: 82% !important;
    padding: 10px 14px !important;
    border-radius: 14px !important;
    font-size: 13.5px !important;
    line-height: 1.45 !important;
    word-break: break-word !important;
}
.live-chat-message p {
    margin: 0 !important;
}
.live-chat-message.user {
    align-self: flex-end !important;
    background: var(--lc-bubble-user) !important;
    color: var(--lc-bubble-user-text) !important;
    border-bottom-right-radius: 4px !important;
}
.live-chat-message.agent,
.live-chat-message.bot {
    align-self: flex-start !important;
    background: var(--lc-bubble-agent) !important;
    color: var(--lc-bubble-agent-text) !important;
    border: 1px solid var(--lc-border) !important;
    border-bottom-left-radius: 4px !important;
}
.live-chat-message.system {
    align-self: center !important;
    background: #e2e8f0 !important;
    color: #475569 !important;
    font-size: 12px !important;
    border-radius: 20px !important;
    padding: 5px 14px !important;
    text-align: center !important;
}

/* Inline Contact Capture Card */
.lc-inline-contact-card {
    align-self: stretch !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 12px !important;
    padding: 14px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
    margin: 6px 0 !important;
}
.lc-inline-contact-card .lc-inline-title {
    font-weight: 600 !important;
    font-size: 13px !important;
    color: var(--lc-text) !important;
    margin-bottom: 4px !important;
}
.lc-inline-contact-card .lc-inline-sub {
    font-size: 11.5px !important;
    color: var(--lc-text-muted) !important;
    margin-bottom: 10px !important;
}
.lc-inline-contact-card .lc-input-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    margin-bottom: 8px !important;
}
.lc-inline-contact-card .lc-actions-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-top: 6px !important;
}
.lc-skip-link {
    background: none !important;
    border: none !important;
    color: var(--lc-text-muted) !important;
    font-size: 11.5px !important;
    cursor: pointer !important;
    text-decoration: underline !important;
    padding: 0 !important;
}
.lc-skip-link:hover {
    color: var(--lc-text) !important;
}

/* CSAT Rating Box */
.live-chat-csat-box {
    padding: 12px !important;
    background: #f1f5f9 !important;
    border-top: 1px solid var(--lc-border) !important;
    text-align: center !important;
}
.lc-stars-row {
    display: flex !important;
    justify-content: center !important;
    gap: 6px !important;
}
.lc-star-btn {
    background: none !important;
    border: none !important;
    font-size: 24px !important;
    color: #cbd5e1 !important;
    cursor: pointer !important;
    transition: color 0.15s, transform 0.15s !important;
    line-height: 1 !important;
    padding: 0 !important;
}
.lc-star-btn:hover,
.lc-star-btn.active {
    color: #f59e0b !important;
    transform: scale(1.2) !important;
}

/* Footer Composer */
.live-chat-footer {
    padding: 10px 14px !important;
    background: #ffffff !important;
    border-top: 1px solid var(--lc-border) !important;
    flex-shrink: 0 !important;
}
.live-chat-input-row {
    display: flex !important;
    gap: 8px !important;
    align-items: flex-end !important;
}
.live-chat-input-row textarea {
    flex: 1 !important;
    border: 1px solid var(--lc-border) !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    font-size: 13.5px !important;
    font-family: inherit !important;
    resize: none !important;
    outline: none !important;
    line-height: 1.4 !important;
    max-height: 90px !important;
    background: #ffffff !important;
    color: var(--lc-text) !important;
    transition: border-color 0.15s !important;
}
.live-chat-input-row textarea:focus {
    border-color: var(--lc-primary) !important;
}
.live-chat-send-btn {
    background: var(--lc-primary) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    width: 38px !important;
    height: 38px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    transition: background-color 0.15s !important;
}
.live-chat-send-btn:hover {
    background: var(--lc-primary-hover) !important;
}
.live-chat-subactions {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-top: 6px !important;
    font-size: 11.5px !important;
}
.btn-link-sm {
    background: none !important;
    border: none !important;
    font-size: 11.5px !important;
    color: var(--lc-text-muted) !important;
    cursor: pointer !important;
    padding: 2px 0 !important;
    text-decoration: underline !important;
}
.btn-link-sm:hover {
    color: var(--lc-text) !important;
}

/* Button & Shortcode Styles */
.lc-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 9px 18px !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    text-decoration: none !important;
    border: 1px solid transparent !important;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s !important;
}
.lc-btn-primary {
    background: var(--lc-primary) !important;
    color: #ffffff !important;
}
.lc-btn-primary:hover {
    background: var(--lc-primary-hover) !important;
    color: #ffffff !important;
}
.lc-btn-outline {
    background: transparent !important;
    border-color: var(--lc-primary) !important;
    color: var(--lc-primary) !important;
}
.lc-btn-outline:hover {
    background: var(--lc-primary) !important;
    color: #ffffff !important;
}
.lc-btn-dark {
    background: #0f172a !important;
    color: #ffffff !important;
}
.lc-btn-dark:hover {
    background: #1e293b !important;
    color: #ffffff !important;
}
.lc-btn-soft {
    background: #eff6ff !important;
    color: #1d4ed8 !important;
    border-color: #bfdbfe !important;
}
.lc-btn-soft:hover {
    background: #dbeafe !important;
}
.w-100 {
    width: 100% !important;
}

/* Responsive Handling on Mobile Devices */
@media (max-width: 576px) {
    #dropify-live-chat-root.pos-bottom-right {
        bottom: 85px !important;
        right: 16px !important;
    }
    #dropify-live-chat-root.pos-bottom-left {
        bottom: 85px !important;
        left: 16px !important;
    }
    .live-chat-window.lc-popup {
        width: auto !important;
        right: 12px !important;
        left: 12px !important;
        bottom: 80px !important;
        max-width: calc(100vw - 24px) !important;
        height: calc(100vh - 100px) !important;
        max-height: 560px !important;
        border-radius: 14px !important;
    }
}
