/* "Ask Pradeep" floating chat widget.
   Self-contained. All selectors prefixed with .pa-ask to avoid host-site
   collisions. Drop-in: include ask.css + ask.js anywhere and it mounts
   itself bottom-right. */

.pa-ask-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #FFC300;
    color: #003566;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 8, 20, 0.18);
    transition: transform 200ms ease, background 200ms ease, box-shadow 200ms ease;
    z-index: 9998;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.pa-ask-fab:hover {
    transform: translateY(-2px);
    background: #FFD60A;
    box-shadow: 0 14px 36px rgba(0, 8, 20, 0.24);
}

/* One-shot attention wiggle, fired when the on-load greeting appears. */
@keyframes pa-ask-fab-wiggle {
    0%   { transform: rotate(0)      scale(1); }
    15%  { transform: rotate(-14deg) scale(1.08); }
    30%  { transform: rotate(12deg)  scale(1.08); }
    45%  { transform: rotate(-8deg)  scale(1.05); }
    60%  { transform: rotate(6deg)   scale(1.03); }
    75%  { transform: rotate(-3deg)  scale(1.01); }
    100% { transform: rotate(0)      scale(1); }
}
.pa-ask-fab.pa-wiggle { animation: pa-ask-fab-wiggle 1s ease-in-out 1; }

/* Soft continuous halo while greeting is visible — draws the eye. */
@keyframes pa-ask-fab-pulse {
    0%   { box-shadow: 0 10px 28px rgba(0, 8, 20, 0.20), 0 0 0 0  rgba(255, 195, 0, 0.55); }
    70%  { box-shadow: 0 10px 28px rgba(0, 8, 20, 0.20), 0 0 0 16px rgba(255, 195, 0, 0); }
    100% { box-shadow: 0 10px 28px rgba(0, 8, 20, 0.20), 0 0 0 0  rgba(255, 195, 0, 0); }
}
.pa-ask-fab.pa-pulse { animation: pa-ask-fab-pulse 2.2s ease-out infinite; }

.pa-ask-fab svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pa-ask-panel {
    position: fixed;
    right: 24px;
    bottom: 92px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 540px;
    max-height: calc(100vh - 120px);
    background: #FFFFFF;
    border: 1px solid #E5E5E0;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 8, 20, 0.18);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.pa-ask-panel.pa-open { display: flex; }

.pa-ask-header {
    background: #FFFFFF;
    padding: 18px 20px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #E5E5E0;
}

.pa-ask-title {
    font-weight: 900;
    font-size: 16px;
    color: #000814;
    letter-spacing: -0.01em;
}

.pa-ask-subtitle {
    font-weight: 400;
    font-size: 12.5px;
    color: #888888;
    margin-top: 3px;
    letter-spacing: 0;
}

.pa-ask-close {
    background: none;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555555;
    transition: background 150ms ease;
}

.pa-ask-close:hover { background: #E5E5E0; }

.pa-ask-close svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pa-ask-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    background: #FFFFFF;
}

/* Editorial style: no bubbles. Each message is a block of text with a
   coloured 3px accent rule on the left + a tiny ROLE label above it.
   Bot uses yellow rule; user uses navy rule. */
.pa-ask-msg {
    align-self: stretch;
    padding-left: 14px;
    font-size: 13px;
    line-height: 1.6;
    word-wrap: break-word;
}

.pa-ask-msg-bot {
    border-left: 3px solid #FFC300;
    color: #000814;
}

.pa-ask-msg-user {
    border-left: 3px solid #003566;
    color: #555555;
}

.pa-ask-role-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #999999;
    margin-bottom: 4px;
}

.pa-ask-msg-bot  .pa-ask-role-label { color: #B8860B; }
.pa-ask-msg-user .pa-ask-role-label { color: #003566; }

.pa-ask-msg strong {
    font-weight: 700;
    color: #000814;
}

.pa-ask-msg-bot a {
    color: #003566;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: #FFC300;
    text-decoration-thickness: 2px;
    transition: color 150ms ease, text-decoration-color 150ms ease;
}

.pa-ask-msg-bot a:hover {
    color: #002a52;
    text-decoration-color: #FFD60A;
}

.pa-ask-msg em {
    font-style: italic;
}

.pa-ask-msg code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12.5px;
    background: rgba(0, 53, 102, 0.06);
    padding: 1px 5px;
    border-radius: 4px;
}

.pa-ask-msg br + br {
    line-height: 0.5em;
}

.pa-ask-msg-system {
    align-self: stretch;
    color: #999999;
    font-size: 12px;
    font-style: italic;
    text-align: center;
    padding: 6px 0;
}

.pa-ask-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    padding-left: 14px;
    align-self: stretch;
}

.pa-ask-chip {
    background: transparent;
    border: 1px solid #003566;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    font-family: inherit;
    color: #003566;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
}

.pa-ask-chip:hover {
    background: #003566;
    color: #FFC300;
}

/* Typing indicator — matches a bot message (yellow rule + role label),
   with 3 bouncing dots in place of body text. */
.pa-ask-typing {
    align-self: stretch;
    padding-left: 14px;
    border-left: 3px solid #FFC300;
    display: flex;
    flex-direction: column;
}

.pa-ask-typing .pa-ask-role-label { color: #B8860B; }

.pa-ask-typing-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    height: 14px;
}

.pa-ask-typing-dots span {
    width: 6px;
    height: 6px;
    background: #999999;
    border-radius: 50%;
    animation: pa-ask-bounce 1.2s infinite ease-in-out;
}

.pa-ask-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.pa-ask-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

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

.pa-ask-input-row {
    border-top: 1px solid #E5E5E0;
    padding: 12px;
    display: flex;
    gap: 8px;
    background: #FFFFFF;
}

.pa-ask-input {
    flex: 1;
    min-width: 0;
    border: 1px solid #E5E5E0;
    border-radius: 10px;
    padding: 10px 12px;
    /* MUST be >= 16px or iOS Safari auto-zooms on focus and never quite
       restores the zoom on blur — pushing the send button off-screen. */
    font-size: 16px;
    font-family: inherit;
    color: #000814;
    background: #FFFFFF;
    outline: none;
    transition: border-color 150ms ease;
    -webkit-appearance: none;
    appearance: none;
}

.pa-ask-input:focus { border-color: #003566; }

.pa-ask-send {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #003566;
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 150ms ease;
}

.pa-ask-send:hover:not(:disabled) { background: #002a52; }
.pa-ask-send:disabled              { opacity: 0.4; cursor: not-allowed; }

.pa-ask-send svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pa-ask-footer {
    text-align: center;
    font-size: 10px;
    color: #999999;
    padding: 6px 12px 10px;
    background: #FFFFFF;
}

/* ── On-load greeting bubble ── */
.pa-ask-greeting {
    position: fixed;
    right: 96px;
    bottom: 32px;
    max-width: 280px;
    background: #FFFFFF;
    border: 1px solid #E5E5E0;
    border-radius: 14px;
    padding: 14px 36px 14px 16px;
    box-shadow: 0 14px 36px rgba(0, 8, 20, 0.16);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    color: #000814;
    z-index: 9997;
    opacity: 0;
    transform: translateY(20px) scale(0.82);
    transition: opacity 380ms ease-out, transform 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    cursor: pointer;
}

.pa-ask-greeting.pa-show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Little arrow tail pointing at the FAB */
.pa-ask-greeting::after {
    content: '';
    position: absolute;
    right: -7px;
    bottom: 18px;
    width: 14px;
    height: 14px;
    background: #FFFFFF;
    border-right: 1px solid #E5E5E0;
    border-top: 1px solid #E5E5E0;
    transform: rotate(45deg);
}

.pa-ask-greeting-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border: none;
    background: none;
    cursor: pointer;
    color: #999999;
    font-size: 18px;
    line-height: 1;
    padding: 0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms ease, color 150ms ease;
}

.pa-ask-greeting-close:hover {
    background: #F5F5F2;
    color: #000814;
}

@media (max-width: 480px) {
    /* Full-screen panel on phones — pins to all four edges so iOS Safari's
       dynamic chrome (address bar collapse / expand) doesn't ever leave a
       sliver of the page underneath visible. */
    .pa-ask-panel {
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: auto;
        height: auto;
        max-width: none;
        max-height: none;
        border-radius: 0;
        border: none;
    }
    .pa-ask-fab {
        right: 16px;
        bottom: 16px;
    }
    /* When the chat is open on a phone, hide the FAB (the X in the header
       is the close button) and lock body scroll so swipes inside the panel
       don't bubble out to the page. */
    body.pa-ask-open {
        overflow: hidden;
    }
    body.pa-ask-open .pa-ask-fab {
        display: none;
    }
    .pa-ask-greeting {
        right: 16px;
        bottom: 80px;
        max-width: calc(100vw - 32px);
    }
    .pa-ask-greeting::after {
        right: 24px;
        bottom: -7px;
        transform: rotate(135deg);
    }
}
