/* =========================================================
   OPTISYNC FLOATING AI CHATBOT
   Uses the variables already defined in assets/css/style.css
   ========================================================= */

.optisync-chatbot {
    position: fixed;
    right: 26px;
    bottom: 26px;
    z-index: 9999;
    font-family: var(--font-body, 'Manrope', sans-serif);
}

.optisync-chatbot-toggle {
    position: relative;
    width: 58px;
    height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: var(--teal, #2CB9AC);
    color: var(--navy, #12213D);
    box-shadow: 0 15px 35px rgba(18, 33, 61, .28);
    cursor: pointer;
    font-size: 1.18rem;
    transition: transform .18s ease, box-shadow .18s ease;
}

.optisync-chatbot-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(18, 33, 61, .34);
}

.optisync-chatbot-pulse {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--success, #2CA65A);
}

.optisync-chatbot-panel {
    position: absolute;
    right: 0;
    bottom: 74px;
    width: min(380px, calc(100vw - 32px));
    height: min(560px, calc(100vh - 120px));
    display: none;
    grid-template-rows: auto 1fr auto auto auto;
    overflow: hidden;
    background: var(--card, #fff);
    border: 1px solid var(--border, #E4E8EE);
    border-radius: 20px;
    box-shadow: 0 24px 65px rgba(18, 33, 61, .26);
}

.optisync-chatbot-panel.is-open {
    display: grid;
}

.optisync-chatbot-header {
    min-height: 76px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--navy, #12213D);
    color: #fff;
}

.optisync-chatbot-brand {
    display: flex;
    align-items: center;
    gap: 11px;
}

.optisync-chatbot-logo {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 38px;
    border-radius: 50%;
    background: var(--teal, #2CB9AC);
    color: var(--navy, #12213D);
}

.optisync-chatbot-brand strong,
.optisync-chatbot-brand small {
    display: block;
}

.optisync-chatbot-brand strong {
    color: #fff;
    font-size: .91rem;
}

.optisync-chatbot-brand small {
    margin-top: 2px;
    color: #C8D2E2;
    font-size: .72rem;
}

.optisync-chatbot-close {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    color: #fff;
    cursor: pointer;
}

.optisync-chatbot-messages {
    min-height: 0;
    padding: 18px;
    overflow-y: auto;
    background: #F7F9FB;
}

.optisync-chat-message {
    width: fit-content;
    max-width: 84%;
    margin-bottom: 12px;
    padding: 11px 13px;
    border-radius: 15px;
    font-size: .82rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.optisync-chat-message.bot {
    margin-right: auto;
    background: #fff;
    color: var(--text, #16202E);
    border: 1px solid var(--border, #E4E8EE);
    border-bottom-left-radius: 5px;
}

.optisync-chat-message.user {
    margin-left: auto;
    background: var(--teal, #2CB9AC);
    color: #082D29;
    border-bottom-right-radius: 5px;
}

.optisync-chat-message.typing {
    color: var(--muted, #64707E);
    font-style: italic;
}

.optisync-chatbot-quick {
    padding: 10px 14px 0;
    display: flex;
    gap: 7px;
    overflow-x: auto;
    background: #fff;
}

.optisync-chatbot-quick button {
    flex: 0 0 auto;
    padding: 7px 10px;
    border: 1px solid var(--border, #E4E8EE);
    border-radius: 999px;
    background: #F7F9FB;
    color: var(--navy, #12213D);
    cursor: pointer;
    font-size: .7rem;
    font-weight: 700;
}

.optisync-chatbot-quick button:hover {
    border-color: var(--teal, #2CB9AC);
}

.optisync-chatbot-form {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
}

.optisync-chatbot-form input {
    min-width: 0;
    flex: 1;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border, #E4E8EE);
    border-radius: 999px;
    background: #fff;
    color: var(--text, #16202E);
    outline: none;
    font-size: .82rem;
}

.optisync-chatbot-form input:focus {
    border-color: var(--teal, #2CB9AC);
    box-shadow: 0 0 0 3px rgba(44,185,172,.12);
}

.optisync-chatbot-form button {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: var(--navy, #12213D);
    color: #fff;
    cursor: pointer;
}

.optisync-chatbot-form button:disabled,
.optisync-chatbot-form input:disabled {
    opacity: .65;
    cursor: not-allowed;
}

.optisync-chatbot-note {
    margin: 0;
    padding: 0 14px 13px;
    background: #fff;
    color: var(--muted, #64707E);
    font-size: .62rem;
    line-height: 1.45;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 520px) {
    .optisync-chatbot {
        right: 16px;
        bottom: 16px;
    }

    .optisync-chatbot-panel {
        position: fixed;
        left: 16px;
        right: 16px;
        bottom: 86px;
        width: auto;
        height: min(68vh, 560px);
    }
}
