﻿.jp-ai-fab {
    position: fixed !important;
    right: 24px;
    bottom: 24px;
    width: auto;
    height: 48px;
    padding: 0 18px;
    border-radius: 28px;
    border: none;
    background: #0d6efd;
    color: #fff;
    box-shadow: 0 6px 18px rgba(0,0,0,.35);
    z-index: 99999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .2s ease;
    animation: pulse 2.4s infinite;
}

    .jp-ai-fab:hover {
        transform: scale(1.08);
    }

    .jp-ai-fab i {
        font-size: 18px;
    }

.jp-ai-cta {
    letter-spacing: .1px;
}

/* Mobile: shrink to circular FAB */
@media (max-width:480px) {
    .jp-ai-fab {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        padding: 0;
        font-size: 0; /* hide text spacing */
        gap: 0;
    }

    .jp-ai-cta {
        display: none;
    }

    .jp-ai-fab i {
        font-size: 22px;
    }
}

/* Pulse ring */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(13,110,253,.55);
    }

    70% {
        box-shadow: 0 0 0 22px rgba(13,110,253,0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(13,110,253,0);
    }
}

.jp-ai-panel {
    position: fixed;
    right: 16px;
    bottom: 96px;
    width: 420px;
    max-height: 80vh;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(0,0,0,.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity .25s, transform .25s;
}

    .jp-ai-panel.hidden {
        pointer-events: none;
    }

    .jp-ai-panel.visible {
        opacity: 1;
        transform: translateY(0);
    }

.jp-ai-header {
    background: #0d6efd;
    color: #fff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.jp-ai-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}

.jp-ai-msgs {
    flex: 1;
    padding: 12px 16px;
    overflow-y: auto;
    background: #f7f7f9;
}

.ai-msg {
    margin-bottom: 12px;
    max-width: 90%;
    line-height: 1.4;
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 10px;
}

    .ai-msg.bot {
        background: #e8f0ff;
        color: #0d2b6f;
        border-radius: 10px 10px 10px 2px;
    }

    .ai-msg.user {
        background: #dff9dc;
        color: #104d0b;
        border-radius: 10px 10px 2px 10px;
        margin-left: auto;
        text-align: right;
    }

.jp-ai-footer {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    background: #fff;
}

    .jp-ai-footer textarea {
        flex: 1;
        resize: none;
        border: 1px solid #ccc;
        border-radius: 8px;
        padding: 8px 10px;
        font-size: 14px;
    }

    .jp-ai-footer button {
        width: 44px;
        height: 44px;
        border: none;
        border-radius: 8px;
        background: #0d6efd;
        color: #fff;
        cursor: pointer;
        font-size: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

.jp-ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.jp-suggestion {
    background: #e5e7eb;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background .2s;
}

    .jp-suggestion:hover {
        background: #d1d5db;
    }

@media (max-width:480px) {
    .jp-ai-panel {
        width: calc(100% - 32px);
        right: 16px;
        bottom: 90px;
    }
}

.jp-ai-tip {
    position: fixed;
    right: 100px;
    bottom: 36px;
    background: #0d6efd;
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,.25);
    z-index: 99999;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .25s, transform .25s;
}

    .jp-ai-tip:after {
        content: "";
        position: absolute;
        right: -8px;
        bottom: 12px;
        border-width: 8px 0 8px 8px;
        border-style: solid;
        border-color: transparent transparent transparent #0d6efd;
    }

    .jp-ai-tip.show {
        opacity: 1;
        transform: translateY(0);
    }

.jp-ai-tools {
    display: flex;
    gap: 10px;
    align-items: center;
}

.jp-export {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

.jp-export-word {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

.jp-upgrade-link {
    color: #0d6efd;
    font-weight: bold;
    text-decoration: underline;
}

    .jp-upgrade-link:hover {
        text-decoration: none;
        color: #084298;
    }

.ai-msg-controls {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.jp-download-btn {
    border: none;
    background: #f1f1f1;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 13px;
    transition: background .2s;
}

    .jp-download-btn:hover {
        background: #e2e8f0;
    }

.jp-upgrade-link {
    color: #0d6efd;
    font-weight: 600;
    text-decoration: underline;
}

    .jp-upgrade-link:hover {
        text-decoration: none;
    }
/* Default: show full label */
.jp-ai-label.desktop {
    display: inline;
    font-size: 16px;
}

.jp-ai-label.mobile {
    display: none;
}

/* Mobile: shrink label */
@media (max-width: 480px) {
    .jp-ai-label.desktop {
        display: none;
    }

    .jp-ai-label.mobile {
        display: inline;
        font-size: 14px;
    }

    .jp-ai-fab {
        width: auto;
        height: 44px;
        padding: 0 14px;
        border-radius: 24px;
        gap: 6px;
        font-size: 14px;
    }

        .jp-ai-fab i {
            font-size: 18px;
        }
}
/* Bot & user message bubbles */
.ai-msg.bot {
    background: linear-gradient(to right, #e8f0ff, #f1f5ff);
    border-radius: 12px 12px 12px 4px;
    padding: 12px;
    color: #0d2b6f;
    position: relative;
    animation: fadeIn 0.3s ease;
}

.ai-msg.user {
    background: #dff9dc;
    border-radius: 12px 12px 4px 12px;
    padding: 12px;
    text-align: right;
    margin-left: auto;
    color: #104d0b;
    animation: fadeIn 0.3s ease;
}

/* Avatar and content layout */
.jp-ai-avatar {
    float: left;
    margin-right: 8px;
    color: #0d6efd;
    font-size: 18px;
}

.jp-ai-text {
    overflow: hidden;
}

/* Button styling */
.jp-copy-btn {
    border: none;
    background: #f1f1f1;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 13px;
    transition: background .2s;
}

    .jp-copy-btn:hover {
        background: #e2e8f0;
    }

/* Animation */
.fadeIn {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

