/* AI Support Team Pro — Chat Widget */
#astp-widget-root { position: fixed; z-index: 99999; }
#astp-widget-root.bottom-right { bottom: 24px; right: 24px; }
#astp-widget-root.bottom-left  { bottom: 24px; left:  24px; }

/* Bubble */
#astp-bubble {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--astp-primary, #2563eb);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.2);
    transition: transform .2s; border: none; outline: none;
}
#astp-bubble:hover { transform: scale(1.07); }
#astp-bubble svg { width: 26px; height: 26px; fill: #fff; }
#astp-bubble .astp-badge-dot {
    position: absolute; top: 0; right: 0;
    width: 14px; height: 14px; border-radius: 50%;
    background: #ef4444; border: 2px solid #fff;
    display: none;
}
#astp-bubble .astp-badge-dot.show { display: block; }

/* Panel */
#astp-panel {
    position: absolute; bottom: 70px;
    width: 360px; max-height: 560px;
    background: #fff; border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.15);
    display: flex; flex-direction: column;
    overflow: hidden; opacity: 0; pointer-events: none;
    transform: translateY(12px) scale(.97);
    transition: opacity .2s, transform .2s;
}
#astp-panel.open { opacity: 1; pointer-events: all; transform: none; }
#astp-widget-root.bottom-right #astp-panel { right: 0; }
#astp-widget-root.bottom-left  #astp-panel { left: 0; }

/* Header */
#astp-panel-header {
    padding: 16px 18px;
    background: var(--astp-primary, #2563eb);
    color: #fff; display: flex; align-items: center; justify-content: space-between;
}
#astp-panel-header .title { font-size: 15px; font-weight: 600; }
#astp-panel-header .subtitle { font-size: 12px; opacity: .8; margin-top: 2px; }
#astp-close-btn { background: none; border: none; color: #fff; cursor: pointer; font-size: 20px; opacity: .8; padding: 0; }
#astp-close-btn:hover { opacity: 1; }

/* Messages */
#astp-messages {
    flex: 1; overflow-y: auto; padding: 16px;
    display: flex; flex-direction: column; gap: 12px;
}
.astp-msg { display: flex; gap: 8px; align-items: flex-end; }
.astp-msg.user   { flex-direction: row-reverse; }
.astp-msg .avatar { width: 26px; height: 26px; border-radius: 50%; background: #e5e7eb; font-size: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.astp-msg.user   .avatar { background: var(--astp-primary, #2563eb); color: #fff; }
.astp-msg .bubble { max-width: 78%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.55; }
.astp-msg.bot  .bubble { background: #f3f4f6; color: #111827; border-bottom-left-radius: 3px; }
.astp-msg.user .bubble { background: var(--astp-primary, #2563eb); color: #fff; border-bottom-right-radius: 3px; }
.astp-msg .agent-label { font-size: 10px; color: #9ca3af; margin-bottom: 3px; }

/* Typing indicator */
.astp-typing .bubble { padding: 12px 16px; }
.astp-typing .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #9ca3af; animation: astp-bounce .9s infinite; }
.astp-typing .dot:nth-child(2) { animation-delay: .15s; }
.astp-typing .dot:nth-child(3) { animation-delay: .3s; }
@keyframes astp-bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }

/* CSAT */
#astp-csat { padding: 12px 16px; background: #f9fafb; border-top: 1px solid #e5e7eb; text-align: center; }
#astp-csat p { font-size: 13px; color: #374151; margin: 0 0 8px; }
.astp-star-row button { background: none; border: none; font-size: 22px; cursor: pointer; padding: 2px 4px; opacity: .4; transition: opacity .15s; }
.astp-star-row button:hover,
.astp-star-row button.active { opacity: 1; }

/* Input */
#astp-input-area {
    padding: 12px 14px;
    border-top: 1px solid #e5e7eb;
    display: flex; gap: 8px; align-items: flex-end;
}
#astp-input {
    flex: 1; border: 1px solid #d1d5db; border-radius: 10px;
    padding: 9px 12px; font-size: 14px; resize: none;
    max-height: 100px; overflow-y: auto;
    font-family: inherit; line-height: 1.4;
    transition: border-color .15s;
}
#astp-input:focus { outline: none; border-color: var(--astp-primary, #2563eb); }
#astp-send {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--astp-primary, #2563eb); border: none;
    color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: opacity .15s;
}
#astp-send:hover { opacity: .85; }
#astp-send svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2; }

/* Escalation banner */
.astp-escalation-banner {
    background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px;
    padding: 10px 13px; font-size: 13px; color: #991b1b; margin: 0 4px;
}

@media (max-width: 400px) {
    #astp-panel { width: calc(100vw - 32px); }
}
