/* Live Expert Chat Widget */
.sffc-live-expert-widget {
    font-family: 'Inter', 'Helvetica Neue', 'Segoe UI', sans-serif;
    position: relative;
    z-index: 9999;
    color: #0f2533;
}

.sffc-live-expert-widget--floating {
    position: fixed;
    bottom: 32px;
    right: 32px;
}

@media (max-width: 768px) {
    .sffc-live-expert-widget--floating {
        bottom: 18px;
        right: 18px;
    }
}

/* Welcome Message - Real-time Chat Notification */
.sffc-live-expert-welcome {
    position: absolute;
    bottom: calc(100% + 16px);
    right: 0;
    width: 380px;
    max-width: calc(100vw - 64px);
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px);
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.5s;
    z-index: 10000;
    cursor: pointer;
}

.sffc-live-expert-welcome.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.sffc-live-expert-welcome-content {
    background: #ffffff;
    color: #1a1a1a;
    padding: 16px 20px;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12),
                0 2px 8px rgba(0, 0, 0, 0.08),
                0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    position: relative;
    backdrop-filter: blur(10px);
}

.sffc-live-expert-welcome-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0d4b3f, #169977, #10b981);
    border-radius: 16px 16px 0 0;
}

.sffc-live-expert-welcome-content::after {
    content: '';
    position: absolute;
    bottom: -7px;
    right: 40px;
    width: 14px;
    height: 14px;
    background: #ffffff;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    transform: rotate(45deg);
    box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.08);
}

.sffc-live-expert-welcome p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    font-weight: 500;
    color: #1a1a1a;
}

.sffc-live-expert-welcome p strong {
    font-weight: 600;
    color: #0d4b3f;
}

@media (max-width: 768px) {
    .sffc-live-expert-welcome {
        width: 340px;
    }
}

@media (max-width: 480px) {
    .sffc-live-expert-welcome {
        width: 300px;
        max-width: calc(100vw - 36px);
    }

    .sffc-live-expert-welcome-content {
        padding: 14px 16px;
    }
}

/* Toggle Button */
.sffc-live-expert-toggle {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
}

.sffc-live-expert-toggle-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 12px;
    color: #fdfbf5;
    background: #0d353e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 24px rgba(4, 12, 18, 0.25);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.sffc-live-expert-toggle:hover .sffc-live-expert-toggle-inner,
.sffc-live-expert-toggle:focus-visible .sffc-live-expert-toggle-inner {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(3, 10, 15, 0.35);
}

.sffc-live-expert-widget.is-open .sffc-live-expert-toggle {
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px) scale(0.96);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.sffc-live-expert-toggle-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.sffc-live-expert-toggle-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 10px;
}

.sffc-live-expert-toggle-copy {
    text-align: left;
}

.sffc-live-expert-toggle-label {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.sffc-live-expert-toggle-meta {
    margin: 2px 0 0;
    font-size: 11px;
    font-weight: 500;
    opacity: 0.75;
}

.sffc-live-expert-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.6);
    display: inline-block;
}

.sffc-live-expert-toggle-icon .sffc-live-expert-status-dot {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
}

/* Notification Badge */
.sffc-live-expert-notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4),
                0 0 0 2px #0d353e;
    animation: sffc-notification-pulse 2s ease-in-out infinite;
}

@keyframes sffc-notification-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4),
                    0 0 0 2px #0d353e;
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 2px 12px rgba(239, 68, 68, 0.6),
                    0 0 0 2px #0d353e,
                    0 0 0 4px rgba(239, 68, 68, 0.2);
    }
}

@media (max-width: 480px) {
    .sffc-live-expert-toggle-inner {
        padding: 8px 14px;
        gap: 8px;
    }

    .sffc-live-expert-toggle-icon {
        width: 32px;
        height: 32px;
    }

    .sffc-live-expert-toggle-label {
        font-size: 13px;
    }

    .sffc-live-expert-toggle-copy {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
}

/* Panel */
.sffc-live-expert-panel {
    position: fixed;
    bottom: 22px;
    right: 28px;
    width: 460px;
    height: 640px;
    max-width: calc(100vw - 28px);
    max-height: calc(100vh - 32px);
    border-radius: 28px;
    background: linear-gradient(180deg, #fdfbf5 0%, #ffffff 65%);
    border: 1px solid rgba(7, 20, 32, 0.08);
    box-shadow: 0 65px 140px rgba(4, 8, 20, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0.4s;
}

.sffc-live-expert-panel.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

@media (max-width: 768px) {
    .sffc-live-expert-panel {
        left: 0;
        right: 0;
        bottom: 0;
        top: 0;
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        border-left: none;
        border-right: none;
        box-shadow: none;
        margin: 0;
    }
    .sffc-live-expert-widget {
        right: 0;
        left: 0;
    }
}

/* Header */
.sffc-live-expert-header {
    padding: 28px 32px 20px;
    background: linear-gradient(135deg, rgba(12, 58, 63, 0.08), rgba(12, 58, 63, 0.18));
    border-bottom: 1px solid rgba(12, 58, 63, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.sffc-live-expert-header-main {
    display: flex;
    align-items: center;
    gap: 18px;
    flex: 1;
}

.sffc-live-expert-avatar {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(12, 58, 63, 0.15);
    box-shadow: 0 20px 40px rgba(10, 24, 33, 0.18);
}

.sffc-live-expert-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sffc-live-expert-avatar .sffc-live-expert-status-dot {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 12px;
    height: 12px;
    border: 2px solid #fdfbf5;
}

.sffc-live-expert-header-copy {
    flex: 1;
}

.sffc-live-expert-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #0f2533;
}

.sffc-live-expert-subtitle {
    margin: 6px 0 0;
    font-size: 14px;
    color: rgba(15, 37, 51, 0.75);
    line-height: 1.4;
}

.sffc-live-expert-status {
    margin: 10px 0 0;
    font-size: 13px;
    color: rgba(15, 37, 51, 0.8);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sffc-live-expert-close {
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: rgba(12, 58, 63, 0.1);
    color: #0c373f;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.sffc-live-expert-close:hover,
.sffc-live-expert-close:focus-visible {
    background: rgba(12, 58, 63, 0.18);
    transform: translateY(-1px);
}

/* Messages */
.sffc-live-expert-messages {
    flex: 1;
    padding: 24px 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #fffdf6;
}

.sffc-live-expert-messages::-webkit-scrollbar {
    width: 6px;
}

.sffc-live-expert-messages::-webkit-scrollbar-thumb {
    background: rgba(15, 37, 51, 0.25);
    border-radius: 3px;
}

.sffc-live-expert-greeting {
    border-radius: 20px;
    padding: 18px 20px;
    background: rgba(4, 28, 29, 0.06);
    border: 1px solid rgba(4, 28, 29, 0.08);
    color: #0f2533;
    font-size: 14px;
    line-height: 1.55;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.sffc-live-expert-message {
    display: flex;
    gap: 12px;
}

.sffc-live-expert-message.user {
    justify-content: flex-end;
}

.sffc-live-expert-message-bubble {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.55;
    max-width: 75%;
    border: 1px solid transparent;
}

.sffc-live-expert-message.expert .sffc-live-expert-message-bubble {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(7, 20, 32, 0.08);
    box-shadow: 0 18px 40px rgba(5, 13, 20, 0.08);
    color: #0f2533;
}

.sffc-live-expert-message.user .sffc-live-expert-message-bubble {
    background: linear-gradient(135deg, #0d4b3f, #169977);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 18px 45px rgba(15, 115, 107, 0.4);
}

.sffc-live-expert-confirmation .sffc-live-expert-message-bubble {
    background: rgba(7, 40, 45, 0.06);
    border-color: rgba(7, 40, 45, 0.1);
    font-style: italic;
    color: #0b3835;
}

.sffc-live-expert-confirm-topic {
    margin: 6px 0 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    font-style: normal;
    font-weight: 600;
    color: #0a2f2c;
}

.sffc-live-expert-confirm-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.sffc-live-expert-confirm-btn {
    flex: 1;
    border-radius: 12px;
    border: 1px solid rgba(10, 47, 44, 0.2);
    background: #ffffff;
    padding: 8px 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.sffc-live-expert-confirm-btn:hover,
.sffc-live-expert-confirm-btn:focus-visible {
    background: rgba(10, 47, 44, 0.08);
    border-color: rgba(10, 47, 44, 0.35);
}

/* Queue Status Message - Live Agent Connecting */
.sffc-live-expert-queue-status .sffc-live-expert-message-bubble {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.08));
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #065f46;
    font-weight: 600;
    position: relative;
    padding-left: 50px;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.sffc-live-expert-queue-status .sffc-live-expert-message-bubble::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 3px solid rgba(16, 185, 129, 0.3);
    border-top-color: #10b981;
    border-radius: 50%;
    animation: sffc-queue-spinner 0.8s linear infinite;
}

@keyframes sffc-queue-spinner {
    0% {
        transform: translateY(-50%) rotate(0deg);
    }
    100% {
        transform: translateY(-50%) rotate(360deg);
    }
}

.sffc-live-expert-queue-status .sffc-live-expert-message-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Membership Modal */
body.sffc-live-expert-modal-open {
    overflow: hidden;
}

.sffc-live-expert-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.sffc-live-expert-modal.is-visible {
    display: flex;
}

.sffc-live-expert-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(5, 15, 20, 0.65);
}

.sffc-live-expert-modal-dialog {
    position: relative;
    width: min(820px, 92vw);
    max-height: 90vh;
    overflow-y: auto;
    background: #fdfbf5;
    border-radius: 28px;
    padding: 32px;
    box-shadow: 0 40px 120px rgba(3, 10, 15, 0.55);
}

.sffc-live-expert-modal-close {
    position: absolute;
    top: 18px;
    right: 22px;
    border: none;
    background: rgba(5, 15, 20, 0.08);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
}

.sffc-live-expert-modal-header {
    margin-bottom: 24px;
}

.sffc-live-expert-modal-eyebrow {
    margin: 0 0 6px;
    font-size: 12px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: rgba(5, 15, 20, 0.6);
}

.sffc-live-expert-modal-header h3 {
    margin: 0;
    font-size: 24px;
}

.sffc-live-expert-modal-header p {
    margin: 12px 0 0;
    color: rgba(5, 15, 20, 0.8);
    line-height: 1.5;
}

.sffc-live-expert-modal-plans {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.sffc-live-expert-plan-card {
    border: 1px solid rgba(5, 15, 20, 0.12);
    border-radius: 20px;
    padding: 18px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sffc-live-expert-plan-card.is-active {
    border-color: #0d353e;
    box-shadow: 0 12px 32px rgba(13, 53, 62, 0.15);
}

.sffc-live-expert-plan-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sffc-live-expert-plan-name {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.sffc-live-expert-plan-tagline {
    font-size: 13px;
    color: rgba(5, 15, 20, 0.7);
}

.sffc-live-expert-plan-price span {
    font-weight: 700;
    font-size: 18px;
}

.sffc-live-expert-plan-price small {
    display: block;
    font-size: 12px;
    color: rgba(5, 15, 20, 0.6);
}

.sffc-live-expert-plan-features {
    margin: 0;
    padding-left: 18px;
    color: rgba(5, 15, 20, 0.75);
    font-size: 13px;
}

.sffc-live-expert-plan-select {
    margin-top: auto;
    border: none;
    border-radius: 999px;
    background: #0d353e;
    color: #fff;
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
}

.sffc-live-expert-plan-select:hover,
.sffc-live-expert-plan-select:focus-visible {
    background: #0f4a52;
}

.sffc-live-expert-modal-form {
    margin-top: 24px;
    border-top: 1px solid rgba(5, 15, 20, 0.08);
    padding-top: 16px;
}

.sffc-live-expert-plan-form:not([hidden]) {
    display: block;
}

.sffc-live-expert-modal-footer {
    margin-top: 20px;
    text-align: center;
}

.sffc-live-expert-modal-link {
    color: #0d353e;
    font-weight: 600;
}

.sffc-live-expert-message-time {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    opacity: 0.7;
}

/* Templates */
.sffc-live-expert-templates {
    padding: 20px 28px 16px;
    border-top: 1px solid rgba(12, 58, 63, 0.08);
    background: linear-gradient(180deg, #ffffff 0%, #f6faf7 100%);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.sffc-live-expert-templates.hidden {
    display: none;
}

.sffc-live-expert-template-btn {
    border-radius: 16px;
    border: 1px solid rgba(13, 53, 62, 0.15);
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.03em;
    background: rgba(13, 53, 62, 0.04);
    cursor: pointer;
    text-align: left;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.sffc-live-expert-template-btn:hover,
.sffc-live-expert-template-btn:focus-visible {
    transform: translateY(-2px);
    border-color: #0d4645;
    background: rgba(13, 53, 62, 0.08);
}

/* Form */
.sffc-live-expert-form {
    padding: 18px 28px 28px;
    border-top: 1px solid rgba(12, 58, 63, 0.08);
    display: flex;
    gap: 14px;
    align-items: flex-end;
    background: #ffffff;
}

.sffc-live-expert-form textarea {
    flex: 1;
    border-radius: 18px;
    border: 1px solid rgba(15, 37, 51, 0.12);
    padding: 12px 16px;
    min-height: 48px;
    max-height: 140px;
    resize: none;
    font-size: 15px;
    line-height: 1.55;
    font-family: inherit;
    background: linear-gradient(180deg, rgba(15, 37, 51, 0.03), rgba(15, 37, 51, 0.01));
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sffc-live-expert-form textarea:focus {
    outline: none;
    border-color: #0c7e62;
    box-shadow: 0 0 0 3px rgba(12, 126, 98, 0.15);
}

.sffc-live-expert-send {
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: linear-gradient(135deg, #0f644a, #10b981);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 18px 40px rgba(15, 100, 74, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.sffc-live-expert-send:hover,
.sffc-live-expert-send:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 22px 50px rgba(15, 100, 74, 0.55);
}

.sffc-live-expert-send svg {
    width: 20px;
    height: 20px;
}

.sffc-live-expert-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sffc-live-expert-send.is-sending svg {
    animation: sffc-live-expert-spin 1s linear infinite;
}

@keyframes sffc-live-expert-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Confirmation */
.sffc-live-expert-success {
    background: #e8f9f1;
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 18px;
    padding: 18px;
    text-align: center;
    color: #065f46;
    font-weight: 600;
}

.sffc-live-expert-success p {
    margin: 0;
}

@media (max-width: 600px) {
    .sffc-live-expert-header,
    .sffc-live-expert-messages,
    .sffc-live-expert-templates,
    .sffc-live-expert-form {
        padding-left: 18px;
        padding-right: 18px;
    }

    .sffc-live-expert-header-main {
        align-items: flex-start;
    }

    .sffc-live-expert-message-bubble {
        max-width: 100%;
    }
}
