/* =========================================================
   POLYMERSCARE AI — FINAL FLOATING BUTTON FIX
   ========================================================= */

.ai-chat-button {
    position: fixed !important;

    right: 25px !important;
    bottom: 25px !important;

    width: 82px !important;
    height: 82px !important;
    min-width: 82px !important;
    min-height: 82px !important;

    padding: 0 !important;
    margin: 0 !important;

    display: flex !important;
    flex-direction: column !important;

    align-items: center !important;
    justify-content: center !important;

    gap: 1px !important;

    box-sizing: border-box !important;

    border: 4px solid #ffffff !important;
    border-radius: 50% !important;

    background: linear-gradient(
        145deg,
        #1683ff 0%,
        #0868ee 55%,
        #0755d5 100%
    ) !important;

    color: #ffffff !important;

    cursor: pointer;

    z-index: 9999 !important;

    box-shadow:
        0 10px 30px rgba(13, 110, 253, 0.35),
        0 0 0 7px rgba(13, 110, 253, 0.07) !important;

    overflow: visible !important;

    line-height: normal !important;

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease !important;
}


/* =========================
   ROBOT
   ========================= */

.ai-chat-button .ai-robot {
    position: absolute !important;

    top: 13px !important;
    left: 50% !important;

    width: 38px !important;
    height: 38px !important;

    transform: translateX(-50%) !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    margin: 0 !important;
    padding: 0 !important;
}

.ai-chat-button .ai-robot svg {
    width: 100% !important;
    height: 100% !important;

    display: block !important;
}


/* =========================
   AI TEXT
   ========================= */

.ai-chat-button .ai-button-text {
    position: absolute !important;

    left: 0 !important;
    right: 0 !important;
    bottom: 10px !important;

    display: block !important;

    width: 100% !important;

    margin: 0 !important;
    padding: 0 !important;

    color: #ffffff !important;

    text-align: center !important;

    font-size: 13px !important;
    font-weight: 800 !important;

    line-height: 1 !important;

    letter-spacing: 0.5px !important;
}


/* =========================
   HOVER
   ========================= */

.ai-chat-button:hover {
    transform: translateY(-4px) scale(1.05) !important;

    box-shadow:
        0 14px 35px rgba(13, 110, 253, 0.45),
        0 0 0 9px rgba(13, 110, 253, 0.09) !important;
}


/* =========================
   CLICK
   ========================= */

.ai-chat-button:active {
    transform: scale(0.94) !important;
}


/* =========================
   PULSE
   ========================= */

.ai-chat-button::before {
    content: "";

    position: absolute;

    inset: -9px;

    border-radius: 50%;

    border: 2px solid rgba(13, 110, 253, 0.20);

    pointer-events: none;

    animation: aiRobotPulse 2.8s ease-out infinite;
}


@keyframes aiRobotPulse {

    0% {
        transform: scale(0.92);
        opacity: 0.70;
    }

    65% {
        transform: scale(1.16);
        opacity: 0;
    }

    100% {
        transform: scale(1.16);
        opacity: 0;
    }
}


/* =========================
   TOOLTIP
   ========================= */

.ai-chat-button::after {
    content: "PolyMersCare AI Assistant";

    position: absolute;

    right: 96px;
    top: 50%;

    transform:
        translateY(-50%)
        translateX(8px);

    padding: 9px 13px;

    white-space: nowrap;

    border-radius: 10px;

    background: #172554;
    color: #ffffff;

    font-size: 11px;
    font-weight: 600;

    opacity: 0;

    pointer-events: none;

    box-shadow:
        0 7px 20px rgba(0, 0, 0, 0.15);

    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}


.ai-chat-button:hover::after {
    opacity: 1;

    transform:
        translateY(-50%)
        translateX(0);
}


/* =========================
   MOBILE
   ========================= */

@media (max-width: 500px) {

    .ai-chat-button {
        width: 72px !important;
        height: 72px !important;

        min-width: 72px !important;
        min-height: 72px !important;

        right: 15px !important;
        bottom: 15px !important;
    }

    .ai-chat-button .ai-robot {
        top: 10px !important;

        width: 33px !important;
        height: 33px !important;
    }

    .ai-chat-button .ai-button-text {
        bottom: 9px !important;

        font-size: 12px !important;
    }

    .ai-chat-button::after {
        display: none;
    }
}



/* =========================
   CHATBOX
   ========================= */

.ai-chatbox {
    display: none;

    flex-direction: column;

    position: fixed;

    right: 25px;
    bottom: 120px;

    width: 390px;
    height: 550px;

    max-width: calc(100vw - 30px);
    max-height: calc(100vh - 120px);

    background: #fff;

    border-radius: 24px;

    overflow: hidden;

    z-index: 9999;

    border: 1px solid rgba(13, 110, 253, 0.08);

    box-shadow:
        0 20px 60px rgba(31, 56, 100, 0.20),
        0 5px 20px rgba(31, 56, 100, 0.08);
}


/* =========================
   HEADER
   ========================= */

.ai-chat-header {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 17px 18px;

    color: #fff;

    background: linear-gradient(
        135deg,
        #087df5 0%,
        #1769e8 55%,
        #1557d6 100%
    );

    flex-shrink: 0;

    overflow: hidden;
}

.ai-chat-header::before {
    content: "";

    position: absolute;

    width: 180px;
    height: 90px;

    right: -50px;
    bottom: -55px;

    border-radius: 50%;

    background: rgba(255,255,255,0.10);
}


/* =========================
   HEADER LEFT
   ========================= */

.ai-header-left {
    display: flex;
    align-items: center;

    position: relative;
    z-index: 2;
}


/* Avatar */

.ai-avatar {
    width: 44px;
    height: 44px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-right: 11px;

    border-radius: 50%;

    background: rgba(255,255,255,0.96);

    color: #1264e8;

    font-size: 20px;

    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}


/* Header text */

.ai-header-info strong {
    display: block;

    font-size: 16px;
    font-weight: 750;

    line-height: 1.2;

    margin-bottom: 5px;
}

.ai-header-info small {
    display: flex;
    align-items: center;

    font-size: 11px;

    color: rgba(255,255,255,0.90);
}


/* Online dot */

.ai-online-dot {
    width: 8px;
    height: 8px;

    margin-right: 5px;

    border-radius: 50%;

    background: #4ade80;

    box-shadow: 0 0 0 3px rgba(74,222,128,0.15);
}


/* Close */

.ai-close {
    position: relative;
    z-index: 3;

    width: 34px;
    height: 34px;

    border: none;
    border-radius: 50%;

    background: rgba(255,255,255,0.16);

    color: #fff;

    font-size: 21px;

    cursor: pointer;

    transition: all 0.2s ease;
}

.ai-close:hover {
    background: rgba(255,255,255,0.28);
    transform: rotate(90deg);
}


/* =========================
   MESSAGE AREA
   ========================= */

.ai-chat-messages {
    flex: 1;

    padding: 18px 15px 12px;

    overflow-y: auto;

    background: linear-gradient(
        180deg,
        #f9fbff 0%,
        #fff 100%
    );
}


/* Scrollbar */

.ai-chat-messages::-webkit-scrollbar {
    width: 5px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}


/* =========================
   CHAT TITLE
   ========================= */

.ai-chat-date {
    display: none;
}


/* =========================
   MESSAGE BUBBLES
   ========================= */

.ai-message {
    position: relative;

    margin-bottom: 12px;

    padding: 11px 13px;

    max-width: 84%;

    border-radius: 16px;

    font-size: 13px;
    line-height: 1.55;

    white-space: pre-wrap;
    word-wrap: break-word;

    animation: aiMessageIn 0.25s ease;
}


/* AI */

.ai-bot-message {
    margin-right: auto;

    background: #eef5ff;

    color: #243b63;

    border: 1px solid #dfebff;

    border-top-left-radius: 6px;

    box-shadow: 0 3px 10px rgba(38,92,170,0.05);

    text-align: left;
}


/* User */

.ai-user-message {
    margin-left: auto;

    background: linear-gradient(
        135deg,
        #0d6efd,
        #1769e8
    );

    color: #fff;

    border-top-right-radius: 6px;

    box-shadow: 0 5px 15px rgba(13,110,253,0.18);

    text-align: left;
}


/* Typing */

.ai-typing {
    color: #64748b;
    background: #f1f5f9;
}


/* =========================
   QUICK QUESTIONS
   ========================= */

.ai-quick-questions {
    display: flex;

    flex-wrap: wrap;

    gap: 7px;

    padding: 11px 14px 12px;

    background: #fff;

    border-top: 1px solid #edf1f7;

    flex-shrink: 0;
}


/* Title */

.ai-quick-title {
    width: 100%;

    margin-bottom: 2px;

    color: #31558f;

    font-size: 11.5px;
    font-weight: 700;
}


/* Buttons */

.ai-quick-questions button {
    flex: 1 1 calc(50% - 5px);

    min-height: 35px;

    padding: 7px 9px;

    border: 1px solid #d9e7ff;

    border-radius: 12px;

    background: #f5f9ff;

    color: #245ca8;

    font-size: 10.5px;
    font-weight: 600;

    cursor: pointer;

    transition: all 0.2s ease;
}

.ai-quick-questions button:hover {
    background: #e9f2ff;

    border-color: #bcd5ff;

    transform: translateY(-1px);

    box-shadow: 0 3px 9px rgba(13,110,253,0.08);
}

.ai-quick-questions button:active {
    transform: scale(0.97);
}


/* =========================
   INPUT
   ========================= */

.ai-chat-input {
    display: flex;
    align-items: center;

    gap: 8px;

    padding: 10px 12px;

    background: #fff;

    border-top: 1px solid #edf1f7;

    flex-shrink: 0;
}


/* Text input */

.ai-chat-input input {
    flex: 1;

    height: 40px;

    min-width: 0;

    padding: 0 14px;

    border: 1px solid #dce4ef;

    border-radius: 22px;

    outline: none;

    background: #f9fbfe;

    color: #24324a;

    font-size: 12px;

    transition: all 0.2s ease;
}

.ai-chat-input input::placeholder {
    color: #94a3b8;
}

.ai-chat-input input:focus {
    background: #fff;

    border-color: #80adff;

    box-shadow: 0 0 0 3px rgba(13,110,253,0.08);
}


/* Send */

.ai-chat-input button {
    width: 40px;
    height: 40px;

    flex-shrink: 0;

    border: none;
    border-radius: 50%;

    background: linear-gradient(
        135deg,
        #0d6efd,
        #1769e8
    );

    color: #fff;

    font-size: 16px;

    cursor: pointer;

    box-shadow: 0 5px 15px rgba(13,110,253,0.22);

    transition: all 0.2s ease;
}

.ai-chat-input button:hover {
    transform: translateY(-2px);

    box-shadow: 0 8px 18px rgba(13,110,253,0.30);
}

.ai-chat-input button:active {
    transform: scale(0.94);
}


/* =========================
   MESSAGE ANIMATION
   ========================= */

@keyframes aiMessageIn {

    from {
        opacity: 0;
        transform: translateY(7px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* =========================
   MOBILE
   ========================= */

@media (max-width: 500px) {

    .ai-chatbox {
        right: 10px;
        bottom: 80px;

        width: calc(100vw - 20px);

        height: min(650px, calc(100vh - 100px));

        border-radius: 20px;
    }

    .ai-chat-button {
        right: 15px;
        bottom: 15px;

        width: 58px;
        height: 58px;
    }

    .ai-chat-header {
        padding: 15px;
    }

    .ai-message {
        max-width: 88%;
    }

    .ai-quick-questions {
        gap: 6px;
    }

    .ai-quick-questions button {
        font-size: 10px;
    }
}