#chatbot-launcher,
#property-chatbot,
#property-chatbot * {
    box-sizing: border-box;
}

#chatbot-launcher {
    position: fixed;
    right: 18px;
    bottom: 22px;
    width: 60px;
    height: 60px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1050;
    transition: transform .25s ease, box-shadow .25s ease;
}

#chatbot-launcher:hover {
    transform: translateY(-4px) scale(1.04);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

#chatbot-launcher img {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    position: relative;
    z-index: 2;
}

.launcher-ring,
#chatbot-launcher::before,
#chatbot-launcher::after {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1px solid rgba(193, 146, 45, .45);
    animation: chatbotPulse 2s ease-out infinite;
}

#chatbot-launcher::after {
    animation-delay: .65s;
}

.launcher-ring {
    inset: -14px;
    border-color: rgba(215, 173, 25, .22);
    animation-delay: 1.1s;
}

#property-chatbot {
    position: fixed;
    right: 20px;
    bottom: 92px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 525px;
    max-height: calc(100vh - 115px);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .33);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1050;
    transform-origin: right bottom;
    animation: chatbotOpen .28s ease both;
}

#property-chatbot.hidden {
    display: none !important;
}

.chat-header {
    color: #fff;
    padding: 13px 14px;
    background: linear-gradient(135deg, #201b99, #27229b 48%, #3c37b9);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.chat-header::after {
    content: "";
    position: absolute;
    top: -60%;
    left: -35%;
    width: 55%;
    height: 220%;
    background: rgba(255, 255, 255, .18);
    transform: rotate(20deg);
    animation: headerShine 4.6s ease-in-out infinite;
}

.header-left {
    display: flex;
    gap: 10px;
    align-items: center;
    position: relative;
    z-index: 1;
}

.agent-img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid rgba(255, 255, 255, .75);
}

.bot-name {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.bot-role {
    font-size: 12px;
    opacity: .92;
}

.online-dot {
    width: 8px;
    height: 8px;
    margin-left: 5px;
    border-radius: 50%;
    display: inline-block;
    background: #22d36f;
    box-shadow: 0 0 0 0 rgba(34, 211, 111, .7);
    animation: onlinePulse 1.7s ease infinite;
}

.chat-close {
    position: relative;
    z-index: 1;
    color: #fff;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .15);
    font-size: 24px;
    line-height: 28px;
    cursor: pointer;
    transition: background .22s ease, transform .22s ease;
}

.chat-close:hover {
    background: rgba(0, 0, 0, .28);
    transform: rotate(90deg);
}

#chat-body {
    flex: 1;
    padding: 13px;
    overflow-y: auto;
    background:
        radial-gradient(circle at 10% 0%, rgba(215, 173, 25, .12), transparent 26%),
        linear-gradient(180deg, #fbf8f1 0%, #f4f4f4 100%);
}

.bot-msg,
.user-msg {
    display: flex;
    gap: 7px;
    margin-bottom: 13px;
}

.bot-msg img {
    width: 27px;
    height: 27px;
    border-radius: 50%;
    background: #fff;
    flex: 0 0 auto;
}

.user-msg {
    justify-content: flex-end;
}

.bot-text,
.user-text {
    padding: 9px 12px;
    border-radius: 14px;
    max-width: 250px;
    font-size: 13px;
    line-height: 1.42;
    box-shadow: 0 7px 16px rgba(0, 0, 0, .07);
}

.bot-text {
    color: #242424;
    background: #fff;
    border-top-left-radius: 5px;
}

.user-text {
    color: #fff;
    background: linear-gradient(135deg, #a67318, #c1922d);
    border-top-right-radius: 5px;
}

.time {
    color: #777;
    font-size: 10px;
    margin-top: 4px;
}

.time.right {
    text-align: right;
}

.bubble {
    animation: msgIn .36s cubic-bezier(.22, .9, .28, 1.2) both;
}

.typing-bubble {
    min-width: 48px;
    padding: 10px 12px;
    border-radius: 14px;
    background: #fff;
    display: flex;
    gap: 4px;
    align-items: center;
    box-shadow: 0 7px 16px rgba(0, 0, 0, .07);
}

.typing-bubble span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #b98b29;
    animation: typingBlink 1.1s infinite ease-in-out;
}

.typing-bubble span:nth-child(2) { animation-delay: .15s; }
.typing-bubble span:nth-child(3) { animation-delay: .3s; }

#chat-options {
    margin: 2px 0 12px 35px;
    animation: optionsIn .32s ease both;
}

.options-block {
    display: grid;
    gap: 8px;
}

.options-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#chat-options button {
    color: #60420d;
    font-size: 13px;
    font-weight: 700;
    text-align: left;
    border: 1px solid rgba(193, 146, 45, .35);
    border-radius: 20px;
    background: linear-gradient(180deg, #fff, #fff9eb);
    padding: 9px 13px;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(193, 146, 45, .12);
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.options-block button {
    border-radius: 11px;
}

#chat-options button:hover {
    transform: translateX(3px) translateY(-1px);
    box-shadow: 0 9px 20px rgba(193, 146, 45, .25);
    background: linear-gradient(180deg, #fffaf0, #f5df9f);
}

.chat-input-wrap {
    border-top: 1px solid #eee;
    background: #fff;
    padding: 8px;
}

.chat-input {
    display: flex;
    background: #fff;
    padding: 0;
    gap: 7px;
}

.chat-input input {
    flex: 1;
    min-width: 0;
    border: 1px solid #e2e2e2;
    border-radius: 999px;
    padding: 10px 13px;
    font-size: 13px;
    outline: none;
}

.chat-input input:focus {
    border-color: #c1922d;
    box-shadow: 0 0 0 3px rgba(193, 146, 45, .14);
}

.chat-input button {
    width: 42px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, #1f1a90, #d7ad19);
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}

.chat-input button:hover {
    transform: translateY(-1px) scale(1.04);
    box-shadow: 0 7px 14px rgba(193, 146, 45, .35);
}

.chat-input-error {
    display: none;
    margin: 6px 8px 0;
    color: #c62828;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
}

.chat-input-wrap.has-error .chat-input-error {
    display: block;
}

.chat-input-wrap.has-error input {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, .12);
    animation: inputErrorShake .22s ease;
}

body.modal-open #chatbot-launcher,
body.modal-open #property-chatbot {
    display: none !important;
}

@media (max-width: 767px) {
    #chatbot-launcher {
        right: 14px;
        bottom: 72px;
        width: 56px;
        height: 56px;
    }

    #chatbot-launcher img {
        width: 55px;
        height: 55px;
    }

    #property-chatbot {
        right: 10px;
        bottom: 132px;
        width: calc(100vw - 20px);
        height: 500px;
        max-height: calc(100vh - 150px);
    }

    .bot-text,
    .user-text {
        max-width: 230px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

@keyframes chatbotPulse {
    0% { opacity: .75; transform: scale(.82); }
    70%, 100% { opacity: 0; transform: scale(1.25); }
}

@keyframes chatbotOpen {
    from { opacity: 0; transform: translateY(18px) scale(.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes headerShine {
    0%, 55% { transform: translateX(-120%) rotate(20deg); }
    100% { transform: translateX(360%) rotate(20deg); }
}

@keyframes onlinePulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 211, 111, .7); }
    70%, 100% { box-shadow: 0 0 0 7px rgba(34, 211, 111, 0); }
}

@keyframes msgIn {
    from { opacity: 0; transform: translateY(8px) scale(.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes typingBlink {
    0%, 80%, 100% { opacity: .25; transform: translateY(0); }
    35% { opacity: 1; transform: translateY(-3px); }
}

@keyframes inputErrorShake {
    0%, 100% { transform: translateX(0); }
    35% { transform: translateX(-3px); }
    70% { transform: translateX(3px); }
}

@keyframes optionsIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
