/* WAEII Widget – Frontend */

.waeii-launcher {
    position: fixed;
    bottom: 24px;
    z-index: 999998;
    background: var(--waeii-primary, #25D366);
    color: #fff;
    border: 0;
    border-radius: 28px;
    padding: 12px 18px 12px 16px;
    box-shadow: 0 6px 20px rgba(0,0,0,.18);
    font: 600 14px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform .12s ease-out, box-shadow .12s ease-out;
}
.waeii-launcher:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0,0,0,.22); }
.waeii-launcher svg { width: 22px; height: 22px; flex: 0 0 22px; }
.waeii-pos-right .waeii-launcher { right: 24px; }
.waeii-pos-left  .waeii-launcher { left: 24px; }

.waeii-panel {
    position: fixed;
    bottom: 90px;
    width: 360px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    color: #1d2327;
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0,0,0,.22);
    overflow: hidden;
    z-index: 999999;
    display: none;
    flex-direction: column;
    font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.waeii-pos-right .waeii-panel { right: 24px; }
.waeii-pos-left  .waeii-panel { left: 24px; }
.waeii-open .waeii-panel { display: flex; }

.waeii-head {
    background: var(--waeii-primary, #25D366);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.waeii-avatar {
    width: 36px; height: 36px; border-radius: 18px; flex: 0 0 36px;
    background: rgba(255,255,255,.2);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    background-size: cover; background-position: center;
}
.waeii-head-text { flex: 1; min-width: 0; }
.waeii-head-name { font-weight: 700; font-size: 14px; }
.waeii-head-sub  { font-size: 12px; opacity: .9; }
.waeii-close {
    background: none; border: 0; color: #fff; cursor: pointer;
    font-size: 22px; line-height: 1; padding: 4px;
}

.waeii-body {
    flex: 1; min-height: 0;
    background: #efeae3;
    padding: 12px;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 6px;
}
.waeii-greeting {
    background: #fff;
    padding: 10px 12px;
    border-radius: 10px;
    align-self: flex-start;
    max-width: 80%;
    box-shadow: 0 1px 1px rgba(0,0,0,.06);
}
.waeii-bubble {
    max-width: 80%;
    padding: 8px 10px;
    border-radius: 10px;
    box-shadow: 0 1px 1px rgba(0,0,0,.06);
    white-space: pre-wrap;
    word-wrap: break-word;
}
.waeii-bubble-in  { background: #fff; align-self: flex-start; border-top-left-radius: 2px; }
.waeii-bubble-out { background: #dcf8c6; align-self: flex-end;  border-top-right-radius: 2px; }
.waeii-bubble-meta { font-size: 11px; opacity: .55; margin-top: 4px; }

.waeii-foot {
    border-top: 1px solid #e3e3e3;
    background: #fff;
    padding: 8px;
    display: flex; gap: 6px; align-items: flex-end;
}
.waeii-input {
    flex: 1; min-height: 36px; max-height: 120px;
    resize: none;
    padding: 8px 10px;
    border: 1px solid #d0d0d0;
    border-radius: 18px;
    font: inherit;
}
.waeii-send {
    background: var(--waeii-primary, #25D366);
    color: #fff;
    border: 0;
    width: 36px; height: 36px;
    border-radius: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.waeii-send:disabled { opacity: .5; cursor: not-allowed; }
.waeii-send svg { width: 18px; height: 18px; }

.waeii-cta {
    margin: 8px 0;
    padding: 12px;
    background: #fff;
    border-radius: 10px;
    align-self: stretch;
}
.waeii-cta p { margin: 0 0 8px; font-size: 13px; }
.waeii-btn {
    display: inline-block;
    background: var(--waeii-primary, #25D366);
    color: #fff;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 600;
    border: 0;
    cursor: pointer;
    font: 600 14px -apple-system, BlinkMacSystemFont, sans-serif;
}
.waeii-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.waeii-consent {
    background: #fff;
    padding: 12px;
    border-radius: 10px;
    align-self: stretch;
    font-size: 12px;
}
.waeii-consent label { display: flex; gap: 6px; align-items: flex-start; margin-top: 8px; }

.waeii-offline {
    background: #fff8e1;
    border-left: 3px solid #ffb300;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 13px;
    align-self: stretch;
}

.waeii-status {
    text-align: center;
    color: #777;
    font-size: 12px;
    padding: 4px;
}

@media (max-width: 480px) {
    .waeii-panel {
        width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh;
        bottom: 0; right: 0 !important; left: 0 !important;
        border-radius: 0;
    }
    .waeii-launcher { bottom: 16px; }
    .waeii-pos-right .waeii-launcher { right: 16px; }
    .waeii-pos-left  .waeii-launcher { left: 16px; }
}
