/* assets/css/chat-heads.css */
/* Container for all chat heads/windows */
#chat-heads-container {
    position: fixed;
    bottom: 0;
    right: 20px;
    display: flex;
    flex-direction: row-reverse;
    /* Newest on right */
    gap: 15px;
    z-index: 10000;
    pointer-events: none;
    /* Let clicks pass through empty space */
}

/* Individual Chat Window */
.chat-window {
    width: 320px;
    height: 450px;
    background: var(--card-white, #fff);
    border-radius: 8px 8px 0 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    font-family: 'Inter', sans-serif;
    transform-origin: bottom right;
    transition: transform 0.2s, opacity 0.2s;
    border: 1px solid var(--border-light, #ddd);
}

.chat-window.minimized {
    height: 48px;
    width: auto;
    border-radius: 24px;
    background: transparent;
    box-shadow: none;
    border: none;
    overflow: visible;
}

/* Minimized Bubble Style (Chat Head) */
.chat-head-bubble {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: visible;
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.chat-head-bubble img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--card-white, #fff);
}

.chat-head-bubble:hover {
    transform: scale(1.05);
}

.chat-head-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e41e3f;
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid var(--card-white, #fff);
    min-width: 18px;
    text-align: center;
}

/* Maximized Window Styles */
.chat-window-header {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    background: var(--primary-blue, #1877f2);
    color: white;
}

.chat-window-header:hover {
    background: var(--primary-dark, #166fe5);
}

.chat-window-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.chat-window-actions {
    display: flex;
    gap: 8px;
}

.chat-window-actions button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    transition: color 0.2s;
}

.chat-window-actions button:hover {
    color: white;
}

.chat-window-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: var(--card-white, #fff);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-window-footer {
    padding: 8px;
    border-top: 1px solid var(--border-light, #eee);
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--card-white, #fff);
}

.ch-footer-top {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 0 4px;
}

.ch-footer-bottom {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input {
    flex: 1;
    border: none;
    background: var(--input-bg, #f0f2f5);
    color: var(--text-dark, #050505);
    border-radius: 18px;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 13px;
    resize: none;
    max-height: 80px;
    outline: none;
}

.chat-send-btn {
    background: none;
    border: none;
    color: var(--primary-blue, #1877f2);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat Bubbles Reused/Simplified */
.cw-message {
    max-width: 80%;
    padding: 6px 10px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
}

.cw-message.sent {
    align-self: flex-end;
    background: var(--primary-blue, #1877f2);
    color: white;
    border-bottom-right-radius: 2px;
}

.cw-message.received {
    align-self: flex-start;
    background: var(--input-bg, #f0f2f5);
    color: var(--text-dark, #050505);
    border-bottom-left-radius: 2px;
}

.cw-time {
    font-size: 9px;
    opacity: 0.7;
    margin-top: 2px;
    display: block;
    text-align: right;
}

/* Media in chat head */
.cw-media img {
    max-width: 100%;
    border-radius: 8px;
    cursor: pointer;
}

/* Hide when minimized */
.chat-window.minimized .chat-window-header {
    display: none;
}

.chat-window.minimized .chat-window-body,
.chat-window.minimized .chat-window-footer {
    display: none;
}