/* **MODIFICATION START: Overhauled for better responsive layout and added unread badge/status dot styles** */

.wpltc-app {
    display: flex;
    border: 1px solid #ddd;
    font-family: Arial, Helvetica, sans-serif;
    height: 650px;
    max-height: 90vh;
}

.wpltc-left {
    width: 320px;
    background: #fafafa;
    border-right: 1px solid #eee;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.wpltc-right {
    flex: 1;
    padding: 12px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.wpltc-search-wrap {
    display: flex;
    gap: 8px;
    padding: 12px 12px 0 12px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.wpltc-left-top {
    padding: 12px 12px 0 12px;
    flex-shrink: 0;
}

.wpltc-left-bottom {
    padding: 12px;
    flex-shrink: 0;
}

.wpltc-search-wrap input {
    flex: 1;
    width: 60%;
}

.wpltc-contacts {
    flex-grow: 1;
    overflow-y: auto;
    min-height: 0;
}

.wpltc-contact {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wpltc-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #eee;
    background: #fff;
    margin-bottom: 8px;
    min-height: 0;
}

/* **MODIFICATION START: Added clearfix to ensure message container has correct height** */
.wpltc-messages::after {
    content: "";
    display: table;
    clear: both;
}
/* **MODIFICATION END** */

/* **MODIFICATION START: Added styles for message bubbles & sender name** */
.wpltc-msg {
    margin-bottom: 10px;
    max-width: 80%;
    clear: both;
}
.wpltc-msg .content {
    padding: 8px 12px;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
}
.wpltc-msg .meta {
    font-size: 0.75em;
    color: #999;
    margin: 2px 8px 0;
}
.wpltc-msg.me {
    float: right;
    margin-left: 20%;
}
.wpltc-msg.me .content {
    background-color: #0084ff;
    color: white;
    border-bottom-right-radius: 4px;
}
.wpltc-msg.me .meta {
    text-align: right;
}
.wpltc-msg.other {
    float: left;
    margin-right: 20%;
}
.wpltc-msg.other .content {
    background-color: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 4px;
}
.wpltc-msg .sender-name {
    font-size: 0.8em;
    font-weight: bold;
    color: #555;
    margin: 0 0 4px 8px;
}
/* **MODIFICATION END** */


.wpltc-controls {
    flex-shrink: 0;
}

.wpltc-controls textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #ccc
}

.wpltc-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    position: relative;
}

.wpltc-btn {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    background: #f0f0f0;
    cursor: pointer
}

.wpltc-modal {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999
}

.wpltc-modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-sizing: border-box;
    width: 94%
}

.wpltc-shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    max-height: 400px;
    overflow: auto;
}

.wpltc-shop-item {
    border: 1px solid #ddd;
    padding: 8px;
    border-radius: 4px;
    text-align: center;
}

.wpltc-shop-item-img {
    width: 100%;
    height: 150px;
    overflow: hidden;
    margin-bottom: 8px;
    border-radius: 4px;
}

.wpltc-shop-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wpltc-emoji-picker {
    display: none;
    position: absolute;
    bottom: 50px;
    left: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 8px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    z-index: 100;
}

.wpltc-emoji {
    cursor: pointer;
    padding: 4px;
    font-size: 1.4em;
    display: inline-block;
}

.wpltc-emoji:hover {
    background: #eee;
    border-radius: 4px;
}

#wpltc-add-shop {
    padding: 15px;
    border: 1px solid #ccc;
    margin-bottom: 20px;
    background: #f9f9f9;
}

#wpltc-add-shop input,
#wpltc-add-shop textarea {
    margin-right: 10px;
    margin-bottom: 10px;
}

.wpltc-shop-img-preview img {
    border: 1px solid #ddd;
    padding: 2px;
    background: #fff;
}

.wpltc-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.wpltc-unread-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: #f44336;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.75em;
    font-weight: bold;
    line-height: 1;
    min-width: 10px;
    text-align: center;
    border: 1px solid white;
}

.wpltc-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
}

.wpltc-status-dot.online {
    background-color: #4CAF50; /* Green */
}

.wpltc-status-dot.offline {
    background-color: #9E9E9E; /* Grey */
}

.wpltc-header-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

#wpltc-chat-header {
    font-weight: bold;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-grow: 1;
}

#wpltc-header-actions {
    margin-left: auto;
}

#wpltc-block-user-btn {
    background-color: #fbecec;
    border-color: #f44336;
    color: #c72929;
    font-size: 0.8em;
    padding: 5px 8px;
}

#wpltc-block-user-btn:hover {
    background-color: #f44336;
    color: white;
}

.wpltc-contact.blocked {
    opacity: 0.6;
    background-color: #f5f5f5;
}

/* **MODIFICATION START: Added styles for last seen status text** */
#wpltc-chat-header .wpltc-header-text {
    display: flex;
    flex-direction: column;
}

#wpltc-chat-header .wpltc-user-status {
    font-size: 0.8em;
    color: #666;
    font-weight: normal;
}
/* **MODIFICATION END** */

.wpltc-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}


@media (max-width: 720px) {
    .wpltc-app {
        flex-direction: column;
        height: 100%;
        max-height: none;
    }

    .wpltc-left {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #eee;
        max-height: 50vh;
    }

    .wpltc-messages {
        height: auto;
    }

    .wpltc-shop-grid {
        grid-template-columns: 1fr;
    }
}

/* **MODIFICATION START: Styles for Group/User separation in contact list** */
.wpltc-contacts-header {
    font-weight: bold;
    padding: 10px 12px 5px;
    color: #555;
    background-color: #f0f0f0;
    border-bottom: 1px solid #ddd;
    border-top: 1px solid #ddd;
    margin-top: 5px;
    font-size: 0.9em;
    text-transform: uppercase;
}

.wpltc-contacts-header:first-child {
    margin-top: 0;
    border-top: none;
}

.wpltc-contact.group-contact .wpltc-avatar {
    border: 2px solid #4CAF50; /* Add a green border to group avatars */
}
/* **MODIFICATION END** */

/* **MODIFICATION START: Styles for seen status and call logs** */
.wpltc-seen-status {
    font-size: 0.75em;
    color: #888;
    text-align: right;
    padding: 0 8px 4px;
    clear: both;
}

.wpltc-event-log {
    text-align: center;
    color: #888;
    font-size: 0.85em;
    margin: 10px 0;
    width: 100%;
    clear: both;
}
/* **MODIFICATION END** */
/* **MODIFICATION END** */

/* **MODIFICATION START: Fix for datepicker z-index in modals** */
.ui-datepicker,
.ui-timepicker-div {
    z-index: 10000 !important;
}
/* **MODIFICATION END** */

/* ... (all existing CSS code) ... */

/* **MODIFICATION END** */
/* **MODIFICATION END** */

/* **MODIFICATION START: Styles for Token Transfer Messages** */
.wpltc-transfer-block {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background-color: #f7f7f7;
    color: #333;
    max-width: 300px;
    box-sizing: border-box;
}
.wpltc-msg.me .wpltc-transfer-block {
    background-color: #007bff;
    color: #fff;
    border-color: #0069d9;
}
.wpltc-transfer-icon {
    font-size: 2.5em;
    margin-right: 15px;
}
.wpltc-transfer-details {
    flex-grow: 1;
    text-align: left;
}
.wpltc-transfer-title {
    font-weight: bold;
    font-size: 1em;
    margin-bottom: 4px;
}
.wpltc-transfer-amount {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 6px;
}
.wpltc-msg.me .wpltc-transfer-amount {
    color: #ffdddd;
}
.wpltc-msg.other .wpltc-transfer-amount {
    color: #28a745;
}
.wpltc-transfer-note {
    font-size: 0.85em;
    opacity: 0.9;
    font-style: italic;
    margin-bottom: 6px;
    word-wrap: break-word;
}
.wpltc-transfer-txid {
    font-size: 0.75em;
    opacity: 0.7;
}
/* **MODIFICATION END** */

/* **MODIFICATION START: Fix for datepicker z-index in modals** */
.ui-datepicker,
.ui-timepicker-div {
    z-index: 10000 !important;
}
/* **MODIFICATION END** */
/* My Contact button styles */
#wpltc-my-contact{background:#4CAF50;color:#fff;border:none;padding:6px 10px;border-radius:6px;cursor:pointer;margin-left:8px;} #wpltc-my-contact:hover{opacity:0.95}
