/* Frontend Chat Widget */
#wp-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#wp-chat-icon {
    width: 60px;
    height: 60px;
    background: #0073aa;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, box-shadow 0.2s;
}

#wp-chat-icon:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#wp-chat-icon svg {
    width: 30px;
    height: 30px;
    color: white;
}

#wp-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 500px;
}

#wp-chat-header {
    background: #0073aa;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    flex-shrink: 0;
}

#wp-chat-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

#wp-chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

#wp-chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px;
    background: #f5f5f5;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.wp-chat-message {
    margin-bottom: 15px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wp-chat-message .message-content {
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
}

.user-message .message-content {
    background: #0073aa;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.admin-message .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    padding: 0 5px;
}

#wp-chat-input-container {
    display: flex;
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

#wp-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
}

#wp-chat-input:focus {
    border-color: #0073aa;
}

#wp-chat-send {
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    margin-left: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

#wp-chat-send:hover {
    background: #005a87;
}

/* Admin Panel Styles */
.wp-chat-admin-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.wp-chat-conversations-list {
    width: 300px;
    background: white;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.wp-chat-conversations-list h2 {
    margin-top: 0;
    font-size: 16px;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.wp-chat-conversations-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wp-chat-conversations-list li {
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.wp-chat-conversations-list li:hover {
    background: #f5f5f5;
}

.wp-chat-conversations-list li.has-new-messages {
    background: #CCCCCC;
}

.wp-chat-conversations-list li.has-new-messages:hover {
    background: #bbbbbb;
}

.wp-chat-conversations-list li.active {
    background: #e5f3ff;
    border-left: 3px solid #0073aa;
}

.wp-chat-conversations-list a {
    text-decoration: none;
    color: #333;
    display: block;
    padding: 12px;
    width: 100%;
}

.new-badge {
    background: #d63638;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 5px;
}

.wp-chat-messages-panel {
    flex: 1;
    background: white;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.wp-chat-messages-panel h2 {
    margin-top: 0;
    font-size: 18px;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

#wp-chat-admin-messages {
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.wp-chat-reply-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#wp-chat-admin-reply {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    resize: vertical;
}

/* Responsive Design */
@media (max-width: 768px) {
    #wp-chat-widget {
        z-index: 1000000;
        position: fixed;
        bottom: 0;
        right: 0;
    }
    
    #wp-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        z-index: 1000000;
        bottom: auto;
        right: auto;
    }
    
    #wp-chat-icon {
        width: 50px;
        height: 50px;
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 1000000;
    }
    
    #wp-chat-icon svg {
        width: 25px;
        height: 25px;
    }
    
    #wp-chat-header {
        padding: 4vh 4vw;
        flex-shrink: 0;
        min-height: 8vh;
    }
    
    #wp-chat-messages {
        flex: 1;
        padding: 3vw;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
        max-height: calc(100vh - 16vh - 12vh);
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
    }
    
    #wp-chat-input-container {
        padding: 3vw;
        flex-shrink: 0;
        background: white;
        border-top: 1px solid #e0e0e0;
        min-height: 12vh;
    }
    
    #wp-chat-input {
        flex: 1;
        min-width: 0;
        padding: 2.5vh 4vw;
        font-size: 16px;
    }
    
    #wp-chat-send {
        padding: 2.5vh 5vw;
        margin-left: 2vw;
        font-size: 14px;
    }
    
    .wp-chat-message .message-content {
        max-width: 85vw;
        font-size: 14px;
        padding: 2vh 3vw;
    }
    
    .wp-chat-admin-container {
        flex-direction: column;
    }
    
    .wp-chat-conversations-list {
        width: 100%;
    }
}
