/* Angad Software — keyword FAQ chatbot */
#as-chatbot-root {
    position: fixed;
    right: 20px;
    bottom: 78px;
    z-index: 9997;
    font-family: var(--mirror-font, 'Inter', 'Segoe UI', sans-serif);
}

.as-chatbot-launcher {
    position: relative;
    width: 54px;
    height: 54px;
}

.as-chatbot-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(32, 201, 151, 0.55);
    pointer-events: none;
    animation: asChatPulseRing 2.4s ease-out infinite;
}

.as-chatbot-pulse--delay {
    animation-delay: 1.2s;
}

.as-chatbot-teaser {
    position: absolute;
    right: 62px;
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    white-space: nowrap;
    padding: 8px 12px;
    border-radius: 10px;
    background: #0c1220;
    border: 1px solid rgba(32, 201, 151, 0.35);
    color: #e8eef7;
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.3;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s ease;
}

.as-chatbot-teaser::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    width: 10px;
    height: 10px;
    background: #0c1220;
    border-right: 1px solid rgba(32, 201, 151, 0.35);
    border-bottom: 1px solid rgba(32, 201, 151, 0.35);
    transform: translateY(-50%) rotate(-45deg);
}

.as-chatbot-launcher.is-teaser-visible .as-chatbot-teaser {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

#as-chatbot-toggle {
    position: relative;
    z-index: 2;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #20c997 0%, #007bff 100%);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(32, 201, 151, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    animation: asChatFloat 3s ease-in-out infinite;
}

#as-chatbot-toggle:hover {
    animation: none;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 32px rgba(32, 201, 151, 0.55);
}

#as-chatbot-root.is-open .as-chatbot-launcher {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.85);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

@keyframes asChatPulseRing {
    0% {
        transform: scale(1);
        opacity: 0.75;
    }
    100% {
        transform: scale(1.85);
        opacity: 0;
    }
}

@keyframes asChatFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .as-chatbot-pulse,
    #as-chatbot-toggle {
        animation: none !important;
    }

    .as-chatbot-teaser {
        transition: none;
    }
}

#as-chatbot-panel {
    display: none;
    position: absolute;
    right: 0;
    bottom: 0;
    width: 340px;
    max-width: calc(100vw - 40px);
    height: 480px;
    max-height: calc(100vh - 140px);
    background: #0c1220;
    border: 1px solid rgba(32, 201, 151, 0.28);
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    flex-direction: column;
}

#as-chatbot-panel.is-open {
    display: flex;
}

.as-chat-header {
    flex-shrink: 0;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(32, 201, 151, 0.18) 0%, rgba(0, 123, 255, 0.12) 100%);
    border-bottom: 1px solid rgba(32, 201, 151, 0.2);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.as-chat-header h4 {
    margin: 0;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
}

.as-chat-header p {
    margin: 3px 0 0;
    color: #94a3b8;
    font-size: 0.75rem;
    line-height: 1.4;
}

#as-chatbot-close {
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: #94a3b8;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    flex-shrink: 0;
}

#as-chatbot-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.as-chat-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(32, 201, 151, 0.35) transparent;
}

.as-chat-body::-webkit-scrollbar {
    width: 5px;
}

.as-chat-body::-webkit-scrollbar-thumb {
    background: rgba(32, 201, 151, 0.35);
    border-radius: 4px;
}

#as-chatbot-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.as-chat-msg {
    max-width: 90%;
    padding: 10px 13px;
    border-radius: 12px;
    font-size: 0.86rem;
    line-height: 1.5;
    word-break: break-word;
}

.as-chat-msg.bot {
    align-self: flex-start;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(32, 201, 151, 0.18);
    color: #e8eef7;
}

.as-chat-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #20c997 0%, #007bff 100%);
    color: #fff;
}

.as-chat-msg.bot a {
    color: #33ffcc;
    text-decoration: underline;
}

.as-chat-footer {
    flex-shrink: 0;
    border-top: 1px solid rgba(32, 201, 151, 0.15);
    background: rgba(7, 11, 20, 0.98);
}

#as-chatbot-quick {
    padding: 10px 12px 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 88px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(32, 201, 151, 0.3) transparent;
}

.as-chat-quick-btn {
    border: 1px solid rgba(32, 201, 151, 0.3);
    background: rgba(32, 201, 151, 0.07);
    color: #9ef0d7;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 0.72rem;
    line-height: 1.35;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.as-chat-quick-btn:hover {
    background: rgba(32, 201, 151, 0.16);
    border-color: rgba(32, 201, 151, 0.5);
}

#as-chatbot-root #as-chatbot-form {
    display: block;
    padding: 10px 12px 12px;
    margin: 0;
}

#as-chatbot-root .as-chat-input-wrap {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 0;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(32, 201, 151, 0.32);
    background: rgba(15, 23, 42, 0.92);
    border-radius: 12px;
    padding: 4px 4px 4px 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#as-chatbot-root .as-chat-input-wrap:focus-within {
    border-color: rgba(32, 201, 151, 0.55);
    box-shadow: 0 0 0 2px rgba(32, 201, 151, 0.12);
}

#as-chatbot-root #as-chatbot-input {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    height: 38px !important;
    box-sizing: border-box !important;
    border: none !important;
    background: transparent !important;
    color: #e8eef7 !important;
    border-radius: 0 !important;
    padding: 0 8px 0 0 !important;
    margin: 0 !important;
    font-size: 0.84rem !important;
    line-height: 38px !important;
    outline: none !important;
    box-shadow: none !important;
    display: block !important;
}

#as-chatbot-root #as-chatbot-input::placeholder {
    color: #64748b !important;
}

#as-chatbot-root #as-chatbot-input:focus {
    border: none !important;
    box-shadow: none !important;
}

#as-chatbot-root #as-chatbot-send {
    flex: 0 0 38px !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    border-radius: 9px !important;
    border: none !important;
    cursor: pointer;
    background: linear-gradient(135deg, #20c997 0%, #007bff 100%) !important;
    color: #fff !important;
    font-size: 14px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    box-shadow: none !important;
}

#as-chatbot-root #as-chatbot-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.as-chat-typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.as-chat-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #20c997;
    animation: asChatBounce 1.2s infinite ease-in-out;
}

.as-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.as-chat-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes asChatBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
    40% { transform: translateY(-4px); opacity: 1; }
}

/* Keep above content but below scroll-to-top (z-index 9999) */
body.mirror-theme .scroll-to-top {
    bottom: 22px;
    right: 22px;
}

@media (max-width: 575px) {
    #as-chatbot-root {
        right: 12px;
        bottom: 70px;
    }

    #as-chatbot-panel {
        width: calc(100vw - 24px);
        height: calc(100vh - 130px);
        max-height: calc(100vh - 130px);
    }

    .as-chatbot-teaser {
        right: 0;
        top: auto;
        bottom: 62px;
        transform: translateY(8px);
        white-space: normal;
        max-width: 200px;
        text-align: center;
    }

    .as-chatbot-teaser::after {
        right: 18px;
        top: auto;
        bottom: -6px;
        transform: rotate(45deg);
    }

    .as-chatbot-launcher.is-teaser-visible .as-chatbot-teaser {
        transform: translateY(0);
    }
}
