/* ----------------------------------- */
/* : Live Chat Widget : */

.chat-widget {
    position: fixed;
    inset-inline-end: 24px;
    bottom: 24px;
    z-index: 1055;
    font-family: var(--font-family-base);
}

.chat-widget-launcher {
    position: absolute;
    bottom: 0;
    inset-inline-end: 0;
    width: var(--square-btn-dimension-lg);
    height: var(--square-btn-dimension-lg);
    border-radius: var(--radius-full);
    background-color: var(--indigo);
    border: 1px solid var(--indigo);
    color: var(--white);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    transition: all 0.15s var(--transition-function-1, ease-out);
}

.chat-widget-launcher:hover {
    background-color: var(--indigo-hover);
    border-color: var(--indigo-hover);
    transform: translateY(-2px);
}

.chat-widget-launcher i {
    font-size: 22px;
    line-height: 1;
}

.chat-widget.is-open .chat-widget-launcher {
    display: none;
}

.chat-widget-badge {
    position: absolute;
    top: -4px;
    inset-inline-end: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: var(--radius-full);
    background-color: var(--red);
    color: var(--white);
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 20px;
    text-align: center;
}

.chat-widget-badge.w-hidden {
    display: none;
}

.chat-widget-panel {
    position: absolute;
    bottom: 0;
    inset-inline-end: 0;
    width: 340px;
    max-height: min(85vh, 640px);
    display: none;
    flex-direction: column;
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    transition: all 0.15s var(--transition-function-1, ease-out);
}

.chat-widget.is-open .chat-widget-panel {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.chat-widget-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 2.5rem 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    background-color: var(--secondary-bg);
}

.chat-widget-close {
    position: absolute;
    top: 0.5rem;
    inset-inline-end: 0.5rem;
    width: var(--square-btn-dimension-xs);
    height: var(--square-btn-dimension-xs);
    border-radius: var(--radius-full);
    background-color: transparent;
    border: 1px solid transparent;
    color: var(--muted-foreground);
    transition: all 0.15s var(--transition-function-1, ease-out);
}

.chat-widget-close:hover {
    background-color: var(--accent);
    color: var(--foreground);
}

.chat-widget-close i {
    font-size: 14px;
    line-height: 1;
}

.chat-widget-header-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: var(--radius-full);
    background-color: var(--indigo);
    color: var(--white);
}

.chat-widget-header-avatar i {
    font-size: 16px;
    line-height: 1;
}

.chat-widget-header-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.chat-widget-header-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--foreground);
}

.chat-widget-header-status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: var(--text-xs);
    color: var(--muted-foreground);
}

.chat-widget-header-status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: var(--radius-full);
    background-color: var(--green);
}

.chat-widget-messages,
.chat-widget-form textarea {
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--background);
}

.chat-widget-messages::-webkit-scrollbar,
.chat-widget-form textarea::-webkit-scrollbar {
    width: 6px;
    background: var(--background);
    border-radius: var(--radius-lg);
}

.chat-widget-messages::-webkit-scrollbar-thumb,
.chat-widget-form textarea::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-lg);
}

.chat-widget-messages {
    flex: 1 1 auto;
    min-height: 340px;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.chat-widget-message {
    max-width: 85%;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.chat-widget-message.is-operator {
    align-self: flex-start;
    background-color: var(--secondary-bg);
    color: var(--foreground-text);
    border: 1px solid var(--border);
    border-bottom-left-radius: var(--radius-none);
}

.chat-widget-message.is-visitor {
    align-self: flex-end;
    background-color: var(--indigo);
    color: var(--white);
    border-bottom-right-radius: var(--radius-none);
}

.chat-widget-greeting {
    align-self: flex-start;
    max-width: 90%;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-none);
    background-color: var(--secondary-bg);
    border: 1px solid var(--border);
    color: var(--foreground-text);
    font-size: var(--text-sm);
    line-height: 1.4;
}

.chat-widget-email {
    padding: 0 1rem 0.75rem;
}

.chat-widget-email input {
    font-size: var(--text-xs);
    padding: var(--input-padding-sm, 0.375rem 0.625rem);
}

.chat-widget-email-hint {
    margin-top: 0.375rem;
    font-size: var(--text-xs);
    color: var(--muted-foreground);
}

.chat-widget-form {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid var(--border);
}

.chat-widget-form textarea {
    resize: none;
    max-height: 90px;
    font-family: var(--font-family-base);
}

.chat-widget-send {
    width: var(--square-btn-dimension-md);
    height: var(--square-btn-dimension-md);
    flex-shrink: 0;
    border-radius: var(--radius-full);
}

.chat-widget-send i {
    font-size: 16px;
    line-height: 1;
}

.chat-widget-send:disabled {
    opacity: 0.6;
    cursor: default;
}

@media (max-width: 480px) {
    .chat-widget {
        inset-inline-end: 12px;
        bottom: 12px;
    }

    .chat-widget-panel {
        width: calc(100vw - 24px);
    }
}
