/**
 * WDLON Chat Widget - Frontend Styles
 * Premium black, charcoal and sage green responsive chat UI.
 */
#wdlon-chat-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99999;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    color: #17201a;
}

#wdlon-chat-widget *,
#wdlon-chat-widget *::before,
#wdlon-chat-widget *::after {
    box-sizing: border-box;
    letter-spacing: 0;
}

#wdlon-chat-bubble {
    position: relative;
    width: 74px;
    height: 74px;
    min-width: 74px;
    min-height: 74px;
    border-radius: 50%;
    border: 1px solid rgba(174, 202, 176, 0.72);
    background: radial-gradient(circle at 32% 22%, #303832 0%, #151918 54%, #050606 100%);
    color: #b7cfb8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    isolation: isolate;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.40), 0 0 0 8px rgba(168, 194, 169, 0.14), 0 0 34px rgba(168, 194, 169, 0.38);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    animation: wdlon-launcher-breathe 3.8s ease-in-out infinite;
}

#wdlon-chat-bubble::before,
#wdlon-chat-bubble::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

#wdlon-chat-bubble::before {
    inset: -9px;
    z-index: -1;
    background: radial-gradient(circle, rgba(168, 194, 169, 0.36) 0%, rgba(168, 194, 169, 0.16) 42%, rgba(168, 194, 169, 0) 72%);
    opacity: 0.78;
    animation: wdlon-sage-halo 3.8s ease-in-out infinite;
}

#wdlon-chat-bubble::after {
    inset: 8px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.20) 0%, rgba(255, 255, 255, 0.05) 34%, rgba(255, 255, 255, 0) 58%);
    opacity: 0.72;
}

#wdlon-chat-bubble:hover {
    border-color: rgba(190, 219, 192, 0.92);
    transform: translateY(-4px) scale(1.055);
    box-shadow: 0 26px 58px rgba(0, 0, 0, 0.48), 0 0 0 10px rgba(168, 194, 169, 0.20), 0 0 48px rgba(168, 194, 169, 0.58);
}

#wdlon-chat-bubble:active {
    transform: translateY(-1px) scale(0.98);
}

#wdlon-chat-bubble:focus-visible,
#wdlon-chat-close:focus-visible,
#wdlon-chat-send:focus-visible,
#wdlon-chat-input:focus-visible {
    outline: 3px solid rgba(168, 194, 169, 0.45);
    outline-offset: 3px;
}

.wdlon-bubble-mark,
.wdlon-agent-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.wdlon-bubble-mark {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    padding: 4px;
    background: rgba(252, 253, 251, 0.98);
    border: 1px solid rgba(196, 221, 198, 0.70);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), 0 0 28px rgba(168, 194, 169, 0.64), 0 8px 18px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#wdlon-chat-bubble:hover .wdlon-bubble-mark {
    transform: rotate(-2deg) scale(1.04);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 0 34px rgba(168, 194, 169, 0.78), 0 10px 22px rgba(0, 0, 0, 0.22);
}

.wdlon-bubble-mark img,
.wdlon-agent-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(17, 20, 19, 0.18));
    transition: transform 0.2s ease;
}

#wdlon-chat-bubble:hover .wdlon-bubble-mark img {
    transform: scale(1.08);
}

.wdlon-logo-fallback,
.wdlon-agent-avatar-w {
    font-weight: 800;
    line-height: 1;
    color: #111413;
}

.wdlon-logo-fallback {
    font-size: 10px;
}

.wdlon-bubble-mark i,
.wdlon-agent-avatar-dot,
.wdlon-status-dot {
    border-radius: 50%;
    background: #a8c2a9;
    box-shadow: 0 0 14px rgba(168, 194, 169, 0.82);
}

.wdlon-bubble-mark i {
    position: absolute;
    width: 10px;
    height: 10px;
    right: 6px;
    top: 6px;
    background: #17201a;
    box-shadow: 0 0 0 3px rgba(168, 194, 169, 0.42), 0 0 16px rgba(168, 194, 169, 0.74);
}

#wdlon-chat-panel {
    position: absolute;
    right: 0;
    bottom: 82px;
    width: 400px;
    height: min(640px, calc(100vh - 130px));
    max-width: calc(100vw - 48px);
    display: none;
    flex-direction: column;
    overflow: hidden;
    background: #fcfdfb;
    border: 1px solid rgba(17, 20, 19, 0.10);
    border-radius: 20px;
    box-shadow: 0 26px 76px rgba(0, 0, 0, 0.34);
}

#wdlon-chat-widget.wdlon-chat-open #wdlon-chat-panel {
    display: flex;
}

#wdlon-chat-widget.wdlon-chat-open #wdlon-chat-bubble {
    display: none;
}

#wdlon-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    padding: 14px 16px;
    color: #ffffff;
    background: linear-gradient(135deg, #070808 0%, #151817 100%);
}

.wdlon-header-info {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
}

.wdlon-agent-avatar {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    padding: 5px;
    border: 1px solid rgba(168, 194, 169, 0.60);
    background: rgba(252, 253, 251, 0.98);
    box-shadow: 0 0 24px rgba(168, 194, 169, 0.42);
}

.wdlon-agent-avatar-w {
    font-size: 23px;
}

.wdlon-agent-avatar-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    right: 5px;
    top: 6px;
    background: #111413;
    box-shadow: 0 0 0 3px rgba(168, 194, 169, 0.40);
}

.wdlon-agent-name {
    font-size: 15px;
    line-height: 1.2;
    font-weight: 750;
}

.wdlon-agent-status {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
    color: #c6dac8;
    font-size: 12px;
    line-height: 1.2;
}

.wdlon-status-dot {
    width: 7px;
    height: 7px;
    animation: wdlon-pulse 2s infinite;
}

@keyframes wdlon-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

@keyframes wdlon-launcher-breathe {
    0%, 100% {
        box-shadow: 0 20px 48px rgba(0, 0, 0, 0.40), 0 0 0 8px rgba(168, 194, 169, 0.14), 0 0 34px rgba(168, 194, 169, 0.38);
    }
    50% {
        box-shadow: 0 22px 52px rgba(0, 0, 0, 0.44), 0 0 0 10px rgba(168, 194, 169, 0.18), 0 0 44px rgba(168, 194, 169, 0.50);
    }
}

@keyframes wdlon-sage-halo {
    0%, 100% {
        opacity: 0.62;
        transform: scale(0.92);
    }
    50% {
        opacity: 0.96;
        transform: scale(1.06);
    }
}

#wdlon-chat-close {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease;
}

#wdlon-chat-close:hover {
    background: rgba(255, 255, 255, 0.16);
}

#wdlon-chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    background: linear-gradient(180deg, #fbfcfa 0%, #f7f9f6 100%);
    scroll-behavior: smooth;
}

#wdlon-chat-messages::-webkit-scrollbar {
    width: 5px;
}

#wdlon-chat-messages::-webkit-scrollbar-thumb {
    background: #cfd9d0;
    border-radius: 10px;
}

.wdlon-msg {
    display: flex;
    width: 100%;
    margin-bottom: 12px;
    animation: wdlon-fadeIn 0.22s ease;
}

@keyframes wdlon-fadeIn {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

.wdlon-msg-agent {
    justify-content: flex-start;
}

.wdlon-msg-user {
    justify-content: flex-end;
}

.wdlon-msg-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.wdlon-msg-agent .wdlon-msg-content {
    align-items: flex-start;
    max-width: 82%;
}

.wdlon-msg-user .wdlon-msg-content {
    align-items: flex-end;
    max-width: 78%;
}

.wdlon-msg-bubble {
    width: fit-content;
    max-width: 100%;
    padding: 11px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.45;
    word-break: normal;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.wdlon-msg-agent .wdlon-msg-bubble {
    color: #202823;
    background: #eef3ee;
    border: 1px solid rgba(23, 32, 26, 0.06);
    border-bottom-left-radius: 5px;
}

.wdlon-msg-user .wdlon-msg-bubble {
    color: #ffffff;
    background: #111413;
    border-bottom-right-radius: 5px;
}

.wdlon-msg-time {
    flex-shrink: 0;
    margin-top: 4px;
    color: #87918a;
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
}

.wdlon-handoff-content {
    max-width: 88%;
}

.wdlon-handoff-box {
    width: 100%;
    padding: 14px;
    margin: 2px 0;
    border: 1px solid #c9d8ca;
    border-radius: 16px;
    background: #eef6ee;
}

.wdlon-handoff-box p {
    margin: 0 0 10px;
    color: #263d2a;
    font-size: 13px;
    line-height: 1.45;
}

.wdlon-wa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 999px;
    background: #a8c2a9;
    color: #0f1711 !important;
    font-size: 13px;
    font-weight: 750;
    text-decoration: none;
}

.wdlon-wa-btn:hover {
    background: #93b096;
}

.wdlon-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 88%;
    margin: -4px 0 14px;
    padding-left: 2px;
}

.wdlon-option-chip {
    min-height: 38px;
    max-width: 100%;
    padding: 8px 12px;
    border: 1px solid #c9d8ca;
    border-radius: 999px;
    background: #ffffff;
    color: #18211b;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.2;
    text-align: left;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.wdlon-option-chip:hover {
    border-color: #9fbaa1;
    background: #eef6ee;
    transform: translateY(-1px);
}

.wdlon-option-chip:focus-visible {
    outline: 3px solid rgba(168, 194, 169, 0.45);
    outline-offset: 2px;
}

#wdlon-typing {
    flex-shrink: 0;
    padding: 0 16px 8px;
    background: #f7f9f6;
}

.wdlon-typing-indicator {
    display: flex;
    gap: 4px;
    width: fit-content;
    padding: 9px 13px;
    border-radius: 16px;
    background: #eef3ee;
}

.wdlon-typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8cab8f;
    animation: wdlon-typingBounce 1.4s infinite ease-in-out both;
}

.wdlon-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.wdlon-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes wdlon-typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

#wdlon-chat-input-area {
    flex-shrink: 0;
    padding: 12px 14px 14px;
    border-top: 1px solid #e5ebe5;
    background: #ffffff;
}

#wdlon-consent-check {
    margin-bottom: 9px;
    padding-bottom: 9px;
    border-bottom: 1px solid #edf1ed;
    color: #515d55;
    font-size: 11px;
    line-height: 1.35;
}

#wdlon-consent-check label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}

#wdlon-consent-check input {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 1px;
    accent-color: #8cab8f;
}

#wdlon-consent-check a {
    color: #111413;
    text-decoration: underline;
}

#wdlon-consent-notice {
    margin: 0 0 8px;
    padding: 8px 10px;
    border: 1px solid #c9d8ca;
    border-radius: 10px;
    background: #f1f7f1;
    color: #273d2a;
    font-size: 12px;
    line-height: 1.35;
}

#wdlon-consent-notice[hidden] {
    display: none;
}

.wdlon-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

#wdlon-chat-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    padding: 0 14px;
    border: 1px solid #cfd8cf;
    border-radius: 999px;
    outline: none;
    color: #111413;
    background: #ffffff;
    font-family: inherit;
    font-size: 14px;
}

#wdlon-chat-input:focus {
    border-color: #8cab8f;
    box-shadow: 0 0 0 3px rgba(168, 194, 169, 0.22);
}

#wdlon-chat-send {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #111413;
    color: #a8c2a9;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s ease, background 0.18s ease;
}

#wdlon-chat-send:hover {
    background: #050606;
    transform: translateY(-1px);
}

#wdlon-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#wdlon-chat-footer,
.wdlon-footer-wa,
.wdlon-mini-wa {
    display: none !important;
}

.wdlon-lead-form {
    display: none !important;
}

@media (max-width: 480px) {
    #wdlon-chat-widget {
        right: 12px;
        bottom: 12px;
        left: 12px;
    }

    #wdlon-chat-bubble {
        right: 0;
        margin-left: auto;
        width: 72px;
        height: 72px;
        min-width: 72px;
        min-height: 72px;
    }

    .wdlon-bubble-mark {
        width: 58px;
        height: 58px;
        padding: 4px;
    }

    #wdlon-chat-panel {
        position: fixed;
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: calc(100vw - 24px);
        height: min(78dvh, 620px);
        max-width: none;
        max-height: calc(100dvh - 24px);
        border-radius: 20px;
    }

    #wdlon-chat-header {
        padding: 12px;
    }

    #wdlon-chat-close {
        width: 46px;
        height: 46px;
    }

    #wdlon-chat-messages {
        padding: 14px 12px;
    }

    .wdlon-msg-agent .wdlon-msg-content {
        max-width: 84%;
    }

    .wdlon-msg-user .wdlon-msg-content {
        max-width: 82%;
    }

    .wdlon-msg-bubble {
        font-size: 14px;
    }

    #wdlon-chat-input-area {
        padding: 10px 12px 12px;
    }

    .wdlon-options {
        max-width: 100%;
        gap: 7px;
    }

    .wdlon-option-chip {
        min-height: 40px;
        padding: 9px 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #wdlon-chat-bubble,
    #wdlon-chat-bubble::before,
    .wdlon-bubble-mark,
    .wdlon-bubble-mark img {
        animation: none;
        transition: none;
    }
}

@media (max-width: 340px) {
    .wdlon-msg-agent .wdlon-msg-content,
    .wdlon-msg-user .wdlon-msg-content {
        max-width: 86%;
    }

    #wdlon-chat-header {
        gap: 8px;
    }

    .wdlon-agent-name {
        font-size: 14px;
    }
}
