/*
 * =========================================================
 * KOIR FLEX WEBSITE CHAT
 * chat.css
 * =========================================================
 */


/* =========================================================
   BASE
   ========================================================= */

.kf-chat {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99999;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;
}


.kf-chat *,
.kf-chat *::before,
.kf-chat *::after {
    box-sizing: border-box;
}


/* =========================================================
   SCREEN READER ONLY
   ========================================================= */

.kf-chat-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}


/* =========================================================
   LAUNCHER
   ========================================================= */

.kf-chat-launcher {
    position: relative;
    width: 62px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 50%;

    background:
        linear-gradient(
            135deg,
            #1d4f83 0%,
            #2f7fc1 100%
        );

    color: #ffffff;

    box-shadow:
        0 14px 35px rgba(16, 47, 80, 0.30);

    cursor: pointer;

    transition:
        transform 0.22s ease,
        box-shadow 0.22s ease,
        opacity 0.22s ease;
}


.kf-chat-launcher:hover {
    transform: translateY(-3px) scale(1.03);

    box-shadow:
        0 18px 42px rgba(16, 47, 80, 0.38);
}


.kf-chat-launcher:active {
    transform: scale(0.97);
}


.kf-chat-launcher:focus-visible {
    outline: 3px solid rgba(55, 167, 217, 0.35);
    outline-offset: 4px;
}


.kf-chat-launcher-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}


.kf-chat-launcher-icon svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}


/* =========================================================
   LAUNCHER BADGE
   ========================================================= */

.kf-chat-launcher-badge {
    position: absolute;
    top: -3px;
    right: -2px;

    min-width: 20px;
    height: 20px;

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

    padding: 0 5px;

    border: 2px solid #ffffff;
    border-radius: 999px;

    background: #e5484d;

    color: #ffffff;

    font-size: 11px;
    font-weight: 800;

    line-height: 1;
}


/* =========================================================
   WINDOW
   ========================================================= */

.kf-chat-window {
    position: absolute;
    right: 0;
    bottom: 78px;

    width: 390px;
    height: min(640px, calc(100vh - 130px));

    display: flex;
    flex-direction: column;

    overflow: hidden;

    background: #ffffff;

    border:
        1px solid rgba(16, 47, 80, 0.10);

    border-radius: 22px;

    box-shadow:
        0 24px 70px rgba(11, 34, 57, 0.22);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform:
        translateY(14px)
        scale(0.985);

    transform-origin:
        bottom right;

    transition:
        opacity 0.22s ease,
        transform 0.22s ease,
        visibility 0.22s ease;
}


.kf-chat-window.kf-chat-window--open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    transform:
        translateY(0)
        scale(1);
}


/* =========================================================
   HEADER
   ========================================================= */

.kf-chat-header {
    min-height: 76px;

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

    gap: 15px;

    padding: 14px 16px;

    background:
        linear-gradient(
            135deg,
            #0b2239 0%,
            #102f50 55%,
            #1d4f83 100%
        );

    color: #ffffff;

    flex-shrink: 0;
}


.kf-chat-brand {
    min-width: 0;

    display: flex;
    align-items: center;

    gap: 12px;
}


.kf-chat-avatar {
    width: 44px;
    height: 44px;

    flex: 0 0 44px;

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

    border-radius: 14px;

    background:
        linear-gradient(
            135deg,
            #37a7d9 0%,
            #2f7fc1 100%
        );

    color: #ffffff;

    font-size: 14px;
    font-weight: 900;

    letter-spacing: 0.3px;

    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.14);
}


.kf-chat-brand-copy {
    min-width: 0;

    display: flex;
    flex-direction: column;

    gap: 4px;
}


.kf-chat-title {
    display: block;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: 15px;
    font-weight: 800;

    line-height: 1.2;
}


.kf-chat-status {
    display: flex;
    align-items: center;

    gap: 6px;

    font-size: 11px;
    font-weight: 600;

    color: rgba(255, 255, 255, 0.78);
}


.kf-chat-status-dot {
    width: 7px;
    height: 7px;

    display: inline-block;

    border-radius: 50%;

    background: #58d68d;

    box-shadow:
        0 0 0 3px rgba(88, 214, 141, 0.12);
}


/* =========================================================
   CLOSE
   ========================================================= */

.kf-chat-close {
    width: 36px;
    height: 36px;

    flex: 0 0 36px;

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

    border: 0;
    border-radius: 10px;

    background: rgba(255, 255, 255, 0.08);

    color: #ffffff;

    cursor: pointer;

    transition:
        background 0.18s ease,
        transform 0.18s ease;
}


.kf-chat-close:hover {
    background: rgba(255, 255, 255, 0.16);
}


.kf-chat-close:active {
    transform: scale(0.94);
}


.kf-chat-close svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}


/* =========================================================
   MESSAGES AREA
   ========================================================= */

.kf-chat-messages {
    flex: 1;

    min-height: 0;

    overflow-y: auto;
    overscroll-behavior: contain;

    padding: 18px 16px 14px;

    background:
        linear-gradient(
            180deg,
            #f8fbfd 0%,
            #f4f7fa 100%
        );

    scrollbar-width: thin;

    scrollbar-color:
        rgba(16, 47, 80, 0.18)
        transparent;
}


.kf-chat-messages::-webkit-scrollbar {
    width: 6px;
}


.kf-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}


.kf-chat-messages::-webkit-scrollbar-thumb {
    border-radius: 999px;

    background:
        rgba(16, 47, 80, 0.18);
}


/* =========================================================
   MESSAGE ROW
   ========================================================= */

.kf-chat-message {
    width: 100%;

    display: flex;

    margin-bottom: 12px;
}


.kf-chat-message--bot {
    justify-content: flex-start;
}


.kf-chat-message--user {
    justify-content: flex-end;
}


/* =========================================================
   MESSAGE BUBBLE
   ========================================================= */

.kf-chat-bubble {
    max-width: 82%;

    padding: 11px 13px;

    border-radius: 16px;

    font-size: 13px;
    line-height: 1.55;

    word-break: break-word;
}


.kf-chat-message--bot .kf-chat-bubble {
    background: #ffffff;

    color: #23394d;

    border:
        1px solid rgba(16, 47, 80, 0.08);

    border-bottom-left-radius: 5px;

    box-shadow:
        0 6px 18px rgba(16, 47, 80, 0.06);
}


.kf-chat-message--user .kf-chat-bubble {
    background:
        linear-gradient(
            135deg,
            #1d4f83 0%,
            #2f7fc1 100%
        );

    color: #ffffff;

    border-bottom-right-radius: 5px;

    box-shadow:
        0 7px 18px rgba(29, 79, 131, 0.16);
}


/* =========================================================
   MESSAGE TIME
   ========================================================= */

.kf-chat-message-time {
    display: block;

    margin-top: 6px;

    font-size: 10px;

    opacity: 0.55;
}


/* =========================================================
   POPULAR / QUICK REPLY BUTTONS
   ========================================================= */

.kf-chat-quick-title {
    margin:
        6px 0 8px;

    color: #6f8293;

    font-size: 11px;
    font-weight: 800;

    text-transform: uppercase;

    letter-spacing: 0.5px;
}


.kf-chat-quick-list {
    display: flex;
    flex-direction: column;

    gap: 7px;

    margin-bottom: 14px;
}


.kf-chat-quick-button {
    width: 100%;

    padding: 10px 12px;

    border:
        1px solid rgba(47, 127, 193, 0.18);

    border-radius: 11px;

    background: #ffffff;

    color: #1d4f83;

    text-align: left;

    font-size: 12px;
    font-weight: 700;

    line-height: 1.35;

    cursor: pointer;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease;
}


.kf-chat-quick-button:hover {
    background: #f3f8fc;

    border-color:
        rgba(47, 127, 193, 0.34);

    transform:
        translateY(-1px);
}


/* =========================================================
   CREATE REQUEST CTA
   ========================================================= */

.kf-chat-request-offer {
    margin:
        6px 0 14px;

    padding: 13px;

    border:
        1px solid rgba(47, 127, 193, 0.15);

    border-radius: 14px;

    background: #ffffff;

    box-shadow:
        0 6px 18px rgba(16, 47, 80, 0.05);
}


.kf-chat-request-offer-text {
    margin-bottom: 10px;

    color: #4e6476;

    font-size: 12px;
    line-height: 1.5;
}


.kf-chat-request-button {
    width: 100%;

    min-height: 40px;

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

    padding: 9px 14px;

    border: 0;
    border-radius: 10px;

    background:
        linear-gradient(
            135deg,
            #1d4f83 0%,
            #2f7fc1 100%
        );

    color: #ffffff;

    font-size: 12px;
    font-weight: 800;

    cursor: pointer;

    box-shadow:
        0 8px 18px rgba(29, 79, 131, 0.15);

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease;
}


.kf-chat-request-button:hover {
    transform:
        translateY(-1px);

    box-shadow:
        0 10px 22px rgba(29, 79, 131, 0.21);
}


/* =========================================================
   TYPING
   ========================================================= */

.kf-chat-typing {
    display: flex;
    align-items: center;

    gap: 9px;

    padding:
        10px 16px;

    background: #f4f7fa;

    border-top:
        1px solid rgba(16, 47, 80, 0.06);

    flex-shrink: 0;
}


.kf-chat-typing[hidden] {
    display: none;
}


.kf-chat-typing-avatar {
    width: 28px;
    height: 28px;

    flex: 0 0 28px;

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

    border-radius: 9px;

    background:
        linear-gradient(
            135deg,
            #1d4f83,
            #37a7d9
        );

    color: #ffffff;

    font-size: 9px;
    font-weight: 900;
}


.kf-chat-typing-content {
    display: flex;
    flex-direction: column;

    gap: 3px;
}


.kf-chat-typing-dots {
    display: flex;
    align-items: center;

    gap: 3px;
}


.kf-chat-typing-dots span {
    width: 5px;
    height: 5px;

    display: block;

    border-radius: 50%;

    background: #71879a;

    animation:
        kfChatTyping 1.2s infinite ease-in-out;
}


.kf-chat-typing-dots span:nth-child(2) {
    animation-delay: 0.14s;
}


.kf-chat-typing-dots span:nth-child(3) {
    animation-delay: 0.28s;
}


.kf-chat-typing small {
    color: #8293a1;

    font-size: 10px;
}


/* =========================================================
   FORM INPUT AREA
   ========================================================= */

.kf-chat-form {
    display: flex;
    align-items: flex-end;

    gap: 9px;

    padding:
        12px 13px;

    background: #ffffff;

    border-top:
        1px solid rgba(16, 47, 80, 0.08);

    flex-shrink: 0;
}


.kf-chat-input {
    width: 100%;

    min-height: 42px;
    max-height: 110px;

    resize: none;

    padding:
        10px 12px;

    border:
        1px solid #dbe4eb;

    border-radius: 13px;

    background: #f8fafc;

    color: #263746;

    outline: 0;

    font-family: inherit;
    font-size: 13px;

    line-height: 1.45;

    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease;
}


.kf-chat-input:focus {
    border-color: #2f7fc1;

    background: #ffffff;

    box-shadow:
        0 0 0 3px rgba(47, 127, 193, 0.10);
}


.kf-chat-input::placeholder {
    color: #91a0ac;
}


/* =========================================================
   SEND
   ========================================================= */

.kf-chat-send {
    width: 42px;
    height: 42px;

    flex: 0 0 42px;

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

    border: 0;
    border-radius: 12px;

    background:
        linear-gradient(
            135deg,
            #1d4f83 0%,
            #2f7fc1 100%
        );

    color: #ffffff;

    cursor: pointer;

    transition:
        transform 0.18s ease,
        opacity 0.18s ease;
}


.kf-chat-send:hover {
    transform: translateY(-1px);
}


.kf-chat-send:active {
    transform: scale(0.96);
}


.kf-chat-send:disabled {
    opacity: 0.45;
    cursor: default;
    transform: none;
}


.kf-chat-send svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}


/* =========================================================
   REQUEST FORM INSIDE CHAT
   ========================================================= */

.kf-chat-request-form {
    margin:
        6px 0 14px;

    padding: 14px;

    border:
        1px solid rgba(16, 47, 80, 0.10);

    border-radius: 15px;

    background: #ffffff;

    box-shadow:
        0 8px 24px rgba(16, 47, 80, 0.06);
}


.kf-chat-request-form h3 {
    margin:
        0 0 6px;

    color: #173b5e;

    font-size: 14px;
    font-weight: 800;
}


.kf-chat-request-form-description {
    margin:
        0 0 14px;

    color: #687b8a;

    font-size: 11px;
    line-height: 1.5;
}


.kf-chat-field {
    margin-bottom: 10px;
}


.kf-chat-field label {
    display: block;

    margin-bottom: 5px;

    color: #4d6273;

    font-size: 11px;
    font-weight: 700;
}


.kf-chat-field input,
.kf-chat-field textarea {
    width: 100%;

    padding:
        9px 10px;

    border:
        1px solid #dce5eb;

    border-radius: 9px;

    background: #fafcfd;

    color: #263746;

    outline: 0;

    font-family: inherit;

    font-size: 12px;

    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}


.kf-chat-field input:focus,
.kf-chat-field textarea:focus {
    border-color: #2f7fc1;

    box-shadow:
        0 0 0 3px rgba(47, 127, 193, 0.08);
}


.kf-chat-field textarea {
    min-height: 82px;
    resize: vertical;
}


.kf-chat-request-submit {
    width: 100%;

    min-height: 42px;

    margin-top: 3px;

    border: 0;
    border-radius: 10px;

    background:
        linear-gradient(
            135deg,
            #1d4f83 0%,
            #2f7fc1 100%
        );

    color: #ffffff;

    font-size: 12px;
    font-weight: 800;

    cursor: pointer;
}


.kf-chat-request-submit:disabled {
    opacity: 0.55;
    cursor: default;
}


/* =========================================================
   FORM ERROR
   ========================================================= */

.kf-chat-form-error {
    margin-bottom: 10px;

    padding: 9px 10px;

    border-radius: 8px;

    background: #fff3f3;

    color: #b42318;

    font-size: 11px;

    line-height: 1.4;
}


/* =========================================================
   SUCCESS
   ========================================================= */

.kf-chat-success {
    margin:
        6px 0 14px;

    padding: 14px;

    border:
        1px solid rgba(41, 151, 99, 0.16);

    border-radius: 14px;

    background: #f3fbf7;

    color: #256c49;

    font-size: 12px;
    font-weight: 700;

    line-height: 1.55;
}


/* =========================================================
   FOOTER
   ========================================================= */

.kf-chat-footer {
    min-height: 29px;

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

    gap: 5px;

    padding:
        6px 10px;

    border-top:
        1px solid rgba(16, 47, 80, 0.06);

    background: #ffffff;

    color: #9aa8b3;

    font-size: 9px;
    font-weight: 600;

    flex-shrink: 0;
}


/* =========================================================
   RTL
   ========================================================= */

.kf-chat[dir="rtl"] .kf-chat-brand {
    flex-direction: row-reverse;
}


.kf-chat[dir="rtl"] .kf-chat-header {
    flex-direction: row-reverse;
}


.kf-chat[dir="rtl"] .kf-chat-message--bot {
    justify-content: flex-start;
}


.kf-chat[dir="rtl"] .kf-chat-message--user {
    justify-content: flex-end;
}


.kf-chat[dir="rtl"] .kf-chat-quick-button {
    text-align: right;
}


.kf-chat[dir="rtl"] .kf-chat-field label {
    text-align: right;
}


/* =========================================================
   ANIMATIONS
   ========================================================= */

@keyframes kfChatTyping {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.45;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 640px) {

    .kf-chat {
        right: 14px;
        bottom: 14px;
    }


    .kf-chat-launcher {
        width: 56px;
        height: 56px;
    }


    .kf-chat-launcher-icon svg {
        width: 25px;
        height: 25px;
    }


    .kf-chat-window {
        position: fixed;

        left: 10px;
        right: 10px;
        bottom: 80px;

        width: auto;

        height:
            min(
                680px,
                calc(100dvh - 100px)
            );

        border-radius: 18px;

        transform-origin: bottom center;
    }

}


/* =========================================================
   VERY SMALL MOBILE
   ========================================================= */

@media (max-width: 420px) {

    .kf-chat-window {
        left: 6px;
        right: 6px;
        bottom: 72px;

        height:
            calc(100dvh - 84px);

        border-radius: 16px;
    }


    .kf-chat-header {
        min-height: 70px;

        padding:
            12px 13px;
    }


    .kf-chat-messages {
        padding:
            15px 12px 12px;
    }


    .kf-chat-form {
        padding:
            10px;
    }


    .kf-chat-bubble {
        max-width: 88%;
    }

}