/* ===== WLC Public Chat Styles ===== */
/* Uses CSS custom properties injected per-chat via inline style on .wlc-chat-wrapper */

.wlc-chat-wrapper {
    display: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: var(--wlc-font-size, 14px);
    -webkit-font-smoothing: antialiased;
}
.wlc-chat-wrapper.wlc-open { display: block; }

/* OVERLAY */
.wlc-overlay {
    position: fixed;
    inset: 0;
    background: var(--wlc-overlay, rgba(0,0,0,0.5));
    z-index: 99990;
    opacity: 0;
    transition: opacity .25s ease;
}
.wlc-chat-wrapper.wlc-open .wlc-overlay { opacity: 1; }

/* MODAL */
.wlc-modal {
    position: fixed;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--wlc-chat-bg, #ECE5DD);
    box-shadow: 0 8px 40px rgba(0,0,0,0.22);
    border-radius: var(--wlc-radius, 12px);
    width: var(--wlc-width, 380px);
    height: var(--wlc-height, 600px);
    max-height: 95vh;

    /* Desktop: bottom-right */
    bottom: 24px;
    right: 24px;

    /* Enter animation */
    transform: translateY(24px) scale(0.96);
    opacity: 0;
    transition: transform .28s cubic-bezier(.4,0,.2,1), opacity .28s ease;
}
.wlc-chat-wrapper.wlc-open .wlc-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Mobile: full screen */
@media (max-width: 600px) {
    .wlc-modal {
        bottom: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
    }
}

/* HEADER */
.wlc-header {
    background: var(--wlc-header-bg, #075E54);
    color: var(--wlc-header-text, #fff);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    flex-shrink: 0;
    gap: 10px;
}
.wlc-header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wlc-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    flex-shrink: 0;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.wlc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.wlc-avatar-default svg { width: 26px; height: 26px; }
.wlc-header-info { min-width: 0; }
.wlc-header-name {
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wlc-header-status { font-size: 12px; opacity: .85; }
.wlc-close-btn {
    background: none;
    border: none;
    color: var(--wlc-header-text, #fff);
    cursor: pointer;
    padding: 4px;
    opacity: .8;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background .15s, opacity .15s;
}
.wlc-close-btn:hover { background: rgba(255,255,255,.15); opacity: 1; }
.wlc-close-btn svg { width: 20px; height: 20px; }

/* BODY */
.wlc-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: var(--wlc-chat-bg, #ECE5DD);
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23b2b2b2' fill-opacity='0.07'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* MESSAGES SCROLL AREA */
.wlc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scroll-behavior: smooth;
}
.wlc-messages::-webkit-scrollbar { width: 4px; }
.wlc-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,.2); border-radius: 2px; }

/* BUBBLES */
.wlc-bubble {
    max-width: 80%;
    display: flex;
    flex-direction: column;
    position: relative;
}
.wlc-bubble-in {
    align-self: flex-start;
}
.wlc-bubble-out {
    align-self: flex-end;
}
.wlc-bubble-text {
    padding: 8px 12px;
    border-radius: 8px;
    line-height: 1.5;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,.12);
    position: relative;
}
.wlc-bubble-in .wlc-bubble-text {
    background: var(--wlc-bubble-in, #fff);
    color: var(--wlc-bubble-in-text, #111);
    border-radius: 0 8px 8px 8px;
}
.wlc-bubble-out .wlc-bubble-text {
    background: var(--wlc-bubble-out, #DCF8C6);
    color: var(--wlc-bubble-out-text, #111);
    border-radius: 8px 0 8px 8px;
}
.wlc-bubble-time {
    font-size: 11px;
    color: rgba(0,0,0,.45);
    align-self: flex-end;
    margin-top: 2px;
    padding: 0 4px;
}
.wlc-bubble-out .wlc-bubble-time { display: flex; align-items: center; gap: 3px; }
.wlc-bubble-checkmarks { color: var(--wlc-secondary, #128C7E); font-size: 13px; }

/* TYPING INDICATOR */
.wlc-typing .wlc-bubble-text {
    padding: 12px 16px;
}
.wlc-typing-dots {
    display: flex; gap: 4px; align-items: center;
}
.wlc-typing-dots span {
    width: 7px; height: 7px;
    background: #999;
    border-radius: 50%;
    animation: wlcDot 1.2s ease-in-out infinite;
}
.wlc-typing-dots span:nth-child(2) { animation-delay: .2s; }
.wlc-typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes wlcDot {
    0%, 80%, 100% { transform: scale(1); opacity: .5; }
    40% { transform: scale(1.3); opacity: 1; }
}

/* INPUT AREA */
.wlc-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #f0f0f0;
    border-top: 1px solid rgba(0,0,0,.08);
    flex-shrink: 0;
}
.wlc-input {
    flex: 1;
    border: none;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: var(--wlc-font-size, 14px);
    background: #fff;
    outline: none;
    box-shadow: 0 1px 2px rgba(0,0,0,.1);
    font-family: inherit;
    line-height: 1.4;
    resize: none;
    max-height: 120px;
    overflow-y: auto;
    transition: box-shadow .15s;
}
.wlc-input:focus { box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.wlc-send-btn {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: var(--wlc-btn-bg, #25D366);
    color: var(--wlc-btn-text, #fff);
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background .15s, transform .1s;
    box-shadow: 0 2px 6px rgba(37,211,102,.35);
}
.wlc-send-btn:hover { filter: brightness(1.08); }
.wlc-send-btn:active { transform: scale(.94); }
.wlc-send-btn svg { width: 20px; height: 20px; }
.wlc-send-btn:disabled { opacity: .5; cursor: default; }

/* SUCCESS / ERROR STATE */
.wlc-success-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 24px;
    text-align: center;
    gap: 12px;
    color: var(--wlc-bubble-in-text, #111);
}
.wlc-success-icon {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: #d1f5e0;
    display: flex; align-items: center; justify-content: center;
}
.wlc-success-icon svg { width: 36px; height: 36px; fill: #15803d; }
.wlc-success-msg { font-size: 15px; font-weight: 600; }

/* ENTER ANIMATION for bubbles */
.wlc-bubble { animation: wlcBubbleIn .2s ease-out; }
@keyframes wlcBubbleIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
