/* strongest stacking order + drag-to-move */
#aya-va-floating{ position: fixed; right: 16px; bottom: 16px; background: #FFD900; color: #000; border-radius: 999px; padding: 12px 16px; font-weight: 600; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,0.2); z-index: 2147483645; pointer-events:auto; }
.va-chat{ position: fixed; right: 16px; bottom: 72px; width: 360px; max-height: 70vh; background: #fff; border: 1px solid #ddd; border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 12px 28px rgba(0,0,0,0.25); z-index: 2147483646; pointer-events:auto; }
.va-chat-header{ padding: 10px 12px; background: #f7f7f7; display:flex; justify-content:space-between; align-items:center; border-bottom: 1px solid #eee; }
.va-close{ background: transparent; border: none; font-size: 18px; cursor: pointer; line-height: 1; padding: 4px 8px; border-radius: 6px; }
.va-chat-body{ padding: 10px; overflow: auto; flex: 1; max-height: calc(70vh - 100px); }
.va-msg{ padding: 8px 10px; margin-bottom: 8px; border-radius: 8px; white-space: pre-wrap; }
.va-msg.user{ background: #eef5ff; }
.va-msg.assistant{ background: #f3f3f3; }
.va-chat-input{ display:flex; gap:8px; padding:10px; border-top:1px solid #eee; }
.va-chat-input input{ flex:1; padding:10px; border:1px solid #ddd; border-radius:8px; }
.va-chat-input button{ padding:10px 12px; border:none; border-radius:8px; background:#111; color:#fff; cursor:pointer; }
@media (max-width: 480px){ .va-chat{ right: 4vw; width: 92vw; } }
/* --- AYA Assistant visibility + layout fix --- */
.va-chat {
    width: 380px;
    /* a touch wider */
    max-height: 80vh;
    /* more headroom */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Keep header visible; make room for a clear close button */
.va-chat-header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-right: 40px;
    /* space for the close button */
}

/* Make the X clearly visible and easy to tap/click */
.va-close {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

/* Critical for flex scrolling: allow the body to shrink and scroll */
.va-chat-body {
    flex: 1 1 auto;
    min-height: 0;
    /* prevents being pushed/cut off */
    overflow: auto;
    padding: 12px;
}

/* Keep input visible; avoid clipping on mobile with safe-area */
.va-chat-input {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: #fff;
    border-top: 1px solid #eee;
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

/* Slightly bigger input on desktop for comfort */
.va-chat-input input {
    height: 40px;
}

/* Mobile: let it breathe */
@media (max-width: 480px) {
    .va-chat {
        width: 92vw;
        right: 4vw;
    }
}