/*=========================================
UNIVERSITY LINKS CHATBOT
=========================================*/

:root {
    --ul-chat-primary: #0e094a;
    --ul-chat-primary-light: #242064;
    --ul-chat-accent: #ee1b24;
    --ul-chat-white: #ffffff;
    --ul-chat-background: #f4f5f9;
    --ul-chat-text: #1d1d28;
    --ul-chat-muted: #747580;
    --ul-chat-border: #e3e4e9;
    --ul-chat-success: #21b573;
    --ul-chat-shadow: 0 24px 65px rgba(14, 9, 74, 0.22);
}

.ul-chatbot,
.ul-chatbot * {
    box-sizing: border-box;
}

.ul-chatbot {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 999999;
    font-family: Arial, Helvetica, sans-serif;
}

/*=========================================
FLOATING BUTTON
=========================================*/

.ul-chatbot-toggle {
    position: relative;

    width: 64px;
    height: 64px;

    padding: 0;

    border: none;
    border-radius: 50%;

    background: var(--ul-chat-primary);
    color: var(--ul-chat-white);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 25px;
    cursor: pointer;

    box-shadow: 0 14px 35px rgba(14, 9, 74, 0.35);

    transition:
        transform 0.25s ease,
        background 0.25s ease,
        box-shadow 0.25s ease;
}

.ul-chatbot-toggle:hover {
    background: var(--ul-chat-primary-light);
    transform: translateY(-4px);
    box-shadow: 0 18px 42px rgba(14, 9, 74, 0.4);
}

.ul-chatbot-toggle:focus-visible {
    outline: 3px solid rgba(14, 9, 74, 0.25);
    outline-offset: 4px;
}

.ul-chatbot-notification {
    position: absolute;
    top: -3px;
    right: -1px;

    width: 23px;
    height: 23px;

    border: 3px solid var(--ul-chat-white);
    border-radius: 50%;

    background: var(--ul-chat-accent);
    color: var(--ul-chat-white);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 10px;
    font-weight: 700;
}

/*=========================================
CHATBOT WINDOW
=========================================*/

.ul-chatbot-window {
    position: absolute;
    right: 0;
    bottom: 82px;

    width: 390px;
    height: min(650px, calc(100vh - 130px));

    border: 1px solid var(--ul-chat-border);
    border-radius: 22px;

    background: var(--ul-chat-white);
    box-shadow: var(--ul-chat-shadow);

    overflow: hidden;

    display: flex;
    flex-direction: column;

    opacity: 0;
    visibility: hidden;

    transform: translateY(24px) scale(0.96);
    transform-origin: bottom right;

    transition:
        opacity 0.25s ease,
        visibility 0.25s ease,
        transform 0.25s ease;
}

.ul-chatbot-window.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/*=========================================
HEADER
=========================================*/

.ul-chatbot-header {
    position: relative;
    z-index: 5;

    flex-shrink: 0;

    min-height: 82px;
    padding: 15px 17px;

    background: linear-gradient(
        135deg,
        var(--ul-chat-primary),
        var(--ul-chat-primary-light)
    );

    color: var(--ul-chat-white);

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ul-chatbot-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ul-chatbot-avatar {
    position: relative;

    width: 47px;
    height: 47px;

    border-radius: 15px;

    background: var(--ul-chat-white);
    color: var(--ul-chat-primary);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 16px;
    font-weight: 800;
}

.ul-chatbot-status {
    position: absolute;
    right: -2px;
    bottom: -2px;

    width: 14px;
    height: 14px;

    border: 3px solid var(--ul-chat-primary);
    border-radius: 50%;

    background: var(--ul-chat-success);
}

.ul-chatbot-profile-info h3 {
    margin: 0 0 4px;

    color: var(--ul-chat-white);

    font-size: 17px;
    font-weight: 700;
}

.ul-chatbot-profile-info p {
    margin: 0;

    color: rgba(255, 255, 255, 0.82);

    display: flex;
    align-items: center;
    gap: 6px;

    font-size: 12px;
}

.ul-online-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: #63e5aa;
}

.ul-chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ul-chatbot-header-actions button {
    width: 36px;
    height: 36px;

    padding: 0;

    border: none;
    border-radius: 10px;

    background: rgba(255, 255, 255, 0.1);
    color: var(--ul-chat-white);

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 14px;

    transition: background 0.2s ease;
}

.ul-chatbot-header-actions button:hover {
    background: rgba(255, 255, 255, 0.2);
}

/*=========================================
MESSAGES AREA
=========================================*/

.ul-chatbot-messages {
    position: relative;

    flex: 1 1 auto;
    min-height: 0;
    width: 100%;

    padding: 20px 17px;

    background: var(--ul-chat-background);

    overflow-x: hidden;
    overflow-y: auto;
    overflow-anchor: none;

    scroll-behavior: smooth;
}

/*=========================================
WELCOME MESSAGE POSITION
=========================================*/

.ul-chatbot-messages.is-welcome {
    display: flex;
    flex-direction: column;
    justify-content: center;

    overflow-y: hidden;
}

.ul-chatbot-messages.is-welcome .ul-chatbot-message-row {
    flex-shrink: 0;

    margin-top: 0;
    margin-bottom: 0;
}

/*=========================================
MESSAGE ROWS
=========================================*/

.ul-chatbot-message-row {
    width: 100%;

    display: flex;
    align-items: flex-end;
    gap: 8px;

    margin-bottom: 15px;
}

.ul-chatbot-message-row:first-child {
    margin-top: 0;
}

.ul-chatbot-message-row.user {
    justify-content: flex-end;
}

.ul-message-avatar {
    flex-shrink: 0;

    width: 30px;
    height: 30px;

    border-radius: 10px;

    background: var(--ul-chat-primary);
    color: var(--ul-chat-white);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 10px;
    font-weight: 700;
}

/*=========================================
MESSAGE BUBBLES
=========================================*/

.ul-chatbot-message {
    max-width: 79%;

    padding: 12px 14px;

    border-radius: 16px;

    font-size: 13.5px;
    line-height: 1.55;

    word-break: break-word;
}

.ul-chatbot-message.bot {
    border-bottom-left-radius: 5px;

    background: var(--ul-chat-white);
    color: var(--ul-chat-text);

    box-shadow: 0 4px 15px rgba(18, 18, 40, 0.06);
}

.ul-chatbot-message.user {
    border-bottom-right-radius: 5px;

    background: var(--ul-chat-primary);
    color: var(--ul-chat-white);
}

.ul-chatbot-message p {
    margin: 0;
}

.ul-chatbot-message p + p {
    margin-top: 8px;
}

.ul-chatbot-message ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.ul-chatbot-message li + li {
    margin-top: 4px;
}

.ul-chatbot-message strong {
    font-weight: 700;
}

.ul-chatbot-message-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    margin-top: 11px;
    padding: 9px 12px;

    border-radius: 9px;

    background: #efeff8;
    color: var(--ul-chat-primary);

    text-decoration: none;

    font-size: 12px;
    font-weight: 700;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.ul-chatbot-message-link:hover {
    background: #e2e1f1;
    transform: translateY(-1px);
}

.ul-message-time {
    display: block;

    margin-top: 7px;

    font-size: 9.5px;
    opacity: 0.55;
}

/*=========================================
TYPING INDICATOR
=========================================*/

.ul-typing-indicator {
    min-height: 18px;

    display: flex;
    align-items: center;
    gap: 4px;
}

.ul-typing-indicator span {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: #9d9ea7;

    animation: ulTypingAnimation 1.2s infinite ease-in-out;
}

.ul-typing-indicator span:nth-child(2) {
    animation-delay: 0.15s;
}

.ul-typing-indicator span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes ulTypingAnimation {
    0%,
    60%,
    100% {
        opacity: 0.4;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-5px);
    }
}

/*=========================================
SUGGESTED QUESTIONS
=========================================*/

.ul-chatbot-suggestions {
    flex-shrink: 0;

    width: 100%;
    padding: 11px 14px;

    border-top: 1px solid var(--ul-chat-border);

    background: var(--ul-chat-white);

    display: flex;
    gap: 8px;

    overflow-x: auto;
    scrollbar-width: none;
}

.ul-chatbot-suggestions::-webkit-scrollbar {
    display: none;
}

.ul-chatbot-suggestions button {
    flex-shrink: 0;

    padding: 8px 12px;

    border: 1px solid #d9d8e8;
    border-radius: 30px;

    background: var(--ul-chat-white);
    color: var(--ul-chat-primary);

    cursor: pointer;

    font-family: inherit;
    font-size: 11px;
    font-weight: 600;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}

.ul-chatbot-suggestions button:hover {
    border-color: var(--ul-chat-primary);

    background: var(--ul-chat-primary);
    color: var(--ul-chat-white);
}

/*=========================================
MESSAGE FORM
=========================================*/

.ul-chatbot-form {
    flex-shrink: 0;

    padding: 13px 15px 11px;

    border-top: 1px solid var(--ul-chat-border);

    background: var(--ul-chat-white);
}

.ul-chatbot-input-wrapper {
    width: 100%;

    padding: 7px 7px 7px 13px;

    border: 1px solid #dedfe6;
    border-radius: 15px;

    background: #fafafd;

    display: flex;
    align-items: flex-end;
    gap: 9px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.ul-chatbot-input-wrapper:focus-within {
    border-color: var(--ul-chat-primary);
    box-shadow: 0 0 0 3px rgba(14, 9, 74, 0.08);
}

.ul-chatbot-input-wrapper textarea {
    flex: 1;

    min-height: 38px;
    max-height: 90px;

    padding: 8px 0;

    border: none;
    outline: none;
    resize: none;

    background: transparent;
    color: var(--ul-chat-text);

    font-family: inherit;
    font-size: 13px;
    line-height: 1.4;
}

.ul-chatbot-input-wrapper textarea::placeholder {
    color: #999aa3;
}

.ul-chatbot-send {
    flex-shrink: 0;

    width: 40px;
    height: 40px;

    padding: 0;

    border: none;
    border-radius: 12px;

    background: var(--ul-chat-primary);
    color: var(--ul-chat-white);

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    transition:
        transform 0.2s ease,
        background 0.2s ease;
}

.ul-chatbot-send:hover {
    background: var(--ul-chat-primary-light);
    transform: scale(1.05);
}

.ul-chatbot-send:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
}

.ul-chatbot-disclaimer {
    margin: 8px 0 0;

    color: var(--ul-chat-muted);

    text-align: center;
    font-size: 9.5px;
    line-height: 1.4;
}

/*=========================================
SCROLLBAR
=========================================*/

.ul-chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

.ul-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ul-chatbot-messages::-webkit-scrollbar-thumb {
    border-radius: 20px;
    background: #cacbd3;
}

/*=========================================
TABLET
=========================================*/

@media (max-width: 768px) {

    .ul-chatbot {
        right: 16px;
        bottom: 16px;
    }

    .ul-chatbot-window {
        width: min(390px, calc(100vw - 32px));
    }
}

/*=========================================
MOBILE
=========================================*/

@media (max-width: 520px) {

    .ul-chatbot {
        right: 14px;
        bottom: 14px;
    }

    .ul-chatbot-toggle {
        width: 58px;
        height: 58px;

        font-size: 22px;
    }

    .ul-chatbot-window {
        position: fixed;

        top: 0;
        right: 0;
        bottom: 0;
        left: 0;

        width: 100%;
        height: 100dvh;

        border: none;
        border-radius: 0;

        transform: translateY(100%);
    }

    .ul-chatbot-window.is-open {
        transform: translateY(0);
    }

    .ul-chatbot-header {
        min-height: 76px;

        padding-top: max(
            15px,
            env(safe-area-inset-top)
        );
    }

    .ul-chatbot-messages {
        padding: 20px 13px 18px;

        overflow-anchor: none;
        scroll-behavior: auto;
    }

    .ul-chatbot-messages.is-welcome {
        justify-content: center;

        padding: 20px 13px;

        overflow-y: hidden;
    }

    .ul-chatbot-message {
        max-width: 84%;
    }

    .ul-chatbot-suggestions {
        padding-left: 12px;
        padding-right: 12px;
    }

    .ul-chatbot-form {
        padding-bottom: max(
            10px,
            env(safe-area-inset-bottom)
        );
    }
}