/* WhatsApp chatbot widget — dark site UI */

.wa-chat {
    --wa-bg: #0a0a0a;
    --wa-header: #000000;
    --wa-thread: #000000;
    --wa-composer: #0a0a0a;
    --wa-border: rgba(255, 255, 255, 0.08);
    --wa-text: #ffffff;
    --wa-muted: rgba(255, 255, 255, 0.55);
    --wa-accent: #00ff88;
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 900;
    font-family: Inter, system-ui, sans-serif;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

body.drawer-open .wa-chat,
body.app-dialog-open .wa-chat,
body.cal-widget-open .wa-chat {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.wa-chat__panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.85rem);
    width: min(calc(100vw - 1.5rem), 340px);
    background: var(--wa-bg);
    border: 1px solid var(--wa-border);
    border-radius: 13px;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.22s ease, visibility 0.2s ease;
}

.wa-chat.is-open .wa-chat__panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.wa-chat__header {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem 0.75rem 0.7rem 0.85rem;
    background: var(--wa-header);
    color: var(--wa-text);
    border-bottom: 1px solid var(--wa-border);
}

.wa-chat__logo,
.wa-chat__bubble-logo,
.wa-chat__fab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wa-chat__logo,
.wa-chat__bubble-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #111;
    border: 1px solid var(--wa-border);
    color: var(--wa-accent);
}

.wa-chat__logo svg,
.wa-chat__bubble-logo svg,
.wa-chat__fab-icon svg {
    width: 22px;
    height: 22px;
    display: block;
}

.wa-chat__bubble-logo {
    width: 28px;
    height: 28px;
    margin-top: 0.15rem;
}

.wa-chat__bubble-logo svg {
    width: 16px;
    height: 16px;
}

.wa-chat__meta {
    min-width: 0;
    flex: 1;
}

.wa-chat__name {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--wa-text);
    line-height: 1.2;
}

.wa-chat__status {
    margin: 0.12rem 0 0;
    font-size: 0.72rem;
    color: var(--wa-muted);
}

.wa-chat__close,
.wa-chat__topic,
.wa-chat__send,
.wa-chat__fab {
    -webkit-appearance: none;
    appearance: none;
}

.wa-chat__close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    opacity: 0.9;
}

.wa-chat__close svg {
    width: 16px;
    height: 16px;
}

.wa-chat__close:hover {
    background: rgba(255, 255, 255, 0.12);
}

.wa-chat__close:focus-visible {
    outline: 2px solid var(--wa-accent);
    outline-offset: 2px;
}

.wa-chat__thread {
    min-height: 240px;
    max-height: 340px;
    padding: 1rem 0.85rem;
    overflow-y: auto;
    background: var(--wa-thread);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.wa-chat__row {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
}

.wa-chat__row--user {
    justify-content: flex-end;
}

.wa-chat__bubble {
    margin: 0;
    max-width: 78%;
    padding: 0.65rem 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--wa-border);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.875rem;
    line-height: 1.45;
}

.wa-chat__bubble--user {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.14);
    color: #fff;
    border-radius: 12px 12px 4px 12px;
}

.wa-chat__prompt {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    max-width: 86%;
}

.wa-chat__prompt .wa-chat__bubble {
    max-width: 100%;
}

.wa-chat__topics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.wa-chat__topic {
    appearance: none;
    border: 1px solid var(--wa-border);
    background: #111;
    color: rgba(255, 255, 255, 0.78);
    border-radius: 999px;
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    text-align: left;
}

.wa-chat__topic:hover:not(:disabled) {
    background: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.wa-chat__topic.is-selected {
    background: #fff;
    color: #000;
    border-color: #fff;
}

.wa-chat__topic:disabled:not(.is-selected) {
    opacity: 0.4;
    cursor: default;
}

.wa-chat__topic:focus-visible {
    outline: 2px solid var(--wa-accent);
    outline-offset: 2px;
}

.wa-chat__composer {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.7rem 0.75rem;
    background: var(--wa-composer);
    border-top: 1px solid var(--wa-border);
}

.wa-chat__input {
    flex: 1;
    min-height: 42px;
    padding: 0.55rem 1rem;
    border: 1px solid var(--wa-border);
    border-radius: 999px;
    background: #111;
    color: #fff;
    font-size: 0.875rem;
    outline: none;
}

.wa-chat__input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.wa-chat__input:focus {
    border-color: rgba(255, 255, 255, 0.22);
}

.wa-chat__input:disabled {
    opacity: 0.7;
}

.wa-chat__send {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: #1a1a1a;
    color: rgba(255, 255, 255, 0.35);
    cursor: not-allowed;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.wa-chat__send svg {
    width: 18px;
    height: 18px;
    margin-left: 2px;
}

.wa-chat__send.is-ready {
    background: #fff;
    color: #000;
    cursor: pointer;
}

.wa-chat__send.is-ready:hover {
    background: #eaeaea;
}

.wa-chat__send:focus-visible {
    outline: 2px solid var(--wa-accent);
    outline-offset: 2px;
}

.wa-chat,
.wa-chat * {
    max-width: none !important;
}

.wa-chat__fab {
    -webkit-appearance: none;
    appearance: none;
    width: 56px;
    height: 56px;
    margin-left: auto;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #00ff88;
    box-shadow: none;
    cursor: pointer;
    overflow: visible;
    line-height: 0;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.wa-chat__fab:hover {
    transform: translateY(-2px);
    filter: brightness(1.12);
    background: transparent;
}

.wa-chat__fab:focus-visible {
    outline: 2px solid #00ff88;
    outline-offset: 3px;
}

.wa-chat__fab-icon {
    width: 36px;
    height: 36px;
    color: #00ff88;
    background: transparent;
}

.wa-chat__fab-icon svg {
    width: 36px;
    height: 36px;
    display: block;
}

.wa-chat__fab-close {
    display: none;
    width: 18px;
    height: 18px;
    color: #00ff88;
}

.wa-chat.is-open .wa-chat__fab-icon {
    display: none;
}

.wa-chat.is-open .wa-chat__fab-close {
    display: block;
}

.wa-chat .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 768px) {
    .wa-chat {
        inset: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: auto;
        height: auto;
        z-index: 1200;
        pointer-events: none;
    }

    .wa-chat__fab,
    .wa-chat.is-open .wa-chat__panel {
        pointer-events: auto;
    }

    .wa-chat__fab {
        position: absolute;
        right: max(0.75rem, env(safe-area-inset-right));
        bottom: max(0.75rem, env(safe-area-inset-bottom));
        width: 56px;
        height: 56px;
        margin: 0;
        background: transparent;
        color: #00ff88;
        -webkit-appearance: none;
        appearance: none;
    }

    .wa-chat__panel {
        position: fixed;
        left: max(0.6rem, env(safe-area-inset-left));
        right: max(0.6rem, env(safe-area-inset-right));
        bottom: calc(4.4rem + env(safe-area-inset-bottom, 0px));
        width: auto;
        max-width: none;
        max-height: min(70dvh, calc(100dvh - 6.5rem - env(safe-area-inset-bottom, 0px)));
        transform: none;
    }

    .wa-chat__thread {
        min-height: 0;
        max-height: none;
        flex: 1 1 auto;
        padding-bottom: 1.1rem;
        -webkit-overflow-scrolling: touch;
    }

    .wa-chat__bubble,
    .wa-chat__prompt {
        max-width: calc(100% - 2rem);
    }

    .wa-chat__input {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wa-chat,
    .wa-chat__panel,
    .wa-chat__fab {
        transition: none !important;
    }

    .wa-chat__panel {
        transform: none;
    }
}

@media print {
    .wa-chat {
        display: none !important;
    }
}
