/**
 * MOD:- AI SUPPORT CHAT
 *
 * standalone widget stylesheet - deliberately outside the theme sass build.
 * uses the theme's css custom properties with hard fallbacks so it also
 * renders sanely if the variables ever change.
 */

#aisc-root {
    --aisc-blue: var(--blue, #3b7de8);
    --aisc-ink: var(--ink, #1e2d4d);
    --aisc-mid: var(--mid, #5a6a82);
    --aisc-pale: var(--pale, #e8f0fc);
    font-family: var(--sans, 'Inter', system-ui, sans-serif);
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9990;
}

/* ---- launcher ---- */

.aisc-launcher {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-left: auto;
    border: 0;
    border-radius: 50%;
    background: var(--aisc-blue);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(30, 45, 77, 0.28);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.aisc-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(30, 45, 77, 0.34);
}

.aisc-launcher .aisc-ico-close {
    display: none;
}

#aisc-root.aisc-open .aisc-launcher .aisc-ico-open {
    display: none;
}

#aisc-root.aisc-open .aisc-launcher .aisc-ico-close {
    display: block;
}

/* ---- panel ---- */

.aisc-panel {
    position: absolute;
    right: 0;
    bottom: 72px;
    display: flex;
    flex-direction: column;
    width: 360px;
    height: min(540px, calc(100vh - 120px));
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 48px rgba(30, 45, 77, 0.25);
    border: 1px solid rgba(30, 45, 77, 0.08);
}

@media (max-width: 480px) {
    #aisc-root {
        right: 12px;
        bottom: 12px;
    }

    .aisc-panel {
        position: fixed;
        right: 8px;
        left: 8px;
        bottom: 80px;
        width: auto;
        height: min(560px, calc(100vh - 100px));
    }
}

.aisc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--aisc-ink);
    color: #fff;
}

.aisc-head-txt {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.aisc-head-txt strong {
    font-size: 0.95rem;
    font-weight: 600;
}

.aisc-status {
    font-size: 0.75rem;
    opacity: 0.75;
}

.aisc-min {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    opacity: 0.8;
}

.aisc-min:hover {
    background: rgba(255, 255, 255, 0.12);
    opacity: 1;
}

/* ---- transcript ---- */

.aisc-body {
    /* relative: makes bubble offsetTop container-relative, which the js
       uses to scroll long replies to their top edge */
    position: relative;
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f7f9fd;
}

.aisc-msg,
.aisc-note {
    animation: aisc-in 0.25s ease;
}

@keyframes aisc-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.aisc-msg {
    max-width: 85%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 0.875rem;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

.aisc-msg a {
    color: inherit;
    text-decoration: underline;
}

.aisc-msg-visitor {
    align-self: flex-end;
    background: var(--aisc-blue);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.aisc-msg-assistant,
.aisc-msg-agent {
    align-self: flex-start;
    background: #fff;
    color: var(--aisc-ink);
    border: 1px solid rgba(30, 45, 77, 0.09);
    border-bottom-left-radius: 4px;
}

.aisc-msg-assistant a,
.aisc-msg-agent a {
    color: var(--aisc-blue);
}

.aisc-msg-agent {
    background: var(--aisc-pale);
}

.aisc-note {
    align-self: center;
    font-size: 0.75rem;
    color: var(--aisc-mid);
    text-align: center;
    padding: 2px 8px;
}

.aisc-note a {
    color: var(--aisc-blue);
    text-decoration: underline;
}

/* ---- typing indicator ---- */

.aisc-typing {
    display: flex;
    gap: 4px;
    padding: 0 18px 10px;
    background: #f7f9fd;
}

.aisc-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--aisc-mid);
    opacity: 0.4;
    animation: aisc-bounce 1.2s infinite;
}

.aisc-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.aisc-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes aisc-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* ---- composer ---- */

/* honeypot decoy: offscreen rather than display:none, so form-filling bots
   that skip hidden fields still see it */
.aisc-hp {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.aisc-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid rgba(30, 45, 77, 0.08);
    background: #fff;
}

.aisc-form textarea {
    flex: 1;
    max-height: 110px;
    padding: 9px 12px;
    border: 1px solid rgba(30, 45, 77, 0.15);
    border-radius: 10px;
    font: inherit;
    font-size: 0.875rem;
    line-height: 1.4;
    resize: none;
    outline: none;
}

.aisc-form textarea:focus {
    border-color: var(--aisc-blue);
}

.aisc-send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border: 0;
    border-radius: 10px;
    background: var(--aisc-blue);
    color: #fff;
    cursor: pointer;
}

.aisc-send:disabled {
    opacity: 0.5;
    cursor: default;
}

#aisc-root.aisc-closed .aisc-form textarea,
#aisc-root.aisc-closed .aisc-send {
    pointer-events: none;
    opacity: 0.5;
}
