#chat {
    border: 1px solid #ccc;
    width: 100%;
    height: 450px;
    margin: 0 auto 50px;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.public_chat {
    margin-top: 50px;
}

.head-chat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #d9d9d9;
    padding: 10px 20px;
    border: 1px solid #ccc;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.head-chat .left h3 {
    margin: 0;
    font-size: 1.5em;
    color: #333;
}

.head-chat .right-chat {
    display: flex;
    align-items: center;
    font-size: 0.9em;
    color: #666;
}

.head-chat .right-chat i {
    margin-right: 5px;
    color: #ffcc00;
}


#messages {
    padding: 10px;
    overflow-y: auto;
    flex-grow: 1;
}

#messageInput {
    margin: 10px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    outline: none;
}

#sendButton i {
    font-size: 20px;
}

#sendButton {
    width: 50px;
    background: #ddd;
    margin: 0 10px 0;
    padding: 10px;
    border: none;
    color: #0094f7;
    border-radius: 5px;
    cursor: pointer;
    outline: none;
}

input#msg_color {
    border: none;
    width: 40px;
    height: 40px;
    opacity: 0.7;
    cursor: pointer;
}

.message {
    margin: 10px;
    padding: 10px;
    border-radius: 10px;
    background-color: #f9f9f9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* الرسائل المرسلة من المستخدم الحالي */
.message.sent {
    direction: rtl;
    display: flex;
    flex-direction: column;
}

/* الرسائل المستلمة */
/* .message.received {
} */

.message p {
    margin: 0;
    word-wrap: break-word;
    font-size: 18px;
}

.user-name {
    font-weight: bold;
    color: #333;
}

.time {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.user-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user_img_chat.user-image {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.inp_btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#messageInput {
    flex: 1;
    margin-right: 10px;
}



.status_chat {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2ccc48;
    cursor: pointer;
    margin-right: 10px;
    box-shadow: 0 0 0 rgb(44 204 84 / 40%);
    animation: pulse 2s infinite;
}

.right-chat p {
    margin-left: 10px;
    font-size: 16px;
    color: #fff;
    width: 25px;
    height: 25px;
    background-color: #5d5d5d;
    border-radius: 50%;
    line-height: 25px;
    text-align: center;
}

.head-chat .left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.left i {
    font-size: 25px;
    color: #0094f7;
}

.star_admin {
    color: gold;
    margin: 0 7px;
}

.star_users {
    margin-left: 10px;
    color: rgba(255, 0, 0, 0.664);
    cursor: pointer;
}

.status_chat:hover {
    animation: none;
}


@-webkit-keyframes pulse {
    0% {
        -webkit-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
    }

    70% {
        -webkit-box-shadow: 0 0 0 10px rgba(204, 169, 44, 0);
    }

    100% {
        -webkit-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
    }
}

@keyframes pulse {
    0% {
        -moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
        box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
    }

    70% {
        -moz-box-shadow: 0 0 0 10px rgba(204, 169, 44, 0);
        box-shadow: 0 0 0 10px rgba(204, 169, 44, 0);
    }

    100% {
        -moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
        box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
    }
}

#popupUserName, #popupUserId {
    color: green;
}

/*______________________________________________*/
/* تنسيق النافذة المنبثقة */
.custom-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.custom-popup-content {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 100%;
    text-align: center;
    position: relative;
}

.custom-popup-content h2 {
    margin-bottom: 20px;
    font-size: 1.5em;
    color: #333;
}

.custom-chat-gift {
    margin-bottom: 20px;
}

.custom-chat-gift form {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.custom-chat-gift input,
.custom-chat-gift select,
.custom-chat-gift button {
    margin: 5px 0;
    padding: 10px;
    width: 80%;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.custom-chat-gift button {
    background: #28a745;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background 0.3s;
}

.custom-chat-gift button:hover {
    background: #218838;
}

.custom-popup-content .custom-close-btn {
    background: #e9e9e9;
    color: #000;
    font-size: 17px;
    border: none;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 10px;
    transition: background 0.3s;
}

.custom-popup-content .custom-close-btn:hover {
    background: #28a745;
}

.error_chat {
    color: red;
}

.trash_icon {
    color: rgb(255, 0, 0);
    margin-left: 10px;
    cursor: pointer;
    filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.5));
    text-shadow: 
        -1px -1px 0 #000,  
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
}

#clear_chat {
    background-color: #ff0032;
    color: white;
    padding: 5px 10px;
    text-align: center;
    border-radius: 10px;
    text-decoration: none;
    display: inline-block;
    font-size: 18px;
    border: none;
    cursor: pointer;
}

/*_______________________________________________________________*/

.dark-mode .head-chat {
    background-color: #2f2f2f;
    color: #fff;
    border: none;
}

.dark-mode .inp_btn {
    background-color: #2f2f2f;
}

.dark-mode #chat {
    border: none;
}

.dark-mode .head-chat .left h3 {
    color: #fff;
}

.dark-mode #messages {
    background: #333;
}

.dark-mode .message, .dark-mode #messageInput {
    background-color: #212121;
    border: 1px solid #454343;
    color: #fff;
}

.dark-mode .user-name {
    color: #fff;
}

.dark-mode .custom-popup-content {
    background-color: #212121;
    color: #fff;
}

.dark-mode .custom-popup-content h2 {
    color: #fff;
}

.dark-mode .custom-chat-gift input, .dark-mode .custom-chat-gift select {
    background-color: transparent;
    color: #fff;
    border: 1px solid #414141;
}

.dark-mode .custom-chat-gift select option {
    background-color: #212121;
}

.dark-mode #giftForm label {
    color: #fff;
}