/* ============================================
   NEXGEN LIVE CHAT - SCOPED STYLES
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

#nexgen-chat {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#nexgen-chat * {
    box-sizing: border-box;
}

/* ============================================================
   LAUNCHER BUTTON — Circular Icon Button (no label)
   ============================================================ */

/* Pulse ring behind the button */
#nexgen-chat .chat-button::before {
    content: '';
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid rgba(14, 90, 198, 0.45);
    animation: nexPulseRing 2.4s ease-out infinite;
    z-index: -1;
}

@keyframes nexPulseRing {
    0%   { transform: scale(0.9);  opacity: 1; }
    70%  { transform: scale(1.35); opacity: 0; }
    100% { transform: scale(1.35); opacity: 0; }
}

#nexgen-chat .chat-button {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 60px;
    height: 60px;
    padding: 0;
    background: linear-gradient(145deg, #1a7fe8 0%, #0e5ac6 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    cursor: pointer;
    box-shadow:
        0 6px 24px rgba(14, 90, 198, 0.55),
        0 2px 8px rgba(0, 0, 0, 0.18),
        inset 0 2px 0 rgba(255,255,255,0.2);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10000;
    color: white;
    border: none;
    margin: 0;
    overflow: visible;
}

/* Sheen removed — was causing oval bleed outside circle */

/* Hide the text label — circle button has icon only */
#nexgen-chat .chat-button .btn-label {
    display: none;
}

#nexgen-chat .chat-button svg {
    flex-shrink: 0;
    animation: none;
    stroke: white;
    width: 26px;
    height: 26px;
    position: relative;
    z-index: 1;
}

#nexgen-chat .chat-button:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow:
        0 10px 32px rgba(14, 90, 198, 0.65),
        0 4px 12px rgba(0, 0, 0, 0.2),
        inset 0 2px 0 rgba(255,255,255,0.25);
}

#nexgen-chat .chat-button:active {
    transform: scale(0.95) translateY(0px);
}

#nexgen-chat .chat-button.hidden {
    display: none !important;
}

/* Online dot — repositioned for circle */
#nexgen-chat .chat-btn-dot {
    width: 11px;
    height: 11px;
    background: #2edb7f;
    border-radius: 50%;
    border: 2px solid white;
    position: absolute;
    top: 6px;
    right: 6px;
    animation: nexDotPulse 2s ease-in-out infinite;
    flex-shrink: 0;
    z-index: 2;
}

@keyframes nexDotPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(46, 219, 127, 0.6); }
    50%       { box-shadow: 0 0 0 5px rgba(46, 219, 127, 0); }
}

/* Override alt-color */
#nexgen-chat .chat-button.alt-color {
    background: linear-gradient(145deg, #1a7fe8 0%, #0e5ac6 100%);
    border: none;
    color: white;
}
#nexgen-chat .chat-button.alt-color svg {
    stroke: white;
    fill: none;
}

/* ---------------- NOTIFICATION BADGE ---------------- */
#nexgen-chat .notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin: 0;
    padding: 0;
    border: 2px solid white;
    z-index: 10002;
}

#nexgen-chat .notification-badge.show {
    opacity: 1;
    transform: scale(1);
}

/* ---------------- CHAT WINDOW ---------------- */
#nexgen-chat .chat-window {
    position: fixed;
    bottom: 96px;
    right: 28px;
    width: 380px;
    height: 640px;
    max-height: calc(100vh - 130px);
    background: white;
    border-radius: 20px;
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.14),
        0 8px 20px rgba(14, 90, 198, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    transition: all 0.35s cubic-bezier(0.34, 1.3, 0.64, 1);
    margin: 0;
    padding: 0;
    border: 1px solid rgba(14, 90, 198, 0.1);
}

#nexgen-chat .chat-window.hidden {
    opacity: 0;
    transform: translateY(24px) scale(0.93);
    pointer-events: none;
}

/* ---------------- HEADER ---------------- */
#nexgen-chat .chat-header {
    background: linear-gradient(135deg, #0a4fbf 0%, #1a7fe8 100%);
    color: white;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    margin: 0;
    border: none;
    position: sticky;
    top: 0;
    z-index: 10;
    overflow: hidden;
}

/* Subtle header decoration */
#nexgen-chat .chat-header::before {
    content: '';
    position: absolute;
    top: -30px; right: -20px;
    width: 100px; height: 100px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    pointer-events: none;
}

#nexgen-chat .header-info {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 0;
    padding: 0;
    position: relative;
    z-index: 1;
}

#nexgen-chat .header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2.5px solid rgba(255,255,255,0.9);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.3);
    margin: 0;
    padding: 0;
    display: block;
    background: #ffffff;
}

#nexgen-chat .header-text {
    margin: 0;
    padding: 0;
}

#nexgen-chat .header-text h3 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 2px 0;
    padding: 0;
    color: white;
    line-height: 1.2;
    letter-spacing: 0.1px;
}

#nexgen-chat .status {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    padding: 0;
    color: white;
    font-weight: 500;
}

#nexgen-chat .status::before {
    content: '';
    width: 7px;
    height: 7px;
    background: #2edb7f;
    border-radius: 50%;
    animation: chat-pulse 2s infinite;
    display: none; /* hidden by default — shown only when status has text */
}

#nexgen-chat .status:not(:empty)::before {
    display: inline-block;
}

@keyframes chat-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

#nexgen-chat .close-btn {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 18px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    margin: 0;
    padding: 0;
    line-height: 1;
    position: relative;
    z-index: 1;
}

#nexgen-chat .close-btn:hover {
    background: rgba(255,255,255,0.25);
}

/* ---------------- MESSAGES CONTAINER ---------------- */
#nexgen-chat .messages {
    flex: 1;
    overflow-y: auto !important;
    overflow-x: hidden;
    padding: 18px 18px 18px 52px;
    background: #f5f7fb;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    position: relative;
    /* scrollToBottom() handles keeping latest msg visible */
    justify-content: flex-start;
}

/* SCROLLBAR STYLING */
#nexgen-chat .messages::-webkit-scrollbar {
    width: 5px;
    display: block !important;
}

#nexgen-chat .messages::-webkit-scrollbar-track {
    background: transparent;
}

#nexgen-chat .messages::-webkit-scrollbar-thumb {
    background: #c5cee0;
    border-radius: 4px;
}

#nexgen-chat .messages::-webkit-scrollbar-thumb:hover {
    background: #9aaac8;
}

#nexgen-chat .messages {
    scrollbar-width: thin;
    scrollbar-color: #c5cee0 transparent;
}

/* ---------------- MESSAGE BUBBLES ---------------- */
#nexgen-chat .message {
    position: relative;
    display: block;
    width: 100%;
    margin: 0 0 4px 0;
    padding: 0;
    animation: chat-msg-slide 0.28s ease;
    flex-shrink: 0;
    border: none;
    background: none;
}

@keyframes chat-msg-slide {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0);   }
}

#nexgen-chat .message > div {
    display: inline-block;
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.55;
    word-wrap: break-word;
    position: relative;
    margin: 0;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 500;
}

/* ---------------- AVATARS ---------------- */
#nexgen-chat .message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    position: absolute;
    left: -40px;
    top: 0;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1.5px rgba(14, 90, 198, 0.35), 0 2px 6px rgba(0,0,0,0.12);
    display: none;
    margin: 0;
    padding: 0;
    background: #ffffff;
}

#nexgen-chat .message.bot .message-avatar,
#nexgen-chat .message.admin .message-avatar {
    display: block;
}

/* ---------------- SPECIFIC MESSAGE STYLES ---------------- */
#nexgen-chat .message.bot,
#nexgen-chat .message.admin {
    text-align: left;
    margin: 0;
    padding: 0;
    background: none;
}

#nexgen-chat .message.bot > div {
    background: #ffffff;
    color: #1a2540;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    border: 1px solid #e8edf5;
}

#nexgen-chat .message.admin > div {
    background: linear-gradient(135deg, #0e5ac6, #1a7fe8);
    color: white;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(14, 90, 198, 0.3);
}

/* User messages — clean blue pill */
#nexgen-chat .message.user {
    text-align: right;
    margin: 0;
    padding: 0;
    background: none;
}

#nexgen-chat .message.user > div {
    background: #eef2fb;
    color: #1a2540;
    border-bottom-right-radius: 4px;
    text-align: left;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 500;
    font-size: 14px;
    border: 1px solid #d8e3f5;
}

#nexgen-chat .message.user .message-avatar {
    left: auto;
    right: -40px;
}

/* ---------------- TYPING INDICATOR ---------------- */
#nexgen-chat .typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    margin: 0;
    flex-shrink: 0;
    border: 1px solid #e8edf5;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

#nexgen-chat .typing-indicator.hidden {
    display: none !important;
}

#nexgen-chat .typing-indicator span {
    width: 7px;
    height: 7px;
    background: #8fa3cc;
    border-radius: 50%;
    animation: chat-typing 1.4s infinite ease-in-out both;
    display: inline-block;
    margin: 0;
    padding: 0;
}

#nexgen-chat .typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
#nexgen-chat .typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes chat-typing {
    0%, 80%, 100% { transform: scale(0); }
    40%           { transform: scale(1); }
}

/* ---------------- INPUT AREA ---------------- */
#nexgen-chat .chat-input-area {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e8edf5;
    gap: 10px;
    flex-shrink: 0;
    margin: 0;
}

#nexgen-chat #message-input {
    flex: 1;
    border: 1.5px solid #e0e8f5;
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 500;
    background: #f5f7fb;
    color: #1a2540;
    margin: 0;
    box-shadow: none;
}

#nexgen-chat #message-input:focus {
    border-color: #1a7fe8;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(26, 127, 232, 0.1);
    outline: none;
}

#nexgen-chat #message-input::placeholder {
    color: #aab4cc;
    font-weight: 400;
}

#nexgen-chat .send-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #0e5ac6, #1a7fe8);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    box-shadow: 0 3px 10px rgba(14, 90, 198, 0.4);
}

#nexgen-chat .send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 5px 14px rgba(14, 90, 198, 0.5);
}

#nexgen-chat .send-btn svg {
    display: block;
    margin: 0;
    padding: 0;
}

/* ---------------- DEPARTMENT BUTTONS ---------------- */
#nexgen-chat .dept-buttons {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin: 8px 0 0 0;
    width: 100%;
    padding: 0;
}

#nexgen-chat .dept-btn {
    background: white;
    border: 1.5px solid #d8e3f5;
    padding: 9px 14px;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    font-size: 13.5px;
    width: 100%;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 600;
    color: #1a2540;
    margin: 0;
}

#nexgen-chat .dept-btn:hover {
    background: linear-gradient(135deg, #0e5ac6, #1a7fe8);
    color: white;
    border-color: transparent;
    box-shadow: 0 3px 10px rgba(14, 90, 198, 0.3);
    transform: translateX(2px);
}

/* ---------------- MOBILE RESPONSIVE ---------------- */
@media (max-width: 480px) {

    /* ---- Chat window: fixed full screen, keyboard-aware via JS ---- */
    #nexgen-chat .chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        box-shadow: none;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    /* ---- Views: flex column, fill full window ---- */
    #nexgen-chat #chat-view,
    #nexgen-chat #chats-list-view {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    /* ---- Header: truly sticky — fixed height, never moves ---- */
    #nexgen-chat .chat-header {
        flex-shrink: 0;
        position: relative;
        z-index: 10;
        padding: 12px 14px;
        padding-top: max(12px, env(safe-area-inset-top));
        /* shadow so content scrolling behind it looks clean */
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }

    #nexgen-chat .header-avatar { width: 34px; height: 34px; }
    #nexgen-chat .header-text h3 { font-size: 13px; }
    #nexgen-chat .status { font-size: 11px; }
    #nexgen-chat .back-btn { width: 28px; height: 28px; }
    #nexgen-chat .close-btn { width: 28px; height: 28px; font-size: 16px; }

    /* ---- Messages: flex-grow, scroll independently ---- */
    #nexgen-chat .messages {
        flex: 1;
        min-height: 0;
        overflow-y: auto !important;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        padding: 14px 12px 8px 44px;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    #nexgen-chat .message-avatar {
        width: 28px;
        height: 28px;
        left: -34px;
    }

    #nexgen-chat .message > div {
        font-size: 13.5px;
        padding: 9px 13px;
    }

    /* ---- Input area: never shrinks, always at bottom ---- */
    #nexgen-chat .chat-input-area {
        flex-shrink: 0;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        background: white;
        border-top: 1px solid #e8edf5;
        z-index: 2;
    }

    #nexgen-chat #message-input {
        padding: 10px 15px;
        font-size: 16px; /* prevents iOS zoom */
    }

    #nexgen-chat .send-btn {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }

    /* ---- Launcher button ---- */
    #nexgen-chat .chat-button {
        bottom: 18px;
        right: 18px;
        width: 54px;
        height: 54px;
    }
    #nexgen-chat .chat-button .btn-label { display: none; }

    /* ---- Form: full width, scrolls inside messages ---- */
    #nexgen-chat .user-info-form {
        max-width: 100%;
        padding: 12px;
    }

    #nexgen-chat .user-info-form .form-field input[type="text"],
    #nexgen-chat .user-info-form .form-field input[type="email"] {
        font-size: 16px;
        padding: 9px 12px;
    }

    #nexgen-chat .dept-choice-btn { padding: 9px 8px; font-size: 13px; }
    #nexgen-chat .user-info-form .form-submit-btn { padding: 11px; font-size: 14px; }

    /* ---- Chats list ---- */
    #nexgen-chat .chats-list-toolbar { padding: 10px 14px; }
    #nexgen-chat .new-chat-btn { padding: 11px 16px; font-size: 14px; }
    #nexgen-chat .chat-history-item { padding: 13px 14px; margin: 0 8px 5px 8px; }
    #nexgen-chat .history-avatar { width: 38px; height: 38px; font-size: 15px; }
    #nexgen-chat .history-dept { font-size: 13px; }
    #nexgen-chat .history-preview { font-size: 11.5px; }
    #nexgen-chat .typing-indicator { padding: 10px 14px; }
}

/* Extra small screens (iPhone SE etc.) */
@media (max-width: 360px) {
    #nexgen-chat .messages {
        padding: 12px 10px 12px 40px;
    }

    #nexgen-chat .message-avatar {
        width: 26px;
        height: 26px;
        left: -32px;
    }

    #nexgen-chat .dept-btn-group {
        gap: 5px;
    }

    #nexgen-chat .dept-choice-btn {
        font-size: 12px;
        padding: 8px 6px;
    }
}
/* ============================================================
   BACK BUTTON
   ============================================================ */
#nexgen-chat .back-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
}
#nexgen-chat .back-btn:hover {
    background: rgba(255,255,255,0.28);
}
#nexgen-chat .back-btn svg {
    stroke: white;
    display: block;
}

/* ============================================================
   CHAT VIEW / CHATS LIST VIEW — full height wrappers
   ============================================================ */
#nexgen-chat #chat-view,
#nexgen-chat #chats-list-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}
#nexgen-chat #chats-list-view.hidden,
#nexgen-chat #chat-view.hidden {
    display: none !important;
}

/* ============================================================
   CHATS LIST HEADER (status text override)
   ============================================================ */
#nexgen-chat .chats-list-header .status::before {
    background: #facc15; /* yellow dot for history */
    animation: none;
}

/* ============================================================
   TOOLBAR — "Start New Chat" button
   ============================================================ */
#nexgen-chat .chats-list-toolbar {
    padding: 12px 16px;
    background: #f5f7fb;
    border-bottom: 1px solid #e8edf5;
    flex-shrink: 0;
}
#nexgen-chat .new-chat-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, #0e5ac6, #1a7fe8);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(14, 90, 198, 0.35);
}
#nexgen-chat .new-chat-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(14, 90, 198, 0.45);
}
#nexgen-chat .new-chat-btn svg {
    flex-shrink: 0;
}

/* ============================================================
   CHATS LIST — scrollable area
   ============================================================ */
#nexgen-chat .chats-list {
    flex: 1;
    overflow-y: auto;
    background: #f5f7fb;
    padding: 10px 0;
    min-height: 0;
}
#nexgen-chat .chats-list::-webkit-scrollbar { width: 5px; }
#nexgen-chat .chats-list::-webkit-scrollbar-track { background: transparent; }
#nexgen-chat .chats-list::-webkit-scrollbar-thumb { background: #c5cee0; border-radius: 4px; }

/* ============================================================
   CHAT HISTORY ITEM
   ============================================================ */
#nexgen-chat .chat-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid #edf0f7;
    transition: background 0.15s;
    background: white;
    margin: 0 10px 6px 10px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
#nexgen-chat .chat-history-item:hover {
    background: #eef3fc;
}
#nexgen-chat .chat-history-item:last-child {
    border-bottom: none;
}
#nexgen-chat .history-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0e5ac6, #1a7fe8);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Plus Jakarta Sans', sans-serif;
}
#nexgen-chat .history-info {
    flex: 1;
    min-width: 0;
}
#nexgen-chat .history-dept {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13.5px;
    font-weight: 700;
    color: #1a2540;
    margin: 0 0 3px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#nexgen-chat .history-preview {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 12px;
    color: #7a8fb5;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}
#nexgen-chat .history-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}
#nexgen-chat .history-time {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 11px;
    color: #aab4cc;
    white-space: nowrap;
}
#nexgen-chat .history-badge {
    background: linear-gradient(135deg, #0e5ac6, #1a7fe8);
    color: white;
    font-size: 11px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
#nexgen-chat .history-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c5cee0;
}
#nexgen-chat .history-status-dot.active {
    background: #2edb7f;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
#nexgen-chat .chats-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px 24px;
    text-align: center;
}
#nexgen-chat .chats-empty svg {
    opacity: 0.25;
    margin-bottom: 14px;
}
#nexgen-chat .chats-empty p {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px;
    color: #7a8fb5;
    margin: 0;
    font-weight: 500;
}

/* ============================================================
   USER INFO FORM (inline in messages area)
   ============================================================ */
#nexgen-chat .user-info-form {
    background: #ffffff;
    border: 1px solid #e8edf5;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    padding: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    animation: chat-msg-slide 0.28s ease;
    max-width: 82%;
}

#nexgen-chat .user-info-form .form-field {
    margin-bottom: 9px;
}

#nexgen-chat .user-info-form .form-field label {
    display: block;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 10.5px;
    font-weight: 700;
    color: #5a6a8a;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

#nexgen-chat .user-info-form .form-field input[type="text"],
#nexgen-chat .user-info-form .form-field input[type="email"],
#nexgen-chat .user-info-form .form-field input[type="tel"] {
    width: 100%;
    border: 1.5px solid #e0e8f5;
    border-radius: 8px;
    padding: 7px 11px;
    font-size: 13px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 500;
    color: #1a2540;
    background: #f5f7fb;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

#nexgen-chat .user-info-form .form-field input:focus {
    border-color: #1a7fe8;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(26, 127, 232, 0.1);
}

#nexgen-chat .user-info-form .form-field input::placeholder {
    color: #aab4cc;
    font-weight: 400;
}

#nexgen-chat .user-info-form .form-error {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 11px;
    color: #ef4444;
    margin: 3px 0 0 2px;
    display: none;
    font-weight: 500;
}

#nexgen-chat .user-info-form .form-error.show {
    display: block;
}

/* Department pill buttons */
#nexgen-chat .dept-btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

#nexgen-chat .dept-choice-btn {
    padding: 7px 10px;
    background: #f5f7fb;
    border: 1.5px solid #e0e8f5;
    border-radius: 8px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    color: #1a2540;
    cursor: pointer;
    transition: all 0.18s;
    text-align: center;
}

#nexgen-chat .dept-choice-btn:hover {
    border-color: #1a7fe8;
    color: #1a7fe8;
    background: #eef3fc;
}

#nexgen-chat .dept-choice-btn.selected {
    background: linear-gradient(135deg, #0e5ac6, #1a7fe8);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(14, 90, 198, 0.3);
}

#nexgen-chat .user-info-form .form-submit-btn {
    width: 100%;
    padding: 9px;
    background: linear-gradient(135deg, #0e5ac6, #1a7fe8);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 4px;
    box-shadow: 0 3px 10px rgba(14, 90, 198, 0.3);
}

#nexgen-chat .user-info-form .form-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(14, 90, 198, 0.4);
}

#nexgen-chat .user-info-form .form-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================
   MESSAGE TIMESTAMP
   ============================================================ */
#nexgen-chat .msg-time {
    display: block;
    font-size: 10.5px;
    color: #aab4cc;
    margin-top: 4px;
    font-weight: 400;
    font-family: 'Plus Jakarta Sans', sans-serif;
    text-align: right;
}

#nexgen-chat .message.user .msg-time {
    color: #8a9bbf;
    text-align: right;
}

#nexgen-chat .message.bot .msg-time,
#nexgen-chat .message.admin .msg-time {
    text-align: left;
    color: #b0bdd4;
}

/* Offline status dot */
#nexgen-chat .status.status-offline::before {
    background: #ef4444 !important;
    animation: none !important;
}

/* Agent name label on admin messages */
#nexgen-chat .agent-name-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #1a7fe8;
    margin-bottom: 3px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    letter-spacing: 0.2px;
}

/* ── Chat button open state (X icon) ── */
#nexgen-chat .chat-button.is-open {
    background: linear-gradient(145deg, #1a7fe8 0%, #0e5ac6 100%) !important;
    box-shadow: 0 6px 24px rgba(14, 90, 198, 0.65), 0 2px 8px rgba(0,0,0,0.18) !important;
    transform: rotate(0deg);
    animation: none !important;
}

#nexgen-chat .chat-button.is-open::before {
    display: none;
}

#nexgen-chat .chat-button.is-open svg {
    stroke: white;
    width: 26px;
    height: 26px;
}

#nexgen-chat .chat-button.is-open:hover {
    background: linear-gradient(145deg, #2190ff 0%, #1a6fdb 100%) !important;
    transform: scale(1.08) translateY(-2px);
}