/* AI Support Team Pro — Chat Widget */
:root {
    --astp-primary: #c99b53;
    --astp-header-text: #ffffff;
    --astp-radius-lg: 20px;
    --astp-radius-md: 14px;
    --astp-radius-sm: 8px;
    --astp-shadow: 0 8px 48px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.08);
    --astp-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#astp-widget-root { position: fixed; z-index: 2147483647; font-family: var(--astp-font); }
#astp-widget-root.bottom-right { bottom: 24px; right: 24px; }
#astp-widget-root.bottom-left  { bottom: 24px; left: 24px; }

/* ── Bubble ──────────────────────────────────────────────────── */
#astp-bubble {
    width: 60px; height: 60px; border-radius: 50%;
    background: var(--astp-primary);
    border: none; cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,.25);
    display: flex; align-items: center; justify-content: center;
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
    position: relative; outline: none;
}
#astp-bubble:hover { transform: scale(1.1); box-shadow: 0 6px 28px rgba(0,0,0,.3); }
#astp-bubble:active { transform: scale(.96); }
#astp-bubble.is-open { transform: scale(1.05); }
.astp-bubble-icon { width: 26px; height: 26px; color: #fff; stroke: #fff; fill: none; }

.astp-badge-dot {
    position: absolute; top: 2px; right: 2px;
    width: 14px; height: 14px; border-radius: 50%;
    background: #ef4444; border: 2px solid #fff;
    display: none;
}
.astp-badge-dot.show { display: block; }

/* ── Panel ───────────────────────────────────────────────────── */
#astp-panel {
    position: absolute;
    width: 380px; max-height: 600px;
    background: #fff; border-radius: var(--astp-radius-lg);
    box-shadow: var(--astp-shadow);
    display: flex; flex-direction: column;
    overflow: hidden;
    opacity: 0; pointer-events: none;
    transform: translateY(16px) scale(.96);
    transition: opacity .25s ease, transform .25s cubic-bezier(.34,1.56,.64,1);
    bottom: 76px;
}
#astp-widget-root.bottom-right #astp-panel { right: 0; }
#astp-widget-root.bottom-left  #astp-panel { left: 0; }
#astp-panel.open { opacity: 1; pointer-events: all; transform: none; }

/* ── Header ──────────────────────────────────────────────────── */
#astp-panel-header {
    background: var(--astp-primary);
    padding: 18px 18px 18px 20px;
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
.astp-header-inner { display: flex; align-items: center; gap: 12px; }
.astp-header-avatar {
    width: 42px; height: 42px; border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.astp-header-avatar svg { width: 22px; height: 22px; stroke: var(--astp-header-text); fill: none; }
.astp-header-title { font-size: 15px; font-weight: 700; color: var(--astp-header-text); line-height: 1.2; }
.astp-header-status { font-size: 12px; color: var(--astp-header-text); opacity: .82; margin-top: 2px; display: flex; align-items: center; gap: 5px; }
.astp-status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 2px rgba(74,222,128,.3); }
#astp-close-btn {
    background: rgba(255,255,255,.15); border: none; border-radius: 50%;
    width: 32px; height: 32px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s; flex-shrink: 0;
}
#astp-close-btn:hover { background: rgba(255,255,255,.25); }
#astp-close-btn svg { width: 16px; height: 16px; stroke: var(--astp-header-text); }

/* ── Messages ────────────────────────────────────────────────── */
#astp-messages {
    flex: 1; overflow-y: auto; padding: 20px 16px 12px;
    display: flex; flex-direction: column; gap: 14px;
    scroll-behavior: smooth;
}
#astp-messages::-webkit-scrollbar { width: 4px; }
#astp-messages::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }

.astp-msg { display: flex; align-items: flex-end; gap: 8px; }
.astp-msg.user  { flex-direction: row-reverse; }
.astp-msg.bot   { flex-direction: row; }

.astp-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; flex-shrink: 0;
}
.astp-avatar svg { width: 16px; height: 16px; }
.bot-avatar  { background: #f3f4f6; color: #374151; }
.bot-avatar svg { stroke: #6b7280; }
.user-avatar { background: var(--astp-primary); color: #fff; font-size: 9px; }

.astp-msg-inner { display: flex; flex-direction: column; max-width: 78%; }
.astp-agent-label { font-size: 10px; font-weight: 600; color: #9ca3af; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; padding-left: 2px; }

.astp-bubble {
    padding: 11px 14px; border-radius: 18px;
    font-size: 14px; line-height: 1.6; word-break: break-word;
}
.bot-bubble  { background: #f3f4f6; color: #111827; border-bottom-left-radius: 4px; }
.astp-msg.user .astp-bubble { background: var(--astp-primary); color: #fff; border-bottom-right-radius: 4px; border-radius: 18px; }

/* ── Typing ──────────────────────────────────────────────────── */
.astp-typing-bubble { padding: 14px 18px; }
.astp-typing-bubble span {
    display: inline-block; width: 7px; height: 7px; margin: 0 2px;
    border-radius: 50%; background: #9ca3af;
    animation: astp-bounce 1.1s infinite ease-in-out;
}
.astp-typing-bubble span:nth-child(2) { animation-delay: .18s; }
.astp-typing-bubble span:nth-child(3) { animation-delay: .36s; }
@keyframes astp-bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-7px)} }

/* ── CSAT ────────────────────────────────────────────────────── */
#astp-csat { padding: 14px 18px; background: #f9fafb; border-top: 1px solid #f0f0f0; text-align: center; }
#astp-csat p { font-size: 13px; font-weight: 500; color: #374151; margin: 0 0 10px; }
.astp-csat-thanks { color: #16a34a !important; font-weight: 600 !important; }
.astp-star-row { display: flex; justify-content: center; gap: 4px; }
.astp-star-row button {
    background: none; border: none; cursor: pointer; padding: 4px;
    color: #d1d5db; transition: color .15s, transform .1s;
}
.astp-star-row button svg { width: 24px; height: 24px; fill: currentColor; stroke: none; }
.astp-star-row button:hover,
.astp-star-row button.active { color: #f59e0b; transform: scale(1.15); }

/* ── Input ───────────────────────────────────────────────────── */
#astp-char-count { text-align: right; font-size: 11px; padding: 0 16px 2px; display: none; }
#astp-input-area {
    padding: 12px 14px; border-top: 1px solid #f0f0f0;
    display: flex; gap: 8px; align-items: flex-end; flex-shrink: 0;
    background: #fff;
}
#astp-input {
    flex: 1; border: 1.5px solid #e5e7eb; border-radius: 12px;
    padding: 10px 14px; font-size: 14px; resize: none;
    max-height: 120px; overflow-y: auto; line-height: 1.5;
    font-family: var(--astp-font); background: #f9fafb;
    transition: border-color .15s, background .15s;
}
#astp-input:focus { outline: none; border-color: var(--astp-primary); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
#astp-input::placeholder { color: #9ca3af; }

#astp-send {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--astp-primary); border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
    transition: opacity .15s, transform .15s;
}
#astp-send:hover:not(:disabled) { opacity: .88; transform: scale(1.06); }
#astp-send:disabled { opacity: .5; cursor: default; }
#astp-send svg { width: 17px; height: 17px; stroke: #fff; fill: none; }
#astp-send.loading svg { animation: astp-spin .7s linear infinite; }
@keyframes astp-spin { to { transform: rotate(360deg); } }

/* ── Footer ──────────────────────────────────────────────────── */
#astp-widget-footer {
    text-align: center; font-size: 10px; color: #c4c4c4;
    padding: 6px 0 10px; flex-shrink: 0; background: #fff;
}
#astp-widget-footer strong { color: #aaa; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 440px) {
    #astp-panel { width: calc(100vw - 24px); }
    #astp-widget-root.bottom-right { right: 12px; bottom: 12px; }
    #astp-widget-root.bottom-left  { left: 12px; bottom: 12px; }
}
