
/* =====================================
   KW ASSISTANT — DESIGN SYSTEM
===================================== */

:root {
    --kw-red: #df1238;
    --kw-dark-red: #750b23;
    --kw-black: #101012;
    --kw-gray: #a1a1aa;
}

/* FLOATING BUTTON */

.kw-launcher {
    position: fixed;
    right: 28px;
    bottom: 28px;
    z-index: 3000;

    width: 62px;
    height: 62px;

    display: grid;
    place-items: center;

    background: linear-gradient(
        135deg,
        #ed1745,
        #680b1c
    );

    color: white;
    font-size: 29px;

    border: 1px solid #ff5577;
    border-radius: 20px;

    cursor: pointer;

    box-shadow: 0 0 30px #df123850;

    transition: transform 0.35s ease;

    animation: kwPulse 3s infinite;
}

.kw-launcher:hover {
    transform: scale(1.12) rotate(-5deg);
}

@keyframes kwPulse {
    0%, 100% {
        box-shadow: 0 0 20px #df123830;
    }

    50% {
        box-shadow: 0 0 40px #df123870;
    }
}

/* =====================================
   CHAT WINDOW
===================================== */

.kw-chat {
    position: fixed;
    right: 28px;
    bottom: 105px;
    z-index: 3000;

    width: 370px;
    height: 530px;
    max-height: calc(100dvh - 130px);

    display: flex;
    flex-direction: column;

    background: #111113;
    color: #f5f5f5;

    border: 1px solid #df123850;
    border-radius: 20px;

    overflow: hidden;

    box-shadow:
        0 20px 80px #000a,
        0 0 40px #df123815;

    opacity: 0;
    visibility: hidden;

    transform:
        translateY(25px)
        scale(0.95);

    transform-origin: bottom right;

    transition:
        opacity 0.3s,
        visibility 0.3s,
        transform 0.4s
        cubic-bezier(0.22, 1, 0.36, 1);
}

.kw-chat.open {
    opacity: 1;
    visibility: visible;

    transform:
        translateY(0)
        scale(1);
}

/* =====================================
   CHAT HEADER
===================================== */

.kw-header {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 20px;

    background:
        radial-gradient(
            ellipse at left,
            #510b20,
            #171217 80%
        );

    border-bottom: 1px solid #ffffff15;
}

.kw-avatar {
    width: 44px;
    height: 44px;

    display: grid;
    place-items: center;

    background: linear-gradient(
        135deg,
        #df1238,
        #750b23
    );

    border-radius: 14px;

    font-size: 25px;
    color: white;
}

.kw-header-info {
    flex: 1;
}

.kw-header-info h3 {
    font-size: 16px;
    margin: 0;
}

.kw-status {
    display: flex;
    align-items: center;
    gap: 6px;

    font-size: 11px;
    color: #b8b8bd;
    margin-top: 4px;
}

.kw-status-dot {
    width: 7px;
    height: 7px;

    background: #df1238;
    border-radius: 50%;

    box-shadow: 0 0 10px #df1238;
}

.kw-close {
    width: 32px;
    height: 32px;

    color: #aaa;
    background: transparent;
    border: none;

    font-size: 25px;
    cursor: pointer;

    transition: 0.3s;
}

.kw-close:hover {
    color: white;
    transform: rotate(90deg);
}

/* =====================================
   MESSAGE AREA
===================================== */

.kw-messages {
    flex: 1;

    display: flex;
    flex-direction: column;
    gap: 12px;

    padding: 18px;

    overflow-y: auto;
    overscroll-behavior: contain;

    scrollbar-width: thin;
    scrollbar-color: #750b23 #111113;
}

.kw-message {
    max-width: 88%;

    padding: 13px 15px;

    border-radius: 13px;

    font-size: 13px;
    line-height: 1.7;

    overflow-wrap: anywhere;
    white-space: pre-wrap;

    animation: kwMessageIn 0.35s ease both;
}

.kw-message.bot {
    align-self: flex-start;

    background: #222225;
    border: 1px solid #ffffff0d;

    border-bottom-left-radius: 3px;
}

.kw-message.user {
    align-self: flex-end;

    background: linear-gradient(
        135deg,
        #a91132,
        #680b1c
    );

    border-bottom-right-radius: 3px;
}

@keyframes kwMessageIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kw-message a {
    color: #ff8299;
    text-decoration: underline;
}

/* =====================================
   SUGGESTED QUESTIONS
===================================== */

.kw-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.kw-suggestion {
    padding: 8px 12px;

    background: #281118;
    color: #f7a2b4;

    border: 1px solid #df123840;
    border-radius: 20px;

    font-size: 11px;

    cursor: pointer;

    transition: 0.3s;
}

.kw-suggestion:hover {
    background: #df1238;
    color: white;
    transform: translateY(-2px);
}

/* =====================================
   TYPING INDICATOR
===================================== */

.kw-typing {
    display: flex;
    align-items: center;
    gap: 5px;

    align-self: flex-start;

    padding: 15px;

    background: #222225;
    border-radius: 12px;
}

.kw-typing span {
    width: 6px;
    height: 6px;

    background: #df1238;
    border-radius: 50%;

    animation: kwThinking 1s infinite;
}

.kw-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.kw-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes kwThinking {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

/* =====================================
   CHAT INPUT
===================================== */

.kw-input-area {
    display: flex;
    align-items: center;
    gap: 8px;

    padding: 14px;

    border-top: 1px solid #ffffff10;
}

.kw-input {
    flex: 1;
    min-width: 0;

    padding: 12px;

    background: #1d1d20;
    color: white;

    border: 1px solid #ffffff18;
    border-radius: 10px;

    font-family: inherit;
    font-size: 13px;

    outline: none;

    transition: 0.3s;
}

.kw-input:focus {
    border-color: #df1238;
    box-shadow: 0 0 15px #df123820;
}

.kw-send {
    width: 42px;
    height: 42px;

    flex-shrink: 0;

    background: #df1238;
    color: white;

    border: none;
    border-radius: 11px;

    font-size: 18px;

    cursor: pointer;

    transition: 0.3s;
}

.kw-send:hover {
    background: #ff2852;
    transform: scale(1.06);
}

.kw-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.kw-footer {
    text-align: center;
    padding: 0 10px 12px;

    color: #a1a1aa;
    font-size: 10px;
}

.kw-chat :focus-visible,
.kw-launcher:focus-visible {
    outline: 2px solid #ff8299;
    outline-offset: 3px;
}

/* =====================================
   RESPONSIVE DESIGN
===================================== */

@media (max-width: 480px) {

    .kw-launcher {
        right: 16px;
        bottom: 16px;
        width: 55px;
        height: 55px;
    }

    .kw-chat {
        right: 12px;
        bottom: 85px;

        width: calc(100vw - 24px);
        height: 500px;
        max-height: calc(100dvh - 100px);
    }
}

/* REDUCED MOTION */

@media (prefers-reduced-motion: reduce) {

    .kw-chat,
    .kw-chat *,
    .kw-launcher {
        animation: none !important;
        transition: none !important;
    }
}
