/* =========================================================
   KIMU AI AGENT
========================================================= */

.kimu-ai-agent {
    position: fixed;

    right: 24px;
    top: 50%;

    z-index: 999999;

    font-family: inherit;

    transform: translateY(-50%);
}


/* =========================================================
   AI TOGGLE
========================================================= */

.kimu-ai-toggle {
    width: 62px;
    height: 62px;

    border: 0;
    border-radius: 50%;

    background: #22c55e;
    color: #ffffff;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 23px;

    cursor: pointer;

    position: relative;

    box-shadow:
        0 15px 35px rgba(34, 197, 94, 0.35);

    transition:
        transform 0.25s ease,
        background 0.25s ease;
}

.kimu-ai-toggle:hover {
    background: #16a34a;
    transform: translateY(-3px);
}


/* =========================================================
   ONLINE DOT
========================================================= */

.kimu-ai-pulse {
    position: absolute;

    top: 3px;
    right: 3px;

    width: 11px;
    height: 11px;

    border-radius: 50%;

    background: #ffffff;

    box-shadow:
        0 0 0 4px rgba(34, 197, 94, 0.35);
}


/* =========================================================
   AI WINDOW
========================================================= */

.kimu-ai-window {
    position: fixed;

    width: 380px;
    height: 560px;

    right: 102px;
    top: 50%;

    z-index: 999998;

    background: #ffffff;

    border: 1px solid #e5e7eb;
    border-radius: 22px;

    overflow: hidden;

    display: flex;
    flex-direction: column;

    box-shadow:
        0 25px 70px rgba(0, 0, 0, 0.20);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform:
        translateY(-50%)
        translateX(15px)
        scale(0.98);

    transform-origin: right center;

    transition:
        opacity 0.25s ease,
        visibility 0.25s ease,
        transform 0.25s ease;
}


/* =========================================================
   OPEN STATE
========================================================= */

.kimu-ai-window.active {
    opacity: 1;

    visibility: visible;

    pointer-events: auto;

    transform:
        translateY(-50%)
        translateX(0)
        scale(1);
}


/* =========================================================
   HEADER
========================================================= */

.kimu-ai-header {
    height: 76px;
    min-height: 76px;

    padding: 15px 17px;

    background: #111827;
    color: #ffffff;

    display: flex;
    align-items: center;
    justify-content: space-between;

    flex-shrink: 0;
}

.kimu-ai-brand {
    display: flex;
    align-items: center;

    gap: 10px;
}

.kimu-ai-avatar {
    width: 42px;
    height: 42px;

    border-radius: 13px;

    background: #22c55e;
    color: #ffffff;

    display: flex;
    align-items: center;
    justify-content: center;
}

.kimu-ai-brand strong {
    display: block;

    font-size: 15px;
}

.kimu-ai-brand span {
    display: block;

    margin-top: 2px;

    color: #9ca3af;

    font-size: 11px;
}

.kimu-ai-close {
    width: 34px;
    height: 34px;

    border: 0;
    border-radius: 50%;

    background: rgba(255, 255, 255, 0.08);

    color: #ffffff;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    transition: background 0.2s ease;
}

.kimu-ai-close:hover {
    background: rgba(255, 255, 255, 0.16);
}


/* =========================================================
   MESSAGES
========================================================= */

.kimu-ai-messages {
    flex: 1;

    min-height: 0;

    overflow-y: auto;

    padding: 18px;

    background: #f9fafb;
}

.kimu-ai-message {
    display: flex;

    gap: 9px;

    margin-bottom: 14px;
}

.kimu-ai-message.user {
    justify-content: flex-end;
}

.kimu-ai-message-icon {
    width: 31px;
    height: 31px;

    flex: 0 0 31px;

    border-radius: 10px;

    background: #dcfce7;
    color: #16a34a;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 12px;
}

.kimu-ai-bubble {
    max-width: 78%;

    padding: 11px 13px;

    border-radius: 14px;

    background: #ffffff;

    color: #374151;

    font-size: 13px;

    line-height: 1.55;

    box-shadow:
        0 3px 12px rgba(0, 0, 0, 0.04);
}

.kimu-ai-bubble p {
    margin: 0 0 6px;
}

.kimu-ai-bubble p:last-child {
    margin-bottom: 0;
}

.kimu-ai-message.user .kimu-ai-bubble {
    background: #22c55e;

    color: #ffffff;

    border-bottom-right-radius: 5px;
}

.kimu-ai-message.ai .kimu-ai-bubble {
    border-bottom-left-radius: 5px;
}


/* =========================================================
   QUICK ACTIONS
========================================================= */

.kimu-ai-quick-actions {
    display: grid;

    gap: 7px;

    margin-top: 12px;
}

.kimu-ai-quick-actions button {
    width: 100%;

    padding: 10px 12px;

    background: #ffffff;

    border: 1px solid #e5e7eb;

    border-radius: 10px;

    color: #374151;

    text-align: left;

    font-size: 12px;

    cursor: pointer;

    transition:
        border-color 0.2s ease,
        color 0.2s ease,
        background 0.2s ease;
}

.kimu-ai-quick-actions button:hover {
    border-color: #22c55e;

    color: #16a34a;

    background: #f0fdf4;
}

.kimu-ai-quick-actions i {
    width: 22px;

    color: #22c55e;
}


/* =========================================================
   LOCATION
========================================================= */

.kimu-ai-location {
    min-height: 40px;

    padding: 7px 12px;

    background: #ffffff;

    border-top: 1px solid #e5e7eb;

    display: flex;
    align-items: center;

    gap: 7px;

    color: #6b7280;

    font-size: 11px;

    flex-shrink: 0;
}

.kimu-ai-location > i {
    color: #22c55e;
}

.kimu-ai-location span {
    flex: 1;

    min-width: 0;
}

.kimu-ai-location button {
    border: 0;

    padding: 5px 8px;

    border-radius: 7px;

    background: #f0fdf4;

    color: #16a34a;

    font-size: 10px;

    font-weight: 700;

    cursor: pointer;
}

.kimu-ai-location button:disabled {
    opacity: 0.6;

    cursor: default;
}


/* =========================================================
   INPUT
========================================================= */

.kimu-ai-input {
    width: 100%;

    min-height: 66px;

    padding: 11px;

    background: #ffffff;

    border-top: 1px solid #e5e7eb;

    display: flex;
    align-items: center;

    gap: 7px;

    flex-shrink: 0;
}

.kimu-ai-input input {
    flex: 1;

    width: 100%;

    min-width: 0;

    height: 43px;

    padding: 0 13px;

    border: 1px solid #e5e7eb;

    border-radius: 11px;

    outline: none;

    font-family: inherit;

    font-size: 13px;

    background: #ffffff;
}

.kimu-ai-input input:focus {
    border-color: #22c55e;

    box-shadow:
        0 0 0 3px rgba(34, 197, 94, 0.10);
}

.kimu-ai-input button {
    width: 43px;
    height: 43px;

    flex: 0 0 43px;

    border: 0;

    border-radius: 11px;

    background: #22c55e;

    color: #ffffff;

    cursor: pointer;

    transition: background 0.2s ease;
}

.kimu-ai-input button:hover {
    background: #16a34a;
}


/* =========================================================
   TYPING
========================================================= */

.kimu-ai-typing {
    display: flex;

    align-items: center;

    gap: 4px;

    min-width: 45px;
}

.kimu-ai-typing span {
    width: 5px;
    height: 5px;

    background: #9ca3af;

    border-radius: 50%;

    animation:
        kimuTyping 1.2s infinite ease-in-out;
}

.kimu-ai-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.kimu-ai-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes kimuTyping {

    0%,
    60%,
    100% {
        transform: translateY(0);

        opacity: 0.45;
    }

    30% {
        transform: translateY(-4px);

        opacity: 1;
    }
}


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 900px) {

    .kimu-ai-agent {
        right: 18px;
    }

    .kimu-ai-window {
        width: 350px;

        right: 92px;
    }
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 600px) {

    .kimu-ai-agent {
        right: 15px;

        top: auto;
        bottom: 15px;

        transform: none;
    }

    .kimu-ai-toggle {
        width: 57px;
        height: 57px;

        font-size: 21px;
    }

    .kimu-ai-window {
        width: calc(100vw - 30px);

        height: min(560px, calc(100vh - 100px));

        max-height: calc(100vh - 100px);

        right: 15px;

        top: auto;
        bottom: 72px;

        border-radius: 20px;

        transform:
            translateY(15px)
            scale(0.98);

        transform-origin: bottom right;
    }

    .kimu-ai-window.active {
        transform:
            translateY(0)
            scale(1);
    }

    .kimu-ai-messages {
        padding: 15px;
    }

    .kimu-ai-bubble {
        max-width: 85%;
    }

    .kimu-ai-header {
        height: 70px;
        min-height: 70px;
    }

    .kimu-ai-input {
        min-height: 64px;
    }
}


/* =========================================================
   SMALL PHONES
========================================================= */

@media (max-width: 380px) {

    .kimu-ai-agent {
        right: 12px;

        bottom: 12px;
    }

    .kimu-ai-window {
        width: calc(100vw - 24px);

        height: calc(100vh - 90px);

        max-height: calc(100vh - 90px);

        right: 12px;

        bottom: 67px;
    }
}