/* Live chat (docs/live-chat.md): WhatsApp-style bubbles (ChatBubbles.razor), the client app's chat window and button, and the
   Admin Portal's Live chat page. Calm colours that work on both apps' dark backgrounds. */

.ri-chat-bubbles {
    display: flex;
    flex-direction: column-reverse; /* newest at the bottom, opened scrolled to it */
    gap: 6px;
    overflow-y: auto;
    padding: 12px;
    min-height: 0;
    flex: 1 1 auto;
}

.ri-chat-bubble {
    align-self: flex-start;
    max-width: 80%;
    padding: 6px 10px 4px;
    border-radius: 12px 12px 12px 2px;
    background: rgba(255, 255, 255, 0.09);
    color: inherit;
    overflow-wrap: anywhere;
}

.ri-chat-bubble.is-mine {
    align-self: flex-end;
    border-radius: 12px 12px 2px 12px;
    background: rgba(37, 160, 110, 0.35);
}

.ri-chat-bubble-name {
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.8;
}

.ri-chat-bubble-text {
    white-space: pre-wrap;
}

.ri-chat-bubble-time {
    font-size: 0.7rem;
    opacity: 0.6;
    text-align: right;
}

.ri-chat-note {
    align-self: center;
    max-width: 90%;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.85rem;
    text-align: center;
}

.ri-chat-compose {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding: 8px 12px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ri-chat-compose textarea {
    flex: 1 1 auto;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
    font: inherit;
}

/* The client app: a floating "Chat with us" button and a small window above it (bottom bar clearance on phones). */
.ri-chat-launcher {
    position: fixed;
    right: 16px;
    bottom: calc(84px + env(safe-area-inset-bottom));
    z-index: 1200;
}

.ri-chat-window {
    position: fixed;
    right: 16px;
    bottom: calc(84px + env(safe-area-inset-bottom));
    z-index: 1300;
    width: min(360px, calc(100vw - 32px));
    height: min(520px, calc(100vh - 140px));
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    background: #101a2c;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ri-chat-window-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

@media (min-width: 960px) {
    .ri-chat-launcher,
    .ri-chat-window {
        bottom: 24px;
    }
}

/* The Admin Portal's Live chat page: the list beside the open chat. */
.ri-livechat-layout {
    display: grid;
    grid-template-columns: minmax(240px, 320px) 1fr;
    gap: 16px;
    height: calc(100vh - 180px);
}

.ri-livechat-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

@media (max-width: 900px) {
    .ri-livechat-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .ri-livechat-panel {
        height: 70vh;
    }
}
