/* =========================================================
   VHAK ONE-TO-ONE CHAT
   Premium Clean Chat UI
   ========================================================= */

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


/* =========================================================
   POPUP SHELL
   ========================================================= */

.vhak-chat-popup {
    position: fixed !important;

    right: 24px;
    bottom: 24px;

    width: 400px;
    height: 600px;

    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);

    display: none;
    flex-direction: column;

    overflow: hidden;

    background: #ffffff;

    border: 1px solid #e2e8f0;

    border-radius: 20px;

    box-shadow:
        0 24px 70px rgba(15, 23, 42, 0.20),
        0 8px 24px rgba(15, 23, 42, 0.10);

    z-index: 999999;

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;

    isolation: isolate;

    animation: vhak-chat-pop-in 0.22s ease-out;
}

@keyframes vhak-chat-pop-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .vhak-chat-popup {
        animation: none;
    }
}


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

.vhak-chat-header {
    position: relative;
    flex: 0 0 auto;

    min-height: 76px;

    padding: 12px 14px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 12px;

    background:
        linear-gradient(
            135deg,
            #2563eb 0%,
            #1d4ed8 100%
        );

    color: #ffffff;
}


/* Header top shine */

.vhak-chat-header::before {
    content: "";

    position: absolute;

    top: 0;
    left: 0;
    right: 0;

    height: 1px;

    background: rgba(255, 255, 255, 0.28);
}


/* Header bottom line */

.vhak-chat-header::after {
    content: "";

    position: absolute;

    left: 0;
    right: 0;
    bottom: 0;

    height: 1px;

    background: rgba(255, 255, 255, 0.14);
}


/* =========================================================
   USER AREA
   ========================================================= */

.vhak-chat-user {
    flex: 1 1 auto;
    min-width: 0;

    display: flex;

    align-items: center;

    gap: 12px;
}


/* =========================================================
   AVATAR
   ========================================================= */

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

    flex: 0 0 44px;

    display: flex;

    align-items: center;

    justify-content: center;

    overflow: hidden;

    border-radius: 50%;

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

    border:
        1px solid rgba(255, 255, 255, 0.30);

    color: #ffffff;

    font-size: 13px;

    font-weight: 700;

    letter-spacing: 0.3px;

    line-height: 1;

    box-shadow:
        inset 0 0 0 3px rgba(255, 255, 255, 0.04),
        0 4px 12px rgba(0, 0, 0, 0.10);
}

/*
 * When a real profile photo is shown, drop the translucent fill so
 * the photo isn't tinted, but keep the same ring/shadow treatment.
 */

.vhak-chat-avatar.has-image {
    background: rgba(255, 255, 255, 0.06);
}

.vhak-chat-avatar img {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;
    object-position: center;
}


/* =========================================================
   USER INFORMATION
   ========================================================= */

.vhak-chat-user-info {
    flex: 1 1 auto;
    min-width: 0;
}

/*
 * Text truncation is handled with a flexible flex/min-width:0
 * layout instead of hard-coded max-width values, so it stays
 * correct at every popup size without per-breakpoint overrides.
 */

.vhak-chat-header strong {
    display: block;

    width: 100%;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    color: #ffffff;

    font-size: 15px;

    font-weight: 700;

    line-height: 20px;
}

.vhak-chat-header small {
    display: block;

    width: 100%;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    margin-top: 3px;

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

    font-size: 11px;

    font-weight: 400;

    line-height: 16px;
}


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

#vhak-chat-close {
    width: 36px;
    height: 36px;

    flex: 0 0 36px;

    display: inline-flex;

    align-items: center;

    justify-content: center;

    padding: 0;
    margin: 0;

    border:
        1px solid rgba(255, 255, 255, 0.18);

    border-radius: 11px;

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

    color: #ffffff;

    cursor: pointer;

    -webkit-tap-highlight-color: transparent;

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

#vhak-chat-close span {
    display: block;

    font-size: 22px;

    font-weight: 300;

    line-height: 1;

    transform: translateY(-1px);
}

#vhak-chat-close:hover {
    background:
        rgba(255, 255, 255, 0.20);

    transform: scale(1.04);
}

#vhak-chat-close:active {
    transform: scale(0.96);
}

#vhak-chat-close:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}


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

.vhak-chat-messages {
    flex: 1 1 auto;

    min-height: 0;

    padding:
        20px
        16px
        14px;

    overflow-y: auto;
    overflow-x: hidden;

    background:
        linear-gradient(
            180deg,
            #f8fafc 0%,
            #f1f5f9 100%
        );

    scroll-behavior: smooth;

    -webkit-overflow-scrolling: touch;
}


/* =========================================================
   SCROLLBAR
   ========================================================= */

.vhak-chat-messages,
.vhak-chat-page-messages,
.vhak-chat-conversation-list {
    scrollbar-width: thin;

    scrollbar-color:
        #cbd5e1
        transparent;
}

.vhak-chat-messages::-webkit-scrollbar,
.vhak-chat-page-messages::-webkit-scrollbar,
.vhak-chat-conversation-list::-webkit-scrollbar {
    width: 6px;
}

.vhak-chat-messages::-webkit-scrollbar-track,
.vhak-chat-page-messages::-webkit-scrollbar-track,
.vhak-chat-conversation-list::-webkit-scrollbar-track {
    background: transparent;
}

.vhak-chat-messages::-webkit-scrollbar-thumb,
.vhak-chat-page-messages::-webkit-scrollbar-thumb,
.vhak-chat-conversation-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;

    border-radius: 20px;
}

.vhak-chat-messages::-webkit-scrollbar-thumb:hover,
.vhak-chat-page-messages::-webkit-scrollbar-thumb:hover,
.vhak-chat-conversation-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

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

.vhak-message {
    display: flex;
    flex-direction: column;

    width: 100%;

    margin: 3px 0 10px;

    animation: vhak-message-in 0.16s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .vhak-message {
        animation: none;
    }
}

@keyframes vhak-message-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vhak-message:last-child {
    margin-bottom: 0;
}

.vhak-message.mine {
    align-items: flex-end;
}

.vhak-message.other {
    align-items: flex-start;
}


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

.vhak-message-bubble {
    display: inline-block;

    /*
     * IMPORTANT:
     * No fixed/minimum width.
     * Bubble follows message content.
     */
    width: auto;

    min-width: 0;

    /*
     * Long messages can expand.
     */
    max-width: 78%;

    padding: 9px 14px;

    font-size: 13.5px;

    line-height: 19px;

    font-weight: 400;

    word-break: break-word;

    overflow-wrap: anywhere;

    /* white-space: pre-wrap; */

    text-align: left;

    border-radius: 17px;
}


/* =========================================================
   MY MESSAGE
   ========================================================= */

.vhak-message.mine .vhak-message-bubble {
    background: linear-gradient(
        135deg,
        #2563eb 0%,
        #1d4ed8 100%
    );

    color: #ffffff;

    border-radius:
        17px
        17px
        5px
        17px;

    box-shadow:
        0 3px 10px
        rgba(37, 99, 235, 0.18);
}


/* =========================================================
   OTHER USER MESSAGE
   ========================================================= */

.vhak-message.other .vhak-message-bubble {
    background: #ffffff;

    color: #1e293b;

    border: 1px solid #e2e8f0;

    border-radius:
        17px
        17px
        17px
        5px;

    box-shadow:
        0 2px 7px
        rgba(15, 23, 42, 0.05);
}


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

.vhak-message-time {
    margin-top: 4px;

    padding: 0 4px;

    color: #94a3b8;

    font-size: 10px;

    line-height: 14px;

    user-select: none;
}


/* =========================================================
   EMPTY / LOADING STATE
   ========================================================= */

.vhak-chat-empty {
    min-height: 100%;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 20px;

    color: #94a3b8;

    font-size: 13px;

    line-height: 19px;

    text-align: center;
}


/* =========================================================
   MESSAGE FORM / COMPOSER
   ========================================================= */

.vhak-chat-form {
    flex: 0 0 auto;

    display: flex;

    align-items: center;

    gap: 9px;

    padding: 12px;

    background: #ffffff;

    border-top:
        1px solid #e5e7eb;
}


/* =========================================================
   MESSAGE INPUT
   ========================================================= */

#vhak-chat-input {
    min-width: 0;

    flex: 1;

    height: 44px;

    padding:
        0 14px;

    border:
        1px solid #dbe2ea;

    border-radius: 13px;

    outline: none;

    background: #f8fafc;

    color: #1e293b;

    font-family: inherit;

    font-size: 14px;

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

#vhak-chat-input::placeholder {
    color: #94a3b8;
}

#vhak-chat-input:hover {
    border-color: #cbd5e1;
}

#vhak-chat-input:focus {
    background: #ffffff;

    border-color: #2563eb;

    box-shadow:
        0 0 0 3px
        rgba(37, 99, 235, 0.10);
}

#vhak-chat-input:disabled {
    opacity: 0.65;

    cursor: not-allowed;
}


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

.vhak-chat-form button {
    flex:
        0 0 auto;

    min-width: 72px;

    height: 44px;

    padding:
        0 16px;

    border: 0;

    border-radius: 13px;

    background:
        linear-gradient(
            135deg,
            #2563eb,
            #1d4ed8
        );

    color: #ffffff;

    cursor: pointer;

    font-family: inherit;

    font-size: 13px;

    font-weight: 650;

    -webkit-tap-highlight-color: transparent;

    box-shadow:
        0 5px 14px
        rgba(37, 99, 235, 0.22);

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

.vhak-chat-form button:hover {
    filter: brightness(1.04);

    transform:
        translateY(-1px);

    box-shadow:
        0 8px 18px
        rgba(37, 99, 235, 0.28);
}

.vhak-chat-form button:active {
    transform:
        translateY(0);

    filter: brightness(0.98);
}

.vhak-chat-form button:focus-visible {
    outline: 2px solid #1d4ed8;
    outline-offset: 2px;
}

.vhak-chat-form button:disabled {
    opacity: 0.60;

    cursor: not-allowed;

    transform: none;

    box-shadow: none;

    filter: none;
}


/* =========================================================
   PAGE CHAT BUTTON
   ========================================================= */

.vhak-chat-button,
.vhak-chat-btn {
    display: inline-flex !important;

    align-items: center;

    justify-content: center;

    gap: 5px;

    min-height: 34px;

    padding:
        7px 13px !important;

    border: 0 !important;

    border-radius: 9px !important;

    background:
        linear-gradient(
            135deg,
            #2563eb,
            #1d4ed8
        ) !important;

    color: #ffffff !important;

    cursor: pointer !important;

    font-size: 12px !important;

    font-weight: 600 !important;

    line-height: 18px !important;

    text-decoration: none !important;

    -webkit-tap-highlight-color: transparent;

    box-shadow:
        0 3px 8px
        rgba(37, 99, 235, 0.16);

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

.vhak-chat-button:hover,
.vhak-chat-btn:hover {
    color: #ffffff !important;

    filter: brightness(1.04);

    transform:
        translateY(-1px);

    box-shadow:
        0 5px 12px
        rgba(37, 99, 235, 0.22);
}

.vhak-chat-button:active,
.vhak-chat-btn:active {
    transform: translateY(0);

    filter: brightness(0.98);
}

.vhak-chat-button:focus-visible,
.vhak-chat-btn:focus-visible {
    outline: 2px solid #1d4ed8;
    outline-offset: 2px;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 768px) and (min-width: 601px) {

    .vhak-chat-popup {
        right: 16px;

        bottom: 16px;

        width: 360px;
    }
}


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

@media (max-width: 600px) {

    .vhak-chat-popup {
        right: 10px;

        bottom: 10px;

        width:
            calc(100vw - 20px);

        height:
            min(
                640px,
                calc(100vh - 20px)
            );

        max-width: none;

        max-height: none;

        border-radius: 17px;
    }


    .vhak-chat-messages {
        padding:
            16px
            12px
            12px;
    }


    .vhak-message-bubble {
        max-width: 86%;

        padding:
            10px
            13px;
    }
}


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

@media (max-width: 380px) {

    .vhak-chat-popup {
        right: 7px;

        bottom: 7px;

        width:
            calc(100vw - 14px);

        height:
            calc(100vh - 14px);

        border-radius: 15px;
    }


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

        padding:
            10px
            10px
            10px
            12px;
    }


    .vhak-chat-avatar {
        width: 40px;

        height: 40px;

        flex-basis: 40px;
    }


    .vhak-chat-header strong {
        font-size: 14px;
    }


    .vhak-chat-header small {
        font-size: 10px;
    }


    .vhak-message-bubble {
        max-width: 88%;

        padding: 8px 12px;

        font-size: 13px;

        line-height: 18px;
    }


    .vhak-chat-form {
        padding: 9px;
    }


    #vhak-chat-input {
        height: 42px;

        font-size: 13px;
    }


    .vhak-chat-form button {
        min-width: 62px;

        height: 42px;

        padding:
            0 11px;
    }
}

/* ========================================================================
   FULL CHAT PAGE: [vhak_chat_page]
   ======================================================================== */

.vhak-chat-page,
.vhak-chat-page * ,
.vhak-chat-page *::before,
.vhak-chat-page *::after {
    box-sizing: border-box !important;
}

.vhak-chat-page{
    width:100%;
    max-width:1180px;
    height:min(720px, calc(100vh - 60px));
    min-height:560px;
    margin:30px auto;
    display:flex;
    overflow:hidden;
    background:#fff;
    border:1px solid #e2e8f0;
    border-radius:18px;
    box-shadow:0 18px 50px rgba(15,23,42,.10),0 4px 16px rgba(15,23,42,.05);
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Sidebar ---------- */

.vhak-chat-sidebar{
    width:340px;
    flex:0 0 340px;
    display:flex;
    flex-direction:column;
    min-width:0;
    background:#fff;
    border-right:1px solid #e5e7eb;
}

.vhak-chat-sidebar-header{
    height:76px;
    flex:0 0 76px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:14px 16px;
    border-bottom:1px solid #e5e7eb;
}

.vhak-chat-sidebar-header h2{
    margin:0;
    color:#0f172a;
    font-size:19px;
    line-height:24px;
    font-weight:700;
}

.vhak-chat-sidebar-header p{
    margin:3px 0 0;
    color:#94a3b8;
    font-size:11px;
    line-height:16px;
}

.vhak-chat-page-refresh{
    width:36px;
    height:36px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:0;
    border:1px solid #dbe2ea;
    border-radius:10px;
    background:#f8fafc;
    color:#475569;
    font-size:20px;
    cursor:pointer;
    transition:.18s ease;
}

.vhak-chat-page-refresh:hover{
    background:#eff6ff;
    color:#2563eb;
    border-color:#bfdbfe;
    transform:rotate(12deg);
}

.vhak-chat-page-refresh:active{
    transform:rotate(12deg) scale(.94);
}

/* ---------- Conversation list ---------- */

.vhak-chat-conversation-list{
    flex:1;
    min-height:0;
    overflow-y:auto;
    padding:8px;
}

.vhak-chat-conversation-item{
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    gap: 12px;
    padding: 11px 10px !important;
    margin: 2px 0;
    border: 1px solid transparent;
    border-radius: 13px;
    background: transparent;
    text-align: left;
    font: inherit;
    line-height: normal;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.vhak-chat-conversation-item:hover{
    background:#f8fafc;
}

.vhak-chat-conversation-item.active{
    background:#eff6ff;
    border-color:#dbeafe;
}

.vhak-chat-conversation-item:focus-visible{
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

.vhak-chat-list-avatar{
    box-sizing: border-box !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    flex: 0 0 44px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    background:linear-gradient(135deg,#2563eb,#1d4ed8);
    color:#fff;
    font-size:12.5px;
    font-weight:700;
    letter-spacing:.3px;
    box-shadow: 0 2px 6px rgba(37,99,235,.18);
}

.vhak-chat-list-avatar img{
    width:100%;
    height:100%;
    object-fit:cover;
    object-position:center;
}

.vhak-chat-list-content{
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
}

.vhak-chat-list-top,
.vhak-chat-list-bottom{
    display: flex !important;
    align-items: center;
    gap:8px;
    min-width: 0 !important;
    width: 100%;
}

.vhak-chat-list-top{
    margin-bottom:3px;
}

.vhak-chat-list-top strong{
    flex:1;
        display: flex;
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    color:#0f172a;
    font-size:13.5px;
    font-weight:600;
}

.vhak-chat-list-top time{
    flex: 0 0 auto;
    color:#94a3b8;
    font-size:10.5px;
    white-space:nowrap;
}

.vhak-chat-list-preview{
    display:flex;
    flex:1;
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    color:#64748b;
    font-size:12px;
    line-height:16px;
}

.vhak-chat-conversation-item.active .vhak-chat-list-preview{
    color:#3b5cb8;
}

.vhak-chat-unread{
    flex:0 0 auto;
    min-width:19px;
    height:19px;
    padding:0 5px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:999px;
    background:linear-gradient(135deg,#2563eb,#1d4ed8);
    color:#fff;
    font-size:10px;
    font-weight:700;
    box-shadow: 0 2px 5px rgba(37,99,235,.25);
}

/* ---------- Main chat panel ---------- */

.vhak-chat-main{
    flex:1;
    min-width:0;
    min-height:0;
    display:flex;
    flex-direction:column;
    background:#f8fafc;
}

.vhak-chat-page-empty{
    flex:1;
    display:flex;
    align-items:center;
    justify-content:center;
    flex-direction:column;
    padding:30px;
    text-align:center;
}

.vhak-chat-page-empty-icon,
.vhak-chat-page-state-icon{
    width:54px;
    height:54px;
    margin:0 auto 12px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:50%;
    background:#eff6ff;
    color:#2563eb;
    font-size:22px;
}

.vhak-chat-page-empty h3{
    margin:0 0 5px;
    color:#0f172a;
    font-size:17px;
}

.vhak-chat-page-empty p{
    margin:0;
    color:#94a3b8;
    font-size:12px;
}

.vhak-chat-page-conversation{
    flex:1;
    min-height:0;
    display:flex;
    flex-direction:column;
}

.vhak-chat-page-header{
    height:76px;
    flex:0 0 76px;
    display:flex;
    align-items:center;
    gap:12px;
    padding:12px 18px;
    background:linear-gradient(135deg,#2563eb,#1d4ed8);
    color:#fff;
}

.vhak-chat-page-header .vhak-chat-avatar{
    width:44px;
    height:44px;
    flex-basis:44px;
}

.vhak-chat-page-user-info{
    min-width:0;
}

.vhak-chat-page-user-info strong{
    display:block;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    color:#fff;
    font-size:15px;
}

.vhak-chat-page-user-info small{
    display:block;
    margin-top:2px;
    color:rgba(255,255,255,.78);
    font-size:11px;
}

.vhak-chat-page-messages{
    flex:1;
    min-height:0;
    overflow-y:auto;
    padding:22px 24px 16px;
    background:linear-gradient(180deg,#f8fafc,#f1f5f9);
}

/* Day divider */

.vhak-page-day-divider{
    display:flex;
    align-items:center;
    justify-content:center;
    margin:6px 0 18px;
}

.vhak-page-day-divider span{
    padding:4px 12px;
    border-radius:999px;
    background:#ffffff;
    border:1px solid #e2e8f0;
    color:#94a3b8;
    font-size:10.5px;
    font-weight:600;
    letter-spacing:.2px;
    box-shadow: 0 1px 3px rgba(15,23,42,.04);
}

.vhak-page-message{
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    margin: 2px 0 10px;
    animation: vhak-message-in .16s ease-out;
}

@media (prefers-reduced-motion: reduce){
    .vhak-page-message{ animation:none; }
}

.vhak-page-message.mine{
    align-items: flex-end !important;
}

.vhak-page-message.other{
    align-items: flex-start !important;
}

.vhak-page-message.mine .vhak-page-message-bubble{
    background:linear-gradient(135deg,#2563eb,#1d4ed8);
    color:#fff;
    border-radius:17px 17px 5px 17px;
    box-shadow:0 4px 12px rgba(37,99,235,.18);
}

.vhak-page-message.other .vhak-page-message-bubble{
    background:#fff;
    color:#1e293b;
    border:1px solid #e2e8f0;
    border-radius:17px 17px 17px 5px;
    box-shadow:0 2px 8px rgba(15,23,42,.05);
}

.vhak-page-message-time{
    margin-top:4px;
    padding:0 4px;
    display:flex;
    align-items:center;
    gap:4px;
    color:#94a3b8;
    font-size:10px;
}

.vhak-page-message-tick{
    color:#2563eb;
    font-size:11px;
    line-height:1;
}

.vhak-chat-page-form{
    display:flex;
    align-items:center;
    gap:10px;
    padding:13px 16px;
    background:#fff;
    border-top:1px solid #e5e7eb;
}

.vhak-chat-page-form input{
    box-sizing: border-box !important;
    min-width: 0 !important;
    width: auto !important;
    flex: 1 1 auto !important;
    height: 46px !important;
    padding: 0 15px !important;
    margin: 0 !important;
    border:1px solid #dbe2ea;
    border-radius:13px;
    outline:none;
    background:#f8fafc;
    color:#1e293b;
    font-size:14px;
    font-family:inherit;
    transition:border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.vhak-chat-page-form input::placeholder{
    color:#94a3b8;
}

.vhak-chat-page-form input:hover{
    border-color:#cbd5e1;
}

.vhak-chat-page-form input:focus{
    background:#fff;
    border-color:#2563eb;
    box-shadow:0 0 0 3px rgba(37,99,235,.10);
}

.vhak-chat-page-form input:disabled{
    opacity:.65;
    cursor:not-allowed;
}

.vhak-chat-page-form button{
    height:46px;
    min-width:76px;
    padding:0 18px;
    border:0;
    border-radius:13px;
    background:linear-gradient(135deg,#2563eb,#1d4ed8);
    color:#fff;
    font-size:13px;
    font-weight:650;
    font-family:inherit;
    cursor:pointer;
    box-shadow:0 5px 14px rgba(37,99,235,.20);
    transition:transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.vhak-chat-page-form button:hover{
    filter:brightness(1.04);
    transform:translateY(-1px);
    box-shadow:0 8px 18px rgba(37,99,235,.28);
}

.vhak-chat-page-form button:active{
    transform:translateY(0);
    filter:brightness(.98);
}

.vhak-chat-page-form button:disabled{
    opacity:.6;
    cursor:not-allowed;
    transform:none;
    box-shadow:none;
    filter:none;
}

/* ---------- Shared state / login card ---------- */

.vhak-chat-page-state{
    min-height:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    flex-direction:column;
    gap:4px;
    padding:25px;
    color:#94a3b8;
    font-size:12px;
    text-align:center;
}

.vhak-chat-page-state strong{
    color:#64748b;
    font-size:13px;
}

.vhak-chat-page-state span{
    color:#94a3b8;
    font-size:11px;
}

.vhak-chat-page-login{
    width:100%;
    padding:50px 20px;
}

.vhak-chat-page-login-card{
    max-width:420px;
    margin:0 auto;
    padding:35px 25px;
    border:1px solid #e2e8f0;
    border-radius:18px;
    background:#fff;
    text-align:center;
    box-shadow:0 12px 35px rgba(15,23,42,.08);
}

.vhak-chat-page-login-icon{
    font-size:36px;
    margin-bottom:10px;
}

.vhak-chat-page-login-card h3{
    margin:0 0 6px;
    color:#0f172a;
}

.vhak-chat-page-login-card p{
    margin:0;
    color:#64748b;
    font-size:13px;
}

/* ---------- Responsive ---------- */

@media(max-width:1000px) and (min-width:801px){
    .vhak-chat-sidebar{
        width:300px;
        flex-basis:300px;
    }
}

@media(max-width:800px){
    .vhak-chat-page{
        height:calc(100vh - 40px);
        min-height:520px;
        margin:20px auto;
    }
    .vhak-chat-sidebar{
        width:290px;
        flex-basis:290px;
    }
    .vhak-page-message-bubble{
        max-width:78%;
    }
}

@media(max-width:650px){
    .vhak-chat-page{
        height:calc(100vh - 20px);
        min-height:0;
        margin:10px 0;
        border-radius:14px;
    }
    .vhak-chat-sidebar{
        width:92px;
        flex-basis:92px;
    }
    .vhak-chat-sidebar-header{
        justify-content:center;
    }
    .vhak-chat-sidebar-header>div{
        display:none;
    }
    .vhak-chat-conversation-item{
        justify-content:center;
        padding:9px 5px;
    }
    .vhak-chat-list-content{
        display:none;
    }
    .vhak-chat-list-avatar{
        width:46px;
        height:46px;
        flex-basis:46px;
    }
    .vhak-chat-page-messages{
        padding:18px 12px 12px;
    }
    .vhak-page-message-bubble{
        max-width:88%;
    }
    .vhak-chat-page-form{
        padding:10px;
    }
    .vhak-chat-page-form input{
        height:44px;
        font-size:13px;
    }
    .vhak-chat-page-form button{
        height:44px;
        min-width:64px;
        padding:0 13px;
    }
} 

/* =========================================================
   FIX: COMPACT MESSAGE BUBBLES
   ========================================================= */

.vhak-page-message-bubble {
    box-sizing: border-box !important;

    /* Remove unnecessary vertical space */
    padding: 6px 11px !important;

    width: fit-content !important;
    height: auto !important;
    min-height: 0 !important;

    font-size: 13px !important;
    line-height: 18px !important;

    margin: 0 !important;

    display: inline-flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;

    max-width: min(72%, 420px) !important;

    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    /* white-space: pre-wrap !important; */

    overflow: visible !important;
}


/* Text inside message */
.vhak-page-message-bubble p,
.vhak-page-message-bubble span {
    margin: 0 !important;
    padding: 0 !important;

    line-height: 18px !important;
}


/* Message time */
.vhak-page-message-bubble .vhak-page-message-time,
.vhak-page-message-time {
    margin: 2px 0 0 !important;
    padding: 0 !important;

    height: auto !important;
    min-height: 0 !important;

    font-size: 9px !important;
    line-height: 11px !important;

    display: flex !important;
    align-items: center !important;
    gap: 3px !important;
}


/* Remove theme/WordPress paragraph spacing */
.vhak-page-message-bubble p:last-child {
    margin-bottom: 0 !important;
}


/* Mine */
.vhak-page-message.mine .vhak-page-message-bubble {
    padding: 6px 11px 5px !important;

    border-radius: 15px 15px 4px 15px !important;
}


/* Other user */
.vhak-page-message.other .vhak-page-message-bubble {
    padding: 6px 11px 5px !important;

    border-radius: 15px 15px 15px 4px !important;
}


/* Very short messages: don't create unnecessary height */
.vhak-page-message-bubble br {
    line-height: 0 !important;
}


/* Mobile */
@media (max-width: 650px) {

    .vhak-page-message-bubble {
        max-width: min(85%, 420px) !important;
        padding: 6px 10px !important;
        font-size: 13px !important;
        line-height: 17px !important;
    }

    .vhak-page-message-bubble .vhak-page-message-time {
        font-size: 9px !important;
        line-height: 10px !important;
        margin-top: 2px !important;
    }
}

@media (max-width: 400px) {
    .vhak-page-message-bubble {
        max-width: min(92%, 420px) !important;
    }
}
/* =========================================================
   VHAK MESSAGES POPUP - FINAL UI
   ========================================================= */

.vhak-messages-popup,
.vhak-messages-popup *,
.vhak-messages-popup *::before,
.vhak-messages-popup *::after {
    box-sizing: border-box;
}

.vhak-messages-popup {
    position: fixed;
    inset: 0;

    z-index: 999998;

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

    padding: 24px;

    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(5px);
}


/* =========================================================
   MAIN POPUP
   ========================================================= */

.vhak-messages-popup-inner {
    width: min(1180px, 96vw);
    height: min(760px, 90vh);

    display: grid;

    grid-template-columns: 340px minmax(0, 1fr);

    overflow: hidden;

    background: #fff;

    border: 1px solid #e5e7eb;
    border-radius: 18px;

    box-shadow:
        0 30px 80px rgba(15, 23, 42, 0.25);

    animation: vhakMessagesPopupIn 0.2s ease-out;
}

@keyframes vhakMessagesPopupIn {

    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }

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


/* =========================================================
   LEFT SIDEBAR
   ========================================================= */

.vhak-messages-popup-inner .vhak-chat-sidebar {
    min-width: 0;
    height: 100%;

    display: flex;
    flex-direction: column;

    background: #ffffff;

    border-right: 1px solid #e5e7eb;
}


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

.vhak-messages-popup-inner .vhak-chat-sidebar-header {
    height: 78px;
    min-height: 78px;

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

    padding: 15px 18px;

    background: #ffffff;

    border-bottom: 1px solid #e5e7eb;
}

.vhak-messages-popup-inner .vhak-chat-sidebar-header h2 {
    margin: 0 0 3px;

    color: #111827;

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

    line-height: 1.2;
}

.vhak-messages-popup-inner .vhak-chat-sidebar-header p {
    margin: 0;

    color: #94a3b8;

    font-size: 11px;

    line-height: 1.4;
}


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

.vhak-messages-popup-inner .vhak-chat-page-refresh,
.vhak-messages-close {
    width: 38px;
    height: 38px;

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

    padding: 0;

    border: 1px solid #e2e8f0;
    border-radius: 8px;

    background: #ffffff;

    color: #64748b;

    font-size: 17px;

    cursor: pointer;

    transition: all 0.2s ease;
}

.vhak-messages-popup-inner .vhak-chat-page-refresh:hover {
    border-color: #2563eb;

    background: #eff6ff;

    color: #2563eb;
}

.vhak-messages-close:hover {
    border-color: #ef4444;

    background: #fef2f2;

    color: #ef4444;
}


/* =========================================================
   CONVERSATION LIST
   ========================================================= */

.vhak-messages-popup-inner .vhak-chat-conversation-list {
    flex: 1;

    min-height: 0;

    overflow-y: auto;

    padding: 8px;

    background: #ffffff;
}


/* =========================================================
   CONVERSATION ITEM
   ========================================================= */

.vhak-messages-popup-inner
.vhak-chat-conversation-item {

    width: 100%;
    min-height: 76px;

    display: flex;
    align-items: center;

    gap: 12px;

    padding: 11px 12px;

    margin: 0 0 4px;

    border: 1px solid transparent;
    border-radius: 8px;

    background: #ffffff;

    text-align: left;

    cursor: pointer;

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

.vhak-messages-popup-inner
.vhak-chat-conversation-item:hover {

    background: #f8fafc;
}


/* Active */

.vhak-messages-popup-inner
.vhak-chat-conversation-item.active {

    background: #eff6ff;

    border-color: #bfdbfe;
}


/* =========================================================
   AVATAR
   ========================================================= */

.vhak-messages-popup-inner
.vhak-chat-avatar {

    width: 46px;
    height: 46px;

    min-width: 46px;

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

    overflow: hidden;

    border-radius: 50%;

    background: #2563eb;

    color: #ffffff;

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

.vhak-messages-popup-inner
.vhak-chat-avatar img {

    width: 100%;
    height: 100%;

    object-fit: cover;
}


/* =========================================================
   CONVERSATION CONTENT
   ========================================================= */

.vhak-messages-popup-inner
.vhak-conversation-content {

    min-width: 0;
    flex: 1;
}

.vhak-messages-popup-inner
.vhak-conversation-top {

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

    gap: 8px;

    margin-bottom: 4px;
}

.vhak-messages-popup-inner
.vhak-conversation-name {

    min-width: 0;

    overflow: hidden;

    color: #111827;

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

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

.vhak-messages-popup-inner
.vhak-conversation-time {

    flex-shrink: 0;

    color: #94a3b8;

    font-size: 10px;
}

.vhak-messages-popup-inner
.vhak-conversation-preview {

    display: flex;
    align-items: center;

    gap: 5px;
}

.vhak-messages-popup-inner
.vhak-conversation-last-message {

    min-width: 0;
    flex: 1;

    overflow: hidden;

    color: #64748b;

    font-size: 12px;

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


/* =========================================================
   UNREAD
   ========================================================= */

.vhak-messages-popup-inner
.vhak-unread-badge {

    min-width: 19px;
    height: 19px;

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

    padding: 0 5px;

    border-radius: 50px;

    background: #2563eb;

    color: #ffffff;

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


/* =========================================================
   RIGHT CHAT AREA
   ========================================================= */

.vhak-messages-popup-inner .vhak-chat-main {

    min-width: 0;
    min-height: 0;

    height: 100%;

    display: flex;
    flex-direction: column;

    background: #f8fafc;
}


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

.vhak-messages-popup-inner
.vhak-chat-page-header {

    height: 76px;
    min-height: 76px;

    flex-shrink: 0;

    display: flex;
    align-items: center;

    gap: 12px;

    padding: 12px 18px;

    background: #2563eb;

    border-bottom: 1px solid #1d4ed8;
}


/* Header avatar */

.vhak-messages-popup-inner
.vhak-chat-page-header
.vhak-chat-avatar {

    width: 44px;
    height: 44px;

    min-width: 44px;

    border: 1px solid rgba(255,255,255,0.35);

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

    color: #ffffff;
}


/* User info */

.vhak-messages-popup-inner
.vhak-chat-page-user-info {

    min-width: 0;

    display: flex;
    flex-direction: column;

    gap: 3px;
}

.vhak-messages-popup-inner
.vhak-chat-page-user-info strong {

    overflow: hidden;

    color: #ffffff;

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

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

.vhak-messages-popup-inner
.vhak-chat-page-user-info small {

    color: rgba(255,255,255,0.82);

    font-size: 10px;
}


/* =========================================================
   MESSAGE AREA
   ========================================================= */

.vhak-messages-popup-inner
.vhak-chat-page-conversation {

    min-width: 0;
    min-height: 0;

    height: 100%;

    display: flex;
    flex-direction: column;
}


/*
 * IMPORTANT:
 * Full width message rows.
 */

.vhak-messages-popup-inner
.vhak-chat-page-messages {

    flex: 1;

    min-height: 0;

    overflow-y: auto;

    padding: 24px 26px;

    background:
        radial-gradient(
            circle at 15% 20%,
            rgba(37, 99, 235, 0.035),
            transparent 35%
        ),
        #f8fafc;
}


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

.vhak-messages-popup-inner
.vhak-page-message {

    width: 100%;
    max-width: 100%;

    display: flex;
    flex-direction: column;

    margin: 3px 0 14px;
}


/* Other */

.vhak-messages-popup-inner
.vhak-page-message.other {

    align-items: flex-start;
}


/* Mine */

.vhak-messages-popup-inner
.vhak-page-message.mine {

    align-items: flex-end;
}


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

/* Other message */

.vhak-messages-popup-inner
.vhak-page-message.other
.vhak-page-message-bubble {

    background: #ffffff;

    border: 1px solid #e2e8f0;

    color: #1e293b;

    border-bottom-left-radius: 4px;
}


/* Mine message */

.vhak-messages-popup-inner
.vhak-page-message.mine
.vhak-page-message-bubble {

    background: #2563eb;

    color: #ffffff;

    border-bottom-right-radius: 4px;
}


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

.vhak-messages-popup-inner
.vhak-page-message-meta {

    display: flex;
    align-items: center;

    gap: 4px;

    margin-top: 4px;

    color: #94a3b8;

    font-size: 9px;
}

.vhak-messages-popup-inner
.vhak-page-message.mine
.vhak-page-message-meta {

    justify-content: flex-end;
}


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

.vhak-messages-popup-inner
.vhak-chat-page-form {

    min-height: 74px;

    flex-shrink: 0;

    display: flex;
    align-items: center;

    gap: 10px;

    padding: 12px 16px;

    background: #ffffff;

    border-top: 1px solid #e5e7eb;
}


/* Input */

.vhak-messages-popup-inner
.vhak-chat-page-form input {

    flex: 1;

    min-width: 0;

    height: 46px;

    padding: 0 15px;

    border: 1px solid #dbe2ea;

    border-radius: 8px;

    outline: none;

    background: #ffffff;

    color: #1e293b;

    font-size: 13px;

    box-shadow: none;

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

.vhak-messages-popup-inner
.vhak-chat-page-form input::placeholder {

    color: #94a3b8;
}

.vhak-messages-popup-inner
.vhak-chat-page-form input:focus {

    border-color: #2563eb;

    box-shadow:
        0 0 0 3px rgba(37,99,235,0.08);
}


/* Send */

.vhak-messages-popup-inner
.vhak-chat-page-form button {

    height: 46px;

    min-width: 78px;

    padding: 0 18px;

    border: 0;

    border-radius: 9px;

    background: #2563eb;

    color: #ffffff;

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

    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.15s ease;
}

.vhak-messages-popup-inner
.vhak-chat-page-form button:hover {

    background: #1d4ed8;
}

.vhak-messages-popup-inner
.vhak-chat-page-form button:active {

    transform: scale(0.97);
}


/* =========================================================
   EMPTY / LOADING
   ========================================================= */

.vhak-messages-popup-inner
.vhak-chat-page-state {

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

    min-height: 120px;

    padding: 30px;

    color: #94a3b8;

    font-size: 13px;

    text-align: center;
}


/* =========================================================
   SCROLLBARS
   ========================================================= */

.vhak-messages-popup-inner
.vhak-chat-conversation-list::-webkit-scrollbar,
.vhak-messages-popup-inner
.vhak-chat-page-messages::-webkit-scrollbar {

    width: 6px;
}

.vhak-messages-popup-inner
.vhak-chat-conversation-list::-webkit-scrollbar-track,
.vhak-messages-popup-inner
.vhak-chat-page-messages::-webkit-scrollbar-track {

    background: transparent;
}

.vhak-messages-popup-inner
.vhak-chat-conversation-list::-webkit-scrollbar-thumb,
.vhak-messages-popup-inner
.vhak-chat-page-messages::-webkit-scrollbar-thumb {

    background: #cbd5e1;

    border-radius: 20px;
}

.vhak-messages-popup-inner
.vhak-chat-conversation-list::-webkit-scrollbar-thumb:hover,
.vhak-messages-popup-inner
.vhak-chat-page-messages::-webkit-scrollbar-thumb:hover {

    background: #94a3b8;
}


/* =========================================================
   SMALL LAPTOP / NARROW WINDOW
   ========================================================= */

@media (max-width: 1000px) and (min-width: 751px) {

    .vhak-messages-popup-inner {
        grid-template-columns: 280px minmax(0, 1fr);
    }
}


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

@media (max-width: 750px) {

    .vhak-messages-popup {
        padding: 0;
    }

    .vhak-messages-popup-inner {

        width: 100%;
        height: 100%;

        grid-template-columns: 1fr;

        border-radius: 0;
    }

    .vhak-messages-popup-inner
    .vhak-chat-main {

        display: none;
    }

    .vhak-messages-popup-inner.mobile-chat-open
    .vhak-chat-sidebar {

        display: none;
    }

    .vhak-messages-popup-inner.mobile-chat-open
    .vhak-chat-main {

        display: flex;
    }

    .vhak-messages-popup-inner
    .vhak-page-message-bubble {

        max-width: 82%;
    }
}

/* =========================================================
   CHAT DATE DIVIDER
   ========================================================= */

.vhak-page-day-divider {
    width: 100% !important;

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

    margin: 14px 0 18px !important;

    position: relative !important;

    clear: both !important;
}

.vhak-page-day-divider::before,
.vhak-page-day-divider::after {
    content: "" !important;

    flex: 1 !important;

    height: 1px !important;

    background: #e2e8f0 !important;
}

.vhak-page-day-divider span {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    margin: 0 12px !important;
    padding: 5px 11px !important;

    background: #e2e8f0 !important;

    color: #64748b !important;

    border-radius: 999px !important;

    font-size: 10px !important;
    font-weight: 600 !important;

    line-height: 14px !important;

    white-space: nowrap !important;
}

/* =========================================================
   MESSAGE READ TICKS
   ========================================================= */

.vhak-page-message-tick {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;

    font-size: 11px;
    line-height: 1;

    font-weight: 700;

    vertical-align: middle;
}

/* Message sent but not seen */
.vhak-page-message-tick.sent {
    color: #94a3b8;
}

/* Message seen */
.vhak-page-message-tick.seen {
    color: #2563eb;
}