/* ==========================
   Launcher (round bubble)
========================== */

#chatbot-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;

    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    padding: 0;

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

    background: linear-gradient(135deg, #4E8BD9 0%, #2F62B0 100%);
    color: #ffffff;
    font-family: inherit;
    font-size: 25px;
    cursor: pointer;

    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 0 18px rgba(78, 139, 217, .4), 0 8px 24px rgba(78, 139, 217, .3);
    overflow: hidden;
    isolation: isolate;

    transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
    animation:
        chat-pop .55s cubic-bezier(.18, .9, .32, 1.25) .6s backwards,
        chat-nudge 7s ease-in-out 5s infinite;
}

#chatbot-button::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .25), transparent 60%);
    opacity: 0;
    animation: chat-shimmer 3s ease-in-out infinite;
}

#chatbot-button:hover,
#chatbot-button:focus-visible {
    transform: translateY(-3px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 0 30px rgba(78, 139, 217, .6), 0 14px 40px rgba(78, 139, 217, .35);
    background: linear-gradient(135deg, #5C97E2 0%, #3365B3 100%);
}

#chatbot-button:focus-visible {
    outline: 2px solid rgba(255, 255, 255, .7);
    outline-offset: 3px;
}

@keyframes chat-shimmer {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

@keyframes chat-pop {
    from { opacity: 0; transform: translateY(18px) scale(.85); }
}

@keyframes chat-nudge {
    0%, 92%, 100% { transform: translateY(0); }
    94% { transform: translateY(-4px); }
    97% { transform: translateY(1px); }
}

/* ==========================
   Floating greeting bubble
========================== */

#chatbot-greeting {
    position: fixed;
    bottom: 38px;
    right: 96px;
    z-index: 99999;

    background: #131313;
    border: 1px solid rgba(255, 255, 255, .16);
    color: #f2f2f0;
    padding: 10px 15px;
    border-radius: 14px 14px 4px 14px;
    font-size: 13.5px;
    white-space: nowrap;
    cursor: pointer;

    box-shadow: 0 12px 34px rgba(0, 0, 0, .5);
    animation: chat-greet-in .45s cubic-bezier(.2, .9, .35, 1.15) 1.6s backwards;
}

@keyframes chat-greet-in {
    from { opacity: 0; transform: translateY(8px) scale(.9); }
}

/* ==========================
   Chat Window
========================== */

#chatbot-window {
    position: fixed;
    bottom: 95px;
    right: 24px;
    z-index: 99998;

    width: min(380px, calc(100vw - 32px));
    height: min(600px, calc(100vh - 130px));

    background: #0f0f0f;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 20px;

    display: none;
    flex-direction: column;
    overflow: hidden;

    box-shadow: 0 25px 80px rgba(0, 0, 0, .6), 0 0 0 1px rgba(78, 139, 217, .1);
    transform-origin: bottom right;
    animation: chat-window-in .28s cubic-bezier(.2, .9, .35, 1.1);
}

@keyframes chat-window-in {
    from { opacity: 0; transform: translateY(14px) scale(.95); }
}

/* ==========================
   Header
========================== */

#chatbot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    color: #f2f2f0;
    background: linear-gradient(180deg, #141414, #0f0f0f);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

#chatbot-header strong {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#chatbot-header strong::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3fd68f;
    box-shadow: 0 0 8px rgba(63, 214, 143, .8);
}

#chatbot-header small {
    color: rgba(242, 242, 240, .55);
    font-size: 12.5px;
}

/* ==========================
   Close Button
========================== */

#chatbot-close {
    background: none;
    border: none;
    color: rgba(242, 242, 240, .6);
    font-size: 20px;
    cursor: pointer;
    transition: color .2s ease;
}

#chatbot-close:hover,
#chatbot-close:focus-visible {
    color: #f2f2f0;
}

/* ==========================
   Chat Body
========================== */

#chatbot-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    color: #f2f2f0;
}

/* ==========================
   Messages
========================== */

.bot-message,
.user-message,
.typing-message {
    animation: chat-msg-in .28s ease backwards;
}

@keyframes chat-msg-in {
    from { opacity: 0; transform: translateY(8px); }
}

.bot-message {
    background: #161616;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 16px 16px 16px 6px;
    padding: 14px 16px;
    line-height: 1.65;
    width: fit-content;
    max-width: 85%;
    margin-top: 14px;
}

.bot-message:first-child {
    margin-top: 0;
}

.bot-message p {
    margin: 0 0 12px;
}

.bot-message p:last-child {
    margin-bottom: 0;
}

.bot-message ul {
    margin-top: 12px;
    padding-left: 18px;
}

.bot-message li {
    margin-bottom: 8px;
}

.user-message {
    background: linear-gradient(135deg, #4E8BD9, #2F62B0);
    color: #ffffff;
    font-weight: 500;
    margin-top: 14px;
    margin-left: auto;
    padding: 12px 15px;
    border-radius: 16px 16px 6px 16px;
    width: fit-content;
    max-width: 80%;
}

.typing-message {
    margin-top: 14px;
    background: #161616;
    color: rgba(242, 242, 240, .55);
    padding: 12px 15px;
    border-radius: 16px 16px 16px 6px;
    width: fit-content;
    max-width: 75%;
    animation: chat-msg-in .28s ease backwards, chat-typing-pulse 1.4s ease-in-out .3s infinite;
}

@keyframes chat-typing-pulse {
    0%, 100% { opacity: .5; }
    50% { opacity: 1; }
}

/* ==========================
   Footer
========================== */

#chatbot-footer {
    display: flex;
    gap: 10px;
    padding: 16px;
    background: #141414;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

#chatbot-input {
    flex: 1;
    border: 1px solid rgba(255, 255, 255, .14);
    background: #0c0c0c;
    color: #f2f2f0;
    border-radius: 12px;
    padding: 13px 14px;
    outline: none;
    font-size: 14.5px;
    font-family: inherit;
    transition: border-color .2s ease;
}

#chatbot-input::placeholder {
    color: rgba(242, 242, 240, .35);
}

#chatbot-input:focus {
    border-color: rgba(78, 139, 217, .6);
}

#send-message {
    width: 46px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: linear-gradient(135deg, #4E8BD9, #2F62B0);
    color: #ffffff;
    font-size: 17px;
    transition: transform .2s ease, box-shadow .2s ease;
}

#send-message:hover,
#send-message:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 0 18px rgba(78, 139, 217, .45), 0 6px 18px rgba(78, 139, 217, .3);
}

/* ==========================
   Booking button in replies
========================== */

.chat-booking-button {
    display: inline-block;
    margin-top: 12px;
    padding: 11px 16px;
    border-radius: 999px;
    background: linear-gradient(135deg, #4E8BD9, #2F62B0);
    color: #ffffff;
    font-weight: 600;
    text-decoration: none;
    font-size: 13.5px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 0 14px rgba(78, 139, 217, .35), 0 6px 18px rgba(78, 139, 217, .25);
    transition: transform .2s ease, box-shadow .2s ease;
}

.chat-booking-button:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 0 24px rgba(78, 139, 217, .55), 0 10px 26px rgba(78, 139, 217, .3);
}

/* ==========================
   Reduced motion
========================== */

@media (max-width: 760px) {
    #chatbot-button,
    #chatbot-button:hover,
    #chatbot-button:focus-visible,
    .chat-booking-button,
    .chat-booking-button:hover,
    #send-message,
    #send-message:hover {
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22);
    }

    #chatbot-button,
    .chat-booking-button,
    #send-message {
        transition: transform .2s ease, background .2s ease;
    }
}

@media (prefers-reduced-motion: reduce) {
    #chatbot-button,
    #chatbot-button::after,
    #chatbot-greeting,
    #chatbot-window,
    .bot-message,
    .user-message,
    .typing-message {
        animation: none;
    }
}
