:root {
    --brand-red: #fa6262;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.2);
}

.kinbot-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #ff9d6e 0%, #fa6262 100%);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1100;
    box-shadow: 0 10px 25px rgba(250, 98, 98, 0.3);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.kinbot-launcher:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 35px rgba(250, 98, 98, 0.4);
}

.kinbot-launcher:active {
    transform: scale(0.95);
}

.kinbot-default-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s ease;
    opacity: 1;
    transform: scale(1);
}

.kinbot-launcher:hover .kinbot-default-content {
    opacity: 0;
    transform: scale(0.5);
    display: none;
}

.kinbot-label {
    color: white;
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
    letter-spacing: 0.5px;
}

.kinbot-smiley {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s ease;
    pointer-events: none;
}

.kinbot-launcher:hover .kinbot-smiley {
    opacity: 1;
    transform: scale(1);
}

.smiley-eyes {
    margin-bottom: 2px;
}

.smiley-mouth {
    margin-top: -4px;
}

.kinbot-typing {
    position: absolute;
    top: -5px;
    left: -15px;
    background: white;
    padding: 8px 12px;
    border-radius: 20px;
    display: flex;
    gap: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--brand-red);
    opacity: 1;
    transform: scale(1);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9999;
    pointer-events: none;
}

.kinbot-launcher:hover .kinbot-typing {
    opacity: 0;
    transform: scale(0);
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #fa6262;
    border-radius: 50%;
    animation: typingJump 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingJump {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

.chatbot-widget {
    position: fixed;
    right: 24px;
    bottom: 115px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 550px;
    max-height: calc(100vh - 160px);
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    display: none;
    flex-direction: column;
    z-index: 1100;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: widgetFadeIn 0.3s ease-out;
}

@keyframes widgetFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chatbot-widget.is-open {
    display: flex;
}

.chatbot-header {
    padding: 20px;
    background: var(--brand-red);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-avatar {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.chatbot-header button {
    border: 0;
    background: rgba(255, 255, 255, 0.2);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chatbot-header button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-line {
    margin: 0;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 85%;
    word-wrap: break-word;
}

.chat-line-user {
    background: var(--brand-red);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-line-assistant {
    background: #f1f1f1;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chatbot-form {
    display: flex;
    gap: 10px;
    padding: 15px 20px 20px;
    background: white;
}

.chatbot-form input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 30px;
    padding: 10px 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-form input:focus {
    border-color: var(--brand-red);
}

.chatbot-form button {
    border: 0;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    background: var(--brand-red);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.chatbot-form button:hover {
    transform: scale(1.05);
}

/* Avoid overlap with back-to-top button when it appears on scroll */
#button.show~.kinbot-launcher {
    bottom: 92px;
}

#button.show~.chatbot-widget {
    bottom: 183px;
}

@media (max-width: 768px) {
    .kinbot-launcher {
        right: 16px;
        bottom: 16px;
        width: 70px;
        height: 70px;
    }

    .chatbot-widget {
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }

    .chatbot-header {
        padding-top: env(safe-area-inset-top, 20px);
    }
}