.andudo-contact-admin {
    display: inline-block;
    margin: 10px 0;
}

.andudo-contact-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
}

.andudo-contact-btn:hover {
    background: #45a049;
    opacity: 0.9;
}

.andudo-chat-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 500px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    z-index: 1001;
    display: none;
}

.chat-modal-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.chat-modal-content .chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #ebeff2;
    color: #5e605f;
    border-radius: 8px 8px 0 0;
    flex-shrink: 0;
}

.chat-modal-content .chat-header h3 {
    margin: 0;
    font-size: 16px;
}

.close-chat {
    background: none;
    border: none;
    color: #5e605f;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-modal-content .chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f3f3f3;
    max-height: calc(100% - 120px);
    min-height: 200px;
}

/* สไตล์สำหรับ scrollbar */
.chat-modal-content .chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-modal-content .chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-modal-content .chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-modal-content .chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Reuse message styles from admin */
.chat-modal-content .message {
    margin-bottom: 10px;
    max-width: 85%;
}

.chat-modal-content .message.own {
    margin-left: auto;
    text-align: right;
}

.chat-modal-content .message.other {
    margin-right: auto;
}

/* สไตล์สำหรับข้อความ */
.chat-modal-content .message.text-message .message-content {
    padding: 8px 12px;
    border-radius: 15px;
    display: inline-block;
    word-wrap: break-word;
    font-size: 13px;
    max-width: 100%;
}

.chat-modal-content .message.text-message.own .message-content {
    background: #5e605f;
    color: white;
}

.chat-modal-content .message.text-message.other .message-content {
    background: #e9ecef;
    color: #333;
}


/* เพิ่มสไตล์สำหรับลิงก์ในข้อความแชท */
.chat-modal-content .message.text-message .message-content a {
    color: inherit !important;
    text-decoration: underline;
}

.chat-modal-content .message.text-message.own .message-content a {
    color: white !important;
    text-decoration: underline;
}

.chat-modal-content .message.text-message.other .message-content a {
    color: #333 !important;
    text-decoration: underline;
}


/* สไตล์สำหรับรูปภาพ */
.chat-modal-content .message.image-message .image-container {
    padding: 0;
    border-radius: 8px;
    display: inline-block;
    max-width: 100%;
}

.chat-modal-content .message.image-message .message-content {
    background: transparent;
    padding: 0;
}

.chat-modal-content .message-time {
    font-size: 10px;
    color: #999;
    margin-top: 3px;
}

.chat-modal-content .chat-image {
    max-width: 150px;
    border-radius: 8px;
    display: block;
    background: transparent;
}

.chat-modal-content .chat-input {
    padding: 15px;
    border-top: 1px solid #ddd;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
    flex-shrink: 0;
}

.chat-modal-content .chat-input textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 12px;
    resize: vertical;
    font-family: inherit;
    font-size: 13px;
    height: 40px;
    min-height: 40px;
    max-height: 80px;
}

/* ปรับโครงสร้าง chat-actions สำหรับฝั่ง user */
.chat-modal-content .chat-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    gap: 10px;
}

.chat-modal-content .chat-action-left {
    display: flex;
    gap: 5px;
    align-items: center;
}

.chat-modal-content .chat-action-right {
    display: flex;
    align-items: center;
}

.chat-modal-content .btn-image, 
.chat-modal-content .btn-send {
    padding: 6px 12px;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
}

.chat-modal-content .btn-image {
    background: #5e605f;
    color: white;
}

.chat-modal-content .btn-send {
    background: #5e605f;
    color: white;
}


/* ป้องกันไม่ให้มีเนื้อหาอื่นโผล่มาใน modal */
.andudo-chat-modal * {
    box-sizing: border-box;
}

.chat-modal-content {
    position: relative;
    overflow: hidden;
}

/* ซ่อน element อื่นที่ไม่เกี่ยวข้อง */
.chat-modal-content .chat-header,
.chat-modal-content .chat-messages,
.chat-modal-content .chat-input {
    position: relative;
    z-index: 1;
}



/* สำหรับเมื่อไม่มีข้อความ */
.chat-modal-content .no-messages {
    text-align: center;
    color: #999;
    padding: 20px;
    font-style: italic;
    font-size: 14px;
}

/* Overlay background */
.andudo-chat-modal::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: -1;
}

/* Responsive */
@media (max-width: 480px) {
    .andudo-chat-modal {
        width: 100%;
        height: 93%;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: none;
        position: fixed;
    }
    
    .chat-modal-content {
        border-radius: 0;
    }
    
    .chat-modal-content .chat-header {
        border-radius: 0;
    }
    
    .chat-modal-content .chat-input {
        border-radius: 0;
    }
}




/* Guest chat styles */
.andudo-guest-chat {
    display: inline-block;
    margin: 10px 0;
    text-align: center;
}

.andudo-guest-notice {
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

.andudo-guest-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.andudo-guest-modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
}

.andudo-guest-modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.andudo-guest-modal-header h3 {
    margin: 0;
    color: #333;
}

.andudo-guest-modal-body {
    padding: 20px;
}

.andudo-guest-modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.andudo-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.andudo-btn-cancel {
    background: #6c757d;
    color: white;
}

.andudo-btn-start-chat {
    background: #4CAF50;
    color: white;
}

.andudo-guest-loading {
    text-align: center;
    color: #666;
    display: none;
}

/* ทำให้ปุ่มที่สร้างใหม่มีสไตล์เหมือนเดิม */
.andudo-guest-chat .andudo-contact-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
}

.andudo-guest-chat .andudo-contact-btn:hover {
    background: #45a049;
    opacity: 0.9;
}

/* ซ่อน Admin Bar สำหรับผู้ใช้ Guest */
body.andudo-chat-modal-open #wpadminbar {
    display: none !important;
}



















/* เพิ่มสไตล์นี้ที่ท้ายไฟล์ chat-user.css */

/* ปรับตำแหน่ง modal ให้อยู่มุมขวาล่าง - สำหรับคอมพิวเตอร์เท่านั้น */
@media (min-width: 769px) {
    .andudo-chat-modal {
        position: fixed;
        bottom: 20px;
        right: 20px;
        top: 20px;
        left: auto;
        transform: none;
        width: 450px;
        height: 80%;
    }
    
    .andudo-chat-modal::before {
        display: none; /* ลบ overlay background */
    }
}


/* Reset และป้องกัน element อื่นโผล่มา */
.andudo-chat-modal {
    isolation: isolate;
}

.chat-modal-content > *:not(.chat-header):not(.chat-messages):not(.chat-input) {
    display: none !important;
}

/* กำหนดความสูงที่ชัดเจนให้แต่ละส่วน */
.chat-modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-modal-content .chat-header {
    flex-shrink: 0;
    height: 60px;
}

.chat-modal-content .chat-messages {
    flex: 1;
    overflow-y: auto;
}

.chat-modal-content .chat-input {
    flex-shrink: 0;
    height: 120px;
}