/* Chat Trigger Button */
#chat-trigger-button {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background-color: #007bff;
    color: white;
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    cursor: pointer;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9998;
    transition: transform 0.2s ease;
}

#chat-trigger-button:hover {
    transform: scale(1.1);
}

/* Chat Widget Container */
#chat-widget-container {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 370px;
    height: 550px;
    background-color: #fff;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    transform: scale(0.5);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform-origin: bottom right;
}

#chat-widget-container.visible {
    transform: scale(1);
    opacity: 1;
}

/* Header */
#chat-widget-header {
    padding: 10px 15px;
    background-color: #007bff;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move; /* For dragging */
}

#chat-widget-header h3 {
    margin: 0;
    font-size: 1.1em;
}

#chat-widget-header .widget-controls button {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
}

/* Body */
#chat-widget-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Channel Selector */
#chat-channel-selector {
    width: 100%;
    padding: 10px;
    border: none;
    border-bottom: 1px solid #eee;
    background-color: #f8f9fa;
    font-size: 0.95em;
}

#chat-channel-selector:focus {
    outline: none;
}

/* Messages Area */
#chat-widget-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f0f2f5;
    display: flex;
    flex-direction: column;
}

/* Individual Message Styling */
.message-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 18px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    font-size: 0.9em;
}

.message-bubble .meta {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 3px;
}

.message-bubble .meta .name {
    font-weight: bold;
}

.message-bubble .content {
    word-wrap: break-word;
}

.message-bubble.other {
    background-color: #e9e9eb;
    color: #000;
    align-self: flex-start;
}

.message-bubble.self {
    background-color: #007bff;
    color: #fff;
    align-self: flex-end;
}

.message-bubble.self .meta {
    color: #f0f0f0;
    align-self: flex-end;
}

/* Footer / Input Form */
#chat-widget-footer {
    padding: 10px;
    border-top: 1px solid #ddd;
}

#chat-widget-form {
    display: flex;
}

#chat-widget-input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 8px 12px;
    margin-right: 8px;
}

#chat-widget-form button {
    border: none;
    background-color: #007bff;
    color: white;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 16px;
}

/* Collapsed State */
#chat-widget-container.collapsed {
    height: 50px; /* Just the header height */
}

#chat-widget-container.collapsed #chat-widget-body,
#chat-widget-container.collapsed #chat-widget-footer {
    display: none;
}
