/* Frontend Chat Widget Styles */
#chat-circle {
    position: fixed;
    bottom: 50px;
    right: 50px;
    background: #5A5EB9;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    color: white;
    padding: 15px;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

#chat-circle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.chat-box {
    display: none;
    background: #efefef;
    position: fixed;
    right: 100px;
    bottom: 50px;
    width: 320px;
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    flex-direction: column;
}

.chat-box-header {
    background: #5A5EB9;
    color: #fff;
    padding: 12px 16px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;
}

.chat-box-toggle {
    cursor: pointer;
    font-size: 20px;
}

.acb-show-users-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.acb-show-users-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Users List */
.chat-users-list {
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

.acb-user-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f5f5f5;
}

.acb-user-item:hover {
    background: #f8f9fa;
}

.acb-user-item.active {
    background: #e3f2fd;
    border-left: 3px solid #2196f3;
}

.acb-user-avatar-container {
    position: relative;
    margin-right: 10px;
}

.acb-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.acb-online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #fff;
}

.acb-online-indicator.online {
    background: #4caf50;
}

.acb-online-indicator.offline {
    background: #999;
}

.acb-user-details h5 {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin: 0 0 2px 0;
}

.acb-user-status {
    font-size: 11px;
    color: #666;
}

.acb-no-users {
    padding: 20px;
    text-align: center;
    color: #666;
}

.acb-no-users p {
    margin: 0;
    font-size: 14px;
}

.chat-box-body {
    height: 300px;
    overflow: hidden;
}

.chat-logs {
    padding: 12px;
    height: 100%;
    overflow-y: auto;
    background: #f9f9f9;
}

/* Updated Message Styles */
.acb-message {
    display: flex;
    align-items: flex-end;
    margin-bottom: 12px;
}

.acb-message.own {
    flex-direction: row-reverse;
}

.acb-message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.acb-message-content {
    max-width: 70%;
    margin: 0 8px;
}

.acb-message.own .acb-message-content {
    text-align: right;
}

.acb-message-header {
    margin-bottom: 2px;
}

.acb-message-sender {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    margin-right: 6px;
}

.acb-message-time {
    font-size: 10px;
    color: #999;
}

.acb-message-body {
    background: #fff;
    padding: 8px 12px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
}

.acb-message.own .acb-message-body {
    background: #5A5EB9;
    color: #fff;
}

.acb-message-body p {
    margin: 0;
    font-size: 14px;
    line-height: 1.3;
}

.acb-message-image {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.acb-message-image:hover {
    transform: scale(1.05);
}

.acb-message-file {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #f5f5f5;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.acb-message-file a {
    color: #2196f3;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
}

.acb-message-file a:hover {
    text-decoration: underline;
}

.chat-input {
    padding: 10px;
    background: #f1f1f1;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.chat-input-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.acb-attach-btn {
    background: none;
    border: none;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: background-color 0.2s;
}

.acb-attach-btn:hover {
    background: #e0e0e0;
}

#msg {
    flex: 1;
    padding: 8px 12px;
    border-radius: 16px;
    border: 1px solid #ccc;
    outline: none;
    resize: none;
    font-size: 15px;
    max-height: 80px;
    min-height: 36px;
    width: 100%;
    box-sizing: border-box;
}

.chat-submit {
    background: #5A5EB9;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    margin-left: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    float: right;
    margin-top: -36px;
}

.chat-submit:hover {
    background: #4a4ea8;
    transform: scale(1.1);
}

/* Auth UI */
.acb-auth-box {
    padding: 20px;
    text-align: center;
}

.acb-google-btn,
.acb-email-btn {
    background: #fff;
    color: #5A5EB9;
    border: 1px solid #5A5EB9;
    border-radius: 20px;
    padding: 8px 20px;
    margin: 8px 0;
    cursor: pointer;
    font-size: 16px;
    width: 80%;
    transition: all 0.3s ease;
}

.acb-google-btn:hover,
.acb-email-btn:hover {
    background: #5A5EB9;
    color: #fff;
}

.acb-google-btn i {
    margin-right: 8px;
}

.acb-divider {
    margin: 12px 0;
    color: #aaa;
    position: relative;
}

.acb-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #ddd;
}

.acb-divider span {
    background: #f9f9f9;
    padding: 0 10px;
    position: relative;
    z-index: 1;
}

.acb-email-form input {
    width: 80%;
    margin: 6px 0;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 15px;
    outline: none;
}

.acb-email-form input:focus {
    border-color: #5A5EB9;
    box-shadow: 0 0 0 2px rgba(90, 94, 185, 0.2);
}

.acb-toggle-auth {
    background: none;
    border: none;
    color: #5A5EB9;
    cursor: pointer;
    margin-top: 8px;
    font-size: 14px;
    text-decoration: underline;
}

.acb-toggle-auth:hover {
    color: #4a4ea8;
}

/* Scrollbar Styling */
.chat-users-list::-webkit-scrollbar,
.chat-logs::-webkit-scrollbar {
    width: 4px;
}

.chat-users-list::-webkit-scrollbar-track,
.chat-logs::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-users-list::-webkit-scrollbar-thumb,
.chat-logs::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.chat-users-list::-webkit-scrollbar-thumb:hover,
.chat-logs::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-box {
        right: 20px;
        left: 20px;
        width: auto;
        max-width: none;
    }

    #chat-circle {
        right: 20px;
        bottom: 20px;
    }

    .acb-message-content {
        max-width: 80%;
    }

    .acb-message-image {
        max-width: 120px;
        max-height: 120px;
    }
}