/* Floating Chat Button */
.chat-floating-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: #007bff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    transition: transform 0.2s;
}

.chat-floating-button:hover {
    transform: scale(1.1);
}

.chat-floating-button i {
    font-size: 24px;
    color: white;
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: red;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    display: none;
}

/* Chat Sidebar */
.chat-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    z-index: 1001;
    transition: right 0.3s;
    display: flex;
    flex-direction: column;
}

.chat-sidebar.open {
    right: 0;
}

.chat-sidebar-header {
    padding: 15px;
    background: #007bff;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-sidebar-header h5 {
    margin: 0;
}

.close-chat-sidebar {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

.chat-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* Chat Items */
.chat-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.chat-item:hover {
    background: #f8f9fa;
}

.chat-item-image {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 10px;
}

.chat-item-info {
    flex: 1;
}

.chat-item-title {
    font-weight: bold;
    margin-bottom: 2px;
}

.chat-item-user {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
}

.chat-item-last-message {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat Window */
.chat-window {
    position: fixed;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    z-index: 1002;
    transition: all 0.3s;
}

.chat-window.minimized {
    height: 50px;
    overflow: hidden;
}

.chat-window-header {
    padding: 10px;
    background: #007bff;
    color: white;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-window-title {
    flex: 1;
}

.chat-window-title small {
    font-size: 11px;
    opacity: 0.8;
    display: block;
}

.chat-window-header button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
    margin-left: 5px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
}

.message {
    margin-bottom: 10px;
    max-width: 80%;
}

.own-message {
    margin-left: auto;
}

.other-message {
    margin-right: auto;
}

.message-sender {
    font-size: 11px;
    color: #666;
    margin-bottom: 2px;
}

.message-text {
    background: white;
    padding: 8px 12px;
    border-radius: 10px;
    word-wrap: break-word;
}

.own-message .message-text {
    background: #007bff;
    color: white;
}

.message-time {
    font-size: 10px;
    color: #999;
    margin-top: 2px;
}

.chat-input-area {
    padding: 10px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.chat-input-area textarea {
    flex: 1;
    resize: none;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 8px;
    font-family: inherit;
}

.chat-input-area button {
    padding: 8px 15px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.loading-messages, .no-messages {
    text-align: center;
    color: #999;
    padding: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .chat-window {
        width: 90%;
        right: 5% !important;
        bottom: 80px !important;
    }
}
/* Chat Messages Container */
.chat-messages-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
}

/* Typing Indicator */
.typing-indicator {
    padding: 5px 10px;
    background: #f0f0f0;
    border-top: 1px solid #e0e0e0;
    font-size: 12px;
    color: #666;
}

.typing-text {
    display: inline-block;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Message Animations */
.message {
    animation: fadeIn 0.3s ease-in;
}

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

/* Chat Window Minimized State */
.chat-window.minimized {
    height: 50px !important;
    overflow: hidden;
}

.chat-window.minimized .chat-messages-container,
.chat-window.minimized .chat-input-area {
    display: none;
}

/* Notification Badge Animation */
.unread-badge {
    animation: bounce 0.5s ease;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}