/* Floating Chat Widget Styles */
/* Namespaced to avoid conflicts with main ChatApp */
/* All styles are scoped to #floating-chat-widget container */

#floating-chat-widget.floating-chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Chat Toggle Button */
#floating-chat-widget .chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgb(21, 94, 117) 0%, rgb(15, 70, 87) 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(21, 94, 117, 0.4);
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

#floating-chat-widget .chat-toggle-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 35px rgba(21, 94, 117, 0.5);
}

#floating-chat-widget .chat-toggle-btn:active {
    transform: translateY(0) scale(0.98);
}

#floating-chat-widget .chat-toggle-btn .close-icon {
    font-size: 18px;
}

/* Unread Badge */
#floating-chat-widget .unread-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Chat Window */
#floating-chat-widget .chat-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(21, 94, 117, 0.15), 0 8px 25px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(21, 94, 117, 0.1);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Chat Header */
#floating-chat-widget .chat-header {
    background: linear-gradient(135deg, rgb(21, 94, 117) 0%, rgb(15, 70, 87) 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

#floating-chat-widget .chat-header-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

#floating-chat-widget .online-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
}

#floating-chat-widget .online-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #2ed573;
    border-radius: 50%;
    margin-right: 6px;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

#floating-chat-widget .minimize-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 14px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

#floating-chat-widget .minimize-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Messages */
#floating-chat-widget .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#floating-chat-widget .chat-messages::-webkit-scrollbar {
    width: 4px;
}

#floating-chat-widget .chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#floating-chat-widget .chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

/* Message Styles */
#floating-chat-widget .message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 85%;
}

#floating-chat-widget .message-received {
    align-self: flex-start;
}

#floating-chat-widget .message-sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

#floating-chat-widget .message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

#floating-chat-widget .message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#floating-chat-widget .message-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-content {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
}

#floating-chat-widget .message-received .message-content {
    background: #f1f3f4;
    color: #333;
    border-bottom-left-radius: 4px;
}

#floating-chat-widget .message-sent .message-content {
    background: linear-gradient(135deg, rgb(21, 94, 117) 0%, rgb(15, 70, 87) 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

#floating-chat-widget .message-system .message-content {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    border-radius: 18px;
    text-align: center;
    font-style: italic;
}

.message-time {
    font-size: 11px;
    color: #999;
    align-self: flex-end;
}

#floating-chat-widget .message-sent .message-time {
    align-self: flex-start;
}

/* Chat Input */
#floating-chat-widget .chat-input-container {
    background: white;
    border-top: 1px solid #e9ecef;
    padding: 12px 16px;
}

#floating-chat-widget .chat-input-wrapper {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 24px;
    padding: 4px;
    margin-bottom: 8px;
}

#floating-chat-widget .chat-message-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 16px;
    outline: none;
    font-size: 14px;
    border-radius: 20px;
    transition: all 0.2s ease;
}

#floating-chat-widget .chat-message-input:focus {
    box-shadow: 0 0 0 2px rgba(21, 94, 117, 0.2);
}

#floating-chat-widget .chat-message-input::placeholder {
    color: #999;
}

#floating-chat-widget .send-message-btn {
    background: linear-gradient(135deg, rgb(21, 94, 117) 0%, rgb(15, 70, 87) 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 14px;
}

#floating-chat-widget .send-message-btn:hover {
    transform: scale(1.05);
}

#floating-chat-widget .send-message-btn:active {
    transform: scale(0.95);
}

/* Chat Actions */
#floating-chat-widget .chat-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

#floating-chat-widget .action-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 14px;
}

#floating-chat-widget .action-btn:hover {
    color: rgb(21, 94, 117);
    background: rgba(21, 94, 117, 0.1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .floating-chat-container {
        bottom: 16px;
        right: 16px;
    }
    
    .chat-window {
        width: calc(100vw - 32px);
        height: 400px;
        right: -50px;
    }
    
    .chat-toggle-btn {
        width: 56px;
        height: 56px;
    }
}

@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 20px);
        height: 350px;
        right: -60px;
        bottom: 70px;
    }
}

/* Animations for smooth interactions */
#floating-chat-widget .chat-window.hiding {
    animation: slideDown 0.2s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes slideDown {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
}