/* ==========================================================================
   1. BASE CONTAINER LAYOUT
   ========================================================================== */
#gp-chat-wrapper {
    display: flex !important;
    gap: 0 !important; /* Removed gaps for clean edge-to-edge mobile borders */
    height: 600px !important;
    background: #ffffff !important;
    margin: 20px 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    width: 100% !important;
    box-sizing: border-box !important;
    border: 1px solid #00b59c !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 15px rgba(0, 181, 156, 0.06) !important;
}

#gp-chat-wrapper * {
    box-sizing: border-box !important;
}

/* ==========================================================================
   2. SIDEBAR COLUMN & CONVERSATION STREAM LIST
   ========================================================================== */
#gp-sidebar {
    width: 320px !important;
    min-width: 320px !important;
    border-right: 1px solid #e2f0ed !important;
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
    height: 100% !important;
    transition: all 0.25s ease !important;
}

#gp-sidebar h3 {
    margin: 0 !important;
    padding: 16px 20px !important;
    background: #00b59c !important;
    color: #ffffff !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
}

#gp-conv-list {
    flex: 1 !important;
    overflow-y: auto !important;
}

#gp-conv-list p.gp-loading,
#gp-conv-list p {
    padding: 16px 20px !important;
    margin: 0 !important;
    color: #7f8c8d !important;
    font-size: 14px !important;
}

.gp-conv-item {
    padding: 14px 20px !important;
    border-bottom: 1px solid #f2f9f8 !important;
    cursor: pointer !important;
    transition: background 0.15s !important;
    position: relative !important;
    display: block !important;
}

.gp-conv-item:hover {
    background: #eefaf8 !important;
}

.gp-conv-item.active {
    background: #d9f5f1 !important;
    border-left: 4px solid #008271 !important;
    padding-left: 16px !important;
}

.gp-conv-name {
    font-weight: 600 !important;
    color: #2c3e50 !important;
    font-size: 14px !important;
}

.gp-conv-preview {
    font-size: 12px !important;
    color: #7f8c8d !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin-top: 4px !important;
}

.gp-conv-unread {
    position: absolute !important;
    right: 20px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: #d63638 !important;
    color: #ffffff !important;
    font-size: 11px !important;
    font-weight: 700;
    padding: 2px 7px !important;
    border-radius: 10px !important;
}

/* ==========================================================================
   3. MAIN CHAT PANEL AREA
   ========================================================================== */
#gp-chat-main {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
    height: 100% !important;
    transition: all 0.25s ease !important;
}

#gp-chat-placeholder {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    color: #a0b2b0 !important;
    font-size: 14px !important;
    background: #ffffff !important;
}

#gp-chat-window {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

#gp-chat-header {
    padding: 14px 20px !important;
    background: #f5fbfb !important;
    border-bottom: 1px solid #e0f2f0 !important;
    color: #008271 !important;
    font-weight: 600 !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.gp-mobile-back {
    display: none !important;
    cursor: pointer !important;
    font-size: 18px !important;
    color: #00b59c !important;
    padding-right: 5px !important;
}

#gp-messages-area {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 20px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    background: #fbfdfd !important;
}

/* ==========================================================================
   4. MESSAGING BUBBLES
   ========================================================================== */
.gp-msg-row {
    max-width: 75% !important;
    display: flex !important;
    flex-direction: column !important;
}

.gp-msg-row.mine {
    align-self: flex-end !important;
}

.gp-msg-row.theirs,
.gp-msg-row.admin {
    align-self: flex-start !important;
}

.gp-bubble {
    padding: 10px 14px !important;
    border-radius: 14px !important;
    font-size: 14px !important;
    line-height: 1.45 !important;
    word-break: break-word !important;
}

.gp-msg-row.mine .gp-bubble {
    background: #00b59c !important;
    color: #ffffff !important;
    border-bottom-right-radius: 2px !important;
}

.gp-msg-row.theirs .gp-bubble {
    background: #eaeaea !important;
    color: #333333 !important;
    border-bottom-left-radius: 2px !important;
}

.gp-msg-row.admin .gp-bubble {
    background: #008271 !important;
    color: #ffffff !important;
    border-bottom-left-radius: 2px !important;
}

.gp-msg-meta {
    font-size: 11px !important;
    margin-top: 4px !important;
    color: #7f8c8d !important;
}

.gp-msg-row.mine .gp-msg-meta {
    align-self: flex-end !important;
}

/* ==========================================================================
   5. CONTROL INPUT BOTTOM BAR
   ========================================================================== */
#gp-input-area {
    display: flex !important;
    gap: 10px !important;
    padding: 14px 20px !important;
    border-top: 1px solid #e0f2f0 !important;
    background: #ffffff !important;
    align-items: center !important;
}

#gp-send-btn {
    background: #00b59c !important;
    color: #ffffff !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    height: 42px !important;
}

#gp-send-btn:hover {
    background: #008271 !important;
}

/* ==========================================================================
   6. REFINED COMPACT TOAST NOTIFICATIONS POPUPS
   ========================================================================== */
#gp-toast-container {
    position: fixed !important;
    top: 25px !important;
    right: 25px !important;
    z-index: 999999 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 290px !important;
    pointer-events: none !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.gp-toast-card {
    background: #ffffff !important;
    border-left: 4px solid #00b59c !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
    padding: 12px 14px !important;
    transform: translateX(400px) !important;
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    pointer-events: auto !important;
    cursor: pointer !important;
}

.gp-toast-card.visible {
    transform: translateX(0) !important;
}

.gp-toast-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 12px !important; /* Shrunk cleanly to prevent clunky line wrapping */
    color: #2c3e50 !important;
    margin-bottom: 4px !important;
    line-height: 1.3 !important;
}

.gp-toast-header strong {
    font-weight: 600 !important;
    color: #008271 !important;
    padding-right: 12px !important;
}

.gp-toast-close {
    font-size: 14px !important;
    color: #95a5a6 !important;
    cursor: pointer !important;
    font-weight: bold !important;
}

.gp-toast-close:hover {
    color: #d63638 !important;
}

.gp-toast-body {
    font-size: 12px !important;
    color: #555555 !important;
    line-height: 1.4 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    padding-left: 2px !important;
}

/* ==========================================================================
   7. 📱 MOBILE RESPONSIVE MEDIA QUERIES (768px and down)
   ========================================================================== */
@media screen and (max-width: 768px) {
    #gp-chat-wrapper {
        height: 80vh !important;
    }

    #gp-sidebar {
        width: 100% !important;
        min-width: 100% !important;
        border-right: none !important;
    }

    #gp-chat-main {
        display: none !important;
        width: 100% !important;
    }

    #gp-chat-wrapper.chat-view-active #gp-sidebar {
        display: none !important;
    }

    #gp-chat-wrapper.chat-view-active #gp-chat-main {
        display: flex !important;
    }

    #gp-chat-placeholder {
        display: none !important;
    }

    .gp-mobile-back {
        display: inline-block !important;
    }
    
    .gp-msg-row {
        max-width: 85% !important;
    }
    
    #gp-toast-container {
        width: calc(100% - 30px) !important;
        left: 15px !important;
        right: 15px !important;
        top: 15px !important;
    }
}
/* Last seen styling */
.gp-conv-lastseen {
    font-size: 11px !important;
    color: #9aa8a6 !important;
    margin-top: 2px !important;
}

#gp-chat-lastseen {
    font-size: 12px !important;
    color: #9aa8a6 !important;
    margin-left: 10px !important;
    font-weight: 400 !important;
}

/* ─── RTCL Classified Listing integration ─────────────────────────────── */
.gp-conv-listing-tag {
    font-size: 11px !important;
    color: #00897b !important;
    background: #e6f7f4 !important;
    border-radius: 4px !important;
    padding: 2px 6px !important;
    display: inline-block !important;
    margin: 3px 0 !important;
    max-width: 100% !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

#gp-listing-card {
    display: flex !important;
    gap: 12px !important;
    align-items: center !important;
    background: #fff !important;
    border: 1px solid #d9f0ec !important;
    border-radius: 10px !important;
    padding: 10px 14px !important;
    margin-bottom: 14px !important;
    box-shadow: 0 2px 6px rgba(0,181,156,0.06) !important;
}

.gp-listing-image {
    flex-shrink: 0 !important;
    width: 56px !important;
    height: 56px !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    background: #f2f9f8 !important;
    display: block !important;
}

.gp-listing-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.gp-listing-details {
    min-width: 0 !important;
    flex: 1 !important;
}

.gp-listing-title {
    display: block !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #2c3e50 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.gp-listing-title:hover {
    color: #00897b !important;
}

.gp-listing-price {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #00897b !important;
    margin-top: 2px !important;
}

.gp-listing-location {
    font-size: 12px !important;
    color: #9aa8a6 !important;
    margin-top: 2px !important;
}

/* Header chat icon (injected into RTCL/site header) — icon + "Chat" text, no pill/circle bg */
.gp-chat-header-icon {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    height: 38px !important;
    cursor: pointer !important;
    text-decoration: none !important;
    color: #00b59c !important;
}

.gp-chat-header-icon:hover {
    color: #008271 !important;
}

.gp-chat-header-icon svg {
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0 !important;
}

.gp-chat-header-label {
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

.gp-rtcl-header-chat-item {
    display: inline-flex !important;
    align-items: center !important;
    list-style: none !important;
}

.gp-chat-header-badge {
    background: #d63638 !important;
    color: #fff !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    padding: 2px 5px !important;
    border-radius: 10px !important;
    min-width: 16px !important;
    text-align: center !important;
}

.gp-rtcl-sidebar-badge {
    display: inline-block !important;
    background: #d63638 !important;
    color: #fff !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    padding: 3px 7px !important;
    border-radius: 10px !important;
    margin-left: 8px !important;
    min-width: 18px !important;
    text-align: center !important;
    vertical-align: middle !important;
    box-shadow: 0 1px 3px rgba(214,54,56,0.4) !important;
}

.gp-rtcl-sidebar-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #00b59c !important;
    margin-right: 4px !important;
    vertical-align: middle !important;
}

.gp-rtcl-sidebar-icon svg {
    width: 18px !important;
    height: 18px !important;
}

/* Hide any leftover theme icon (regardless of tag — span, i, img, svg, or a
   bare icon-font glyph) sitting inside the Messages sidebar link, so only our
   injected .gp-rtcl-sidebar-icon shows. Targets direct children only, so the
   link's text node and our own icon/badge are never affected. */
a[href*="gp-chat"] > *:not(.gp-rtcl-sidebar-icon):not(.gp-rtcl-sidebar-badge) {
    display: none !important;
}

.gp-listing-switch-marker {
    display: flex !important;
    justify-content: center !important;
    margin: 14px 0 !important;
}

.gp-listing-switch-marker span {
    font-size: 11px !important;
    color: #00897b !important;
    background: #e6f7f4 !important;
    border: 1px solid #c8e8e4 !important;
    border-radius: 14px !important;
    padding: 4px 12px !important;
    font-weight: 600 !important;
}

/* ─── Floating chat bubble (site-wide, bottom-right) ───────────────────────
   Positioned at bottom:90px (not the universal bottom:16-20px default) so a
   future AI search/support widget can stack below it without overlapping. */
.gp-chat-float-btn {
    position: fixed !important;
    bottom: 90px !important;
    right: 20px !important;
    width: 54px !important;
    height: 54px !important;
    border-radius: 50% !important;
    background: #00b59c !important;
    color: #fff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18) !important;
    text-decoration: none !important;
    z-index: 999998 !important;
    transition: transform 0.15s ease, background 0.15s ease !important;
}

.gp-chat-float-btn:hover {
    background: #008271 !important;
    transform: scale(1.06) !important;
}

.gp-chat-float-badge {
    position: absolute !important;
    top: -4px !important;
    right: -4px !important;
    background: #d63638 !important;
    color: #fff !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    padding: 3px 6px !important;
    border-radius: 10px !important;
    min-width: 18px !important;
    text-align: center !important;
    border: 2px solid #fff !important;
}

@media (max-width: 480px) {
    .gp-chat-float-btn {
        bottom: 78px !important;
        right: 14px !important;
        width: 48px !important;
        height: 48px !important;
    }
}

