/* Sits directly below the WhatsApp button (.fixed-social-medias1 in home.html:
   60x60, right 10px, bottom 90px) with a 14px gap */
#yr-chatbot {
    position: fixed;
    right: 10px;
    bottom: 16px;
    z-index: 999999;

    --yr-navy: #062F60;
    --yr-navy-light: #0d4282;
    --yr-text: #1f2937;
    --yr-muted: #6b7280;
}


/* ROBOT BUTTON */

#yr-chat-toggle {
    width: 60px;
    height: 60px;

    padding: 0;
    border: none;
    border-radius: 50%;

    overflow: hidden;
    cursor: pointer;

    background: var(--yr-navy);

    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.22);
}

#yr-chat-toggle img {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;

    border-radius: 50%;

    /* The icon image has a white margin around its navy circle;
       zoom in so only the navy circle shows, like the WhatsApp button */
    transform: scale(1.15);
}


/* CHAT WINDOW */

#yr-chat-window {
    position: fixed;

    right: 10px;
    bottom: 16px;

    width: 420px;

    /* Stay below the 84px site navbar: 84 navbar + 12 gap + 16 bottom */
    height: min(720px, calc(100vh - 112px));

    display: none;
    flex-direction: column;

    background: #ffffff;

    border-radius: 20px;

    overflow: hidden;

    box-shadow: 0 16px 48px rgba(6, 47, 96, 0.28);

    font-family: inherit;
}

#yr-chat-window.yr-open {
    display: flex;
    animation: yr-pop-in 0.22s ease-out;
}

@keyframes yr-pop-in {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}


/* HEADER */

#yr-chat-header {
    background: linear-gradient(135deg, var(--yr-navy) 0%, var(--yr-navy-light) 100%);
    color: #ffffff;

    padding: 16px 18px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    flex-shrink: 0;
}

.yr-header-info {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.yr-header-avatar {
    width: 56px;
    height: 56px;
    flex-shrink: 0;

    border-radius: 50%;
    overflow: hidden;

    background: var(--yr-navy);
    border: 2px solid rgba(255, 255, 255, 0.35);
}

.yr-header-avatar img,
.yr-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transform: scale(1.15);
}

.yr-header-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.yr-header-text strong {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
}

.yr-status {
    display: flex;
    align-items: center;
    gap: 6px;

    margin-top: 3px;

    font-size: 14px;
    opacity: 0.95;
}

.yr-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.yr-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.yr-header-actions button {
    width: 36px;
    height: 36px;

    border: none;
    border-radius: 50%;

    background: transparent;
    color: #ffffff;

    font-size: 20px;

    cursor: pointer;

    transition: background 0.2s ease;
}

.yr-header-actions button:hover {
    background: rgba(255, 255, 255, 0.15);
}


/* MESSAGES */

#yr-chat-messages {
    flex: 1;

    padding: 20px 16px 12px;

    overflow-y: auto;

    background:
        radial-gradient(120% 60% at 0% 25%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0) 60%),
        radial-gradient(120% 60% at 100% 80%, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0) 60%),
        linear-gradient(180deg, #eef3fa 0%, #e6edf7 100%);

    display: flex;
    flex-direction: column;

    gap: 18px;

    scroll-behavior: smooth;
}

#yr-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#yr-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(6, 47, 96, 0.2);
    border-radius: 3px;
}

.yr-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.yr-row-user {
    justify-content: flex-end;
}

.yr-avatar {
    width: 44px;
    height: 44px;
    flex-shrink: 0;

    border-radius: 50%;
    overflow: hidden;

    background: var(--yr-navy);
}

.yr-msg-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 82%;
}

.yr-row-user .yr-msg-col {
    align-items: flex-end;
}


/* MESSAGE BUBBLES */

.yr-message {
    padding: 13px 17px;

    border-radius: 16px;

    font-size: 15px;
    line-height: 1.55;

    white-space: pre-wrap;
    overflow-wrap: anywhere;

    text-align: left;
}

.yr-bot-message {
    background: #ffffff;
    color: var(--yr-text);

    border-top-left-radius: 6px;

    box-shadow: 0 2px 10px rgba(6, 47, 96, 0.08);
}

.yr-user-message {
    background: var(--yr-navy);
    color: #ffffff;

    border-radius: 18px;
    border-bottom-right-radius: 6px;
}

.yr-time {
    display: flex;
    align-items: center;
    gap: 6px;

    margin-top: 6px;
    padding: 0 4px;

    font-size: 12px;
    color: var(--yr-muted);
}

.yr-time i {
    color: #60a5fa;
    font-size: 11px;
}


/* TYPING INDICATOR */

.yr-typing-bubble {
    display: flex;
    align-items: center;
    gap: 5px;

    padding: 16px 18px;
}

.yr-typing-bubble span {
    width: 7px;
    height: 7px;

    border-radius: 50%;
    background: #94a3b8;

    animation: yr-bounce 1.2s infinite ease-in-out;
}

.yr-typing-bubble span:nth-child(2) { animation-delay: 0.15s; }
.yr-typing-bubble span:nth-child(3) { animation-delay: 0.3s; }

@keyframes yr-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30%           { transform: translateY(-5px); opacity: 1; }
}


/* QUICK REPLIES */

.yr-quick-replies {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;

    padding-left: 56px;
}

.yr-quick-reply {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    padding: 11px 12px;

    border: 1px solid #e3e9f2;
    border-radius: 999px;

    background: #ffffff;
    color: var(--yr-navy);

    font-family: inherit;
    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    box-shadow: 0 2px 8px rgba(6, 47, 96, 0.06);

    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.yr-quick-reply i {
    font-size: 16px;
}

.yr-quick-reply:hover {
    background: #f1f5fb;
    border-color: #c9d6ea;
    transform: translateY(-1px);
}


/* INPUT */

#yr-chat-input-area {
    display: flex;
    align-items: center;

    gap: 10px;

    padding: 14px 14px 16px;

    border-top: 1px solid #e8edf4;

    background: #ffffff;

    flex-shrink: 0;
}

#yr-chat-input {
    flex: 1;

    min-width: 0;

    height: 52px;
    padding: 0 20px;

    border: 1px solid #d4dbe6;
    border-radius: 999px;

    outline: none;

    font-family: inherit;
    font-size: 15px;
    color: var(--yr-text);

    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#yr-chat-input::placeholder {
    color: #8a94a6;
}

#yr-chat-input:focus {
    border-color: var(--yr-navy);
    box-shadow: 0 0 0 3px rgba(6, 47, 96, 0.08);
}

#yr-chat-send {
    width: 56px;
    height: 56px;
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: none;
    border-radius: 50%;

    background: var(--yr-navy);
    color: #ffffff;

    font-size: 20px;

    cursor: pointer;

    transition: background 0.2s ease, transform 0.2s ease;
}

#yr-chat-send:hover {
    background: var(--yr-navy-light);
    transform: scale(1.04);
}

#yr-chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}


/* MOBILE */

@media (max-width: 768px) {

    #yr-chat-window {
        left: 8px;
        right: 8px;
        top: 84px; /* below the 76px mobile navbar */
        bottom: 8px;

        width: auto;
        height: auto;

        border-radius: 16px;
    }

    .yr-header-avatar {
        width: 46px;
        height: 46px;
    }

    .yr-header-text strong {
        font-size: 15px;
    }

    .yr-avatar {
        width: 36px;
        height: 36px;
    }

    .yr-quick-replies {
        padding-left: 0;
    }

    .yr-quick-reply {
        font-size: 13px;
        padding: 10px 8px;
    }

    #yr-chat-input {
        height: 46px;
    }

    #yr-chat-send {
        width: 48px;
        height: 48px;
    }
}
