/* Chat Bubble Component Styles */

/* Drawer como overlay fijo - debajo del appbar */
.chat-drawer {
    position: fixed !important;
    right: 0;
    top: 64px !important; /* Altura del appbar */
    height: calc(100vh - 64px) !important;
    z-index: 1300;
}

.chat-drawer .mud-drawer-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    border-bottom: 1px solid var(--mud-palette-divider);
    flex-shrink: 0;
    min-height: auto !important;
    padding: 8px 12px !important;
}

.chat-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* Sección de usuarios - auto height basado en contenido */
.chat-users-section {
    flex-shrink: 0;
    max-height: 50%;
    display: flex;
    flex-direction: column;
    border-bottom: 2px solid var(--mud-palette-divider);
}

/* Lista de usuarios compacta */
.chat-users-list {
    overflow-y: auto;
}

.chat-user-item {
    cursor: pointer;
    transition: background-color 0.15s;
    padding: 8px 12px;
    border-bottom: 1px solid var(--mud-palette-divider);
}

.chat-user-item:last-child {
    border-bottom: none;
}

.chat-user-item:hover {
    background-color: var(--mud-palette-action-default-hover);
}

.chat-user-item.selected {
    background-color: var(--mud-palette-primary);
    color: white;
}

.chat-user-item.selected .mud-text-secondary,
.chat-user-item.selected .mud-typography-caption {
    color: rgba(255,255,255,0.8) !important;
}

/* Badge offline */
.offline-badge .mud-badge {
    background-color: var(--mud-palette-grey-light) !important;
}

/* Conversación - ocupa el resto del espacio */
.chat-conversation {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 200px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Separador de fecha compacto */
.chat-date-separator {
    display: flex;
    justify-content: center;
    margin: 4px 0;
}

.chat-date-separator .mud-chip {
    height: 18px;
    font-size: 0.65rem;
}

/* Separador de mensajes no leídos */
.chat-unread-separator {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 4px 0;
    position: relative;
}

.chat-unread-separator::before,
.chat-unread-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--mud-palette-error);
    margin: 0 6px;
}

.chat-unread-separator .mud-chip {
    height: 16px;
    font-size: 0.6rem;
}

.chat-message-item {
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.chat-message-item.mine {
    flex-direction: row-reverse;
}

.chat-message-content {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    gap: 1px;
}

.chat-message-item.mine .chat-message-content {
    align-items: flex-end;
}

.chat-bubble {
    padding: 5px 10px;
    border-radius: 12px;
    word-wrap: break-word;
    font-size: 0.85rem;
    line-height: 1.3;
}

.chat-bubble.mine {
    background-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    border-bottom-right-radius: 4px;
}

.chat-bubble.theirs {
    background-color: var(--mud-palette-background-grey);
    border-bottom-left-radius: 4px;
}

.chat-timestamp {
    font-size: 0.6rem;
    color: var(--mud-palette-text-disabled);
    margin: 0 2px;
}

.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 4px;
    opacity: 0.5;
}

.chat-empty-conversation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 4px;
    opacity: 0.4;
}

.chat-typing {
    padding: 2px 8px;
}

.chat-input-container {
    padding: 8px 10px;
    border-top: 1px solid var(--mud-palette-divider);
    background-color: var(--mud-palette-surface);
    flex-shrink: 0;
}

.chat-input-container .mud-input-slot {
    font-size: 0.85rem;
}

.chat-avatar {
    flex-shrink: 0;
}

.chat-sender-name {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--mud-palette-primary);
    padding-left: 2px;
    margin-bottom: 1px;
}

/* Doble check alineado */
.chat-message-item.mine .d-flex {
    justify-content: flex-end;
}

/* Scrollbar más delgado */
.chat-users-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-users-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background-color: var(--mud-palette-grey-light);
    border-radius: 2px;
}

.chat-users-list::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
