﻿/* Optimized chat.css - deduplicated and grouped */

/* Dialog container */
.message-dialog .rz-dialog,
.notes-dialog,
.chat-dialog {
    width: 100% !important;
    height: calc(100vh - 70px) !important;
    max-width: none !important;
    margin: 0;
    border-radius: 0;
    overflow: hidden;
    background: #F8F9FB;
    display: flex;
    flex-direction: column;
}

/* Top headers (messages, notes, chat) */
.chat-header,
.messages-header,
.notes-header {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 50;
    background: #70AFFB;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-bottom: 1px solid #E0E6EB;
}

    .chat-header .last-seen,
    .chat-last-seen {
        font-size: 12px;
        color: #E0E6EB;
        opacity: .9;
    }

    .chat-header h3, .messages-header h3 {
        margin: 0;
        font-size: 1.1rem;
    }

/* Generic close button */
.close-icon, .chat-close, .close-btn {
    cursor: pointer;
    font-size: 1.5rem;
    color: #FFFFFF;
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    transition: opacity 0.2s ease;
}

    .close-icon:hover, .close-btn:hover {
        opacity: 0.75;
    }

/* Main containers */
.chat-container, .messages-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #F8F9FB;
    position: relative;
}

/* Scrollable feed area */
.chat-feed, .conversation-list, .notes-feed {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1rem 1rem 1rem;
    background: #ECEBF0 !important;
    scroll-behavior: smooth;
}

    /* Scrollbar aesthetics */
    .chat-feed::-webkit-scrollbar {
        width: 6px;
    }

    .chat-feed::-webkit-scrollbar-thumb {
        background: #D1D5DB;
        border-radius: 3px;
    }

        .chat-feed::-webkit-scrollbar-thumb:hover {
            background: #A0AEC0;
        }

/* Message row and alignment */
.chat-row, .chat-message {
    display: flex;
    gap: 8px;
    margin-bottom: 1rem;
    align-items: flex-end;
}

    .chat-row.left {
        justify-content: flex-start;
    }

    .chat-row.right {
        justify-content: flex-end;
    }

/* Message container and bubbles - support multiple class naming variants */
.chat-message, .chat-bubble-container {
    max-width: 80%;
    display: flex;
    flex-direction: column;
    word-wrap: break-word;
}

.chat-bubble, .bubble {
    background: #FFFFFF;
    border: 1px solid #E0E6EB;
    border-radius: 1rem;
    padding: 0.6rem 0.9rem;
    font-size: 0.95rem;
    line-height: 1.4;
    color: #1E293B;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

    /* Modifiers: current/coach/other/client */
    .chat-message.from-current .bubble,
    .chat-message.from-coach .bubble,
    .chat-message.me .chat-bubble,
    .chat-bubble.me {
        background: #70AFFB;
        color: #FFFFFF;
        border: none;
    }

.chat-message.from-other .bubble,
.chat-message.from-client .bubble,
.chat-message.from-other .chat-bubble {
    background: #E5E7EB;
    color: #1E293B;
}

/* Meta (name/time) */
.chat-meta {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

    .chat-meta .chat-name {
        font-weight: 600;
        color: #1E293B;
    }

    .chat-meta.me .chat-name {
        color: #70AFFB;
    }

    .chat-meta .chat-time, .conversation-time {
        color: #94A3B8;
        font-size: 0.8rem;
    }

/* Timestamp below bubble */
.chat-message .time {
    font-size: 11px;
    color: #6C757D;
    margin-top: 2px;
}

/* Input area */
.chat-input, .bottom-bar, .note-input {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 50;
    background: #FFFFFF;
    border-top: 1px solid #E0E6EB;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    box-shadow: 0 -2px 6px rgba(0,0,0,0.05);
}

    .chat-input .rz-textbox,
    .chat-input textarea.chat-textarea,
    .note-input input,
    .note-input textarea {
        flex: 1;
        border-radius: 12px;
        border: 1px solid #E0E6EB;
        background: #F9FAFB;
        font-size: 14px;
        color: #1E293B;
        padding: 8px 10px;
        font-family: inherit;
    }

    .chat-input textarea.chat-textarea {
        resize: none;
        overflow: hidden;
        min-height: 36px;
        max-height: 90px;
        transition: height .15s ease;
    }

        .chat-input textarea.chat-textarea:focus {
            outline: none;
        }

    .chat-input .rz-button, .new-convo-btn, .note-input .addButton {
        border-radius: 12px;
        background: #70AFFB;
        color: white;
        font-weight: 600;
        padding: 0.5rem 0.75rem;
        border: none;
        cursor: pointer;
        transition: background 0.2s ease;
    }

        .chat-input .rz-button:hover, .new-convo-btn:hover {
            background: #589AE8;
        }

.new-convo-btn {
    width: 100%;
    border-radius: 0.5rem;
}

/* Conversation list and cards */
.conversation-card {
    background: #FFFFFF;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border: 1px solid #E0E6EB;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
    cursor: pointer;
}

    .conversation-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    }

    .conversation-card.unread {
        background: #EFF6FF;
        border-left: 4px solid #70AFFB;
    }

.conversation-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.conversation-avatar {
    flex-shrink: 0;
    margin-right: 0.75rem;
}

.conversation-main {
    flex: 1;
    min-width: 0;
}

.conversation-title {
    font-weight: 600;
    font-size: .95rem;
    color: #1E293B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-preview {
    font-size: .85rem;
    color: #6C757D;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 0.25rem;
    margin-left: 0.75rem;
}

.thread-unread-badge {
    background: #70AFFB;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: .75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Avatars */
.avatar-single, .avatar-split, .avatar-grid {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
}

.avatar-single {
    background: #E5E7EB;
    align-items: center;
    justify-content: center;
}

.avatar-initials, .avatar-circle {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.avatar-initials, .avatar-circle {
    background: #70AFFB;
    color: #FFFFFF;
    font-size: 0.9rem;
}

.avatar-circle {
    background: #E0E6EB;
    color: #1E293B;
}

.avatar-split {
    display: flex;
}

    .avatar-split .half {
        width: 50%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .avatar-split .left {
        border-top-left-radius: 50%;
        border-bottom-left-radius: 50%;
    }

    .avatar-split .right {
        border-top-right-radius: 50%;
        border-bottom-right-radius: 50%;
    }

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(2,1fr);
    grid-template-rows: repeat(2,1fr);
    background: #E5E7EB;
}

.avatar-grid-item, .avatar-split img, .avatar-single img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Conversation reveal actions */
.conversation-card-container {
    position: relative;
    overflow: hidden;
}

.leave-thread-btn {
    position: absolute;
    right: -100px;
    top: 0;
    height: 90%;
    width: 84px;
    background: var(--rz-danger);
    color: white;
    border: none;
    font-weight: 700;
    transition: right .25s ease;
    z-index: 2;
}

.conversation-card-container.reveal .leave-thread-btn {
    right: 0;
}

/* Empty / placeholder states */
.chat-placeholder, .chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6C757D;
    text-align: center;
    padding: 0 20px;
    opacity: .8;
}

.chat-placeholder-icon {
    font-size: 48px;
    color: #CBD5E1;
    margin-bottom: 12px;
}

.chat-placeholder-text strong {
    color: #1E293B;
    font-size: 16px;
}

.chat-placeholder-text div {
    font-size: 14px;
    color: #6C757D;
    margin-top: 4px;
}

/* Notes UI */
.note-entry {
    background: #fff;
    border-radius: 8px;
    padding: .75rem 1rem;
    margin-bottom: .75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .25rem;
    font-size: .8rem;
    color: #6C757D;
}

.note-title {
    font-weight: 600;
    color: #1E293B;
    margin-bottom: .25rem;
}

.note-content {
    font-size: .9rem;
    color: #334155;
    white-space: pre-wrap;
}

.delete-btn {
    background: none;
    border: none;
    color: #EF4444;
    font-size: 1.6rem;
    cursor: pointer;
}

/* Last-read divider */
.last-read-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 12px 0;
    position: relative;
    font-size: 12px;
    color: #6C757D;
}

    .last-read-divider::before, .last-read-divider::after {
        content: "";
        flex: 1;
        border-bottom: 1px solid #E0E6EB;
    }

    .last-read-divider:not(:empty)::before {
        margin-right: .75em;
    }

    .last-read-divider:not(:empty)::after {
        margin-left: .75em;
    }

    .last-read-divider span {
        background: #F8F9FB;
        padding: 0 8px;
        color: #6C757D;
        font-weight: 500;
        border-radius: 6px;
    }

/* New chat container */
.new-chat-container {
    background: #FFFFFF;
    border-radius: 1rem;
    padding: 1.25rem;
    max-width: 450px;
    margin: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.new-chat-header {
    text-align: center;
    margin-bottom: 1rem;
}

    .new-chat-header h3 {
        font-size: 1.25rem;
        font-weight: 700;
        color: #1E293B;
        margin-bottom: .25rem;
    }

    .new-chat-header .subtext {
        color: #6C757D;
        font-size: .9rem;
    }

.new-chat-footer {
    display: flex;
    justify-content: center;
    gap: .5rem;
}

    .new-chat-footer .rz-button {
        min-width: 100px;
        border-radius: .5rem;
        font-weight: 600;
        font-size: .95rem;
    }

        .new-chat-footer .rz-button[disabled] {
            opacity: .6;
            cursor: not-allowed;
        }

/* Responsive tweaks */
@media (max-width:768px) {
    .chat-header, .messages-header, .notes-header {
        padding: 10px 16px;
    }

    .chat-feed {
        padding: 10px 16px;
    }

    .chat-input {
        padding: 6px 10px;
    }

    .new-chat-container {
        border-radius: 0;
        height: 100vh;
      
        max-width: none;
        box-shadow: none;
        padding: 1.25rem 1rem;
    }

    .new-chat-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: #FFFFFF;
        padding: 0.75rem 1rem;
        border-top: 1px solid #E0E6EB;
    }

    .cl-feature-hero-card, .cl-feature-hero-card h3, .cl-feature-hero-card p { /* keep placeholders if referenced elsewhere */
    }
}

/* End of optimized chat.css */


/* =============== */
/* DIALOG WRAPPER  */
/* =============== */
.cl-dialog {
    width: 100% !important;
    height: calc(100vh - 70px);
    display: flex;
    flex-direction: column;
    background: #F8F9FB;
    border-radius: 0;
    overflow: hidden;
}

/* =============== */
/* HEADER          */
/* =============== */
.cl-dialog-header {
    flex-shrink: 0;
    background: #70AFFB;
    color: white;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0,0,0,0.07);
}

    .cl-dialog-header h4 {
        margin: 0;
        font-size: 1.15rem;
    }

.cl-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.75rem;
    cursor: pointer;
    opacity: 0.95;
    transition: opacity .2s;
}

    .cl-close-btn:hover {
        opacity: 0.7;
    }

/* =============== */
/* SCROLL AREA     */
/* =============== */
.cl-dialog-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* Empty state */
.cl-empty-state {
    text-align: center;
    margin-top: 3rem;
    color: #6C757D;
}

    .cl-empty-state h5 {
        margin-top: 1rem;
        color: #1E293B;
    }

    .cl-empty-state p {
        margin: 0;
        font-size: .9rem;
    }

/* =============== */
/* NOTE CARDS      */
/* =============== */
.note-card.fp-card {
    background: #FFFFFF;
    border-radius: 14px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #E0E6EB;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.note-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .85rem;
    color: #6C757D;
    margin-bottom: .5rem;
}

.note-title {
    font-weight: 600;
    color: #1E293B;
    margin-bottom: .35rem;
}

.note-card-content {
    color: #334155;
    font-size: .95rem;
}

.note-delete {
    background: none;
    border: none;
    color: #EF4444;
    font-size: 1.4rem;
    cursor: pointer;
}

/* =============== */
/* FOOTER INPUT    */
/* =============== */
.cl-dialog-footer {
    position: sticky;
    bottom: 0;
    background: white;
    border-top: 1px solid #E0E6EB;
    padding: 1rem;
    padding-bottom: 50px;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    box-shadow: 0 -2px 6px rgba(0,0,0,0.05);
}

    .cl-dialog-footer input {
        border-radius: 12px;
        padding: .65rem .85rem;
        border: 1px solid #E0E6EB;
        background: #F9FAFB;
        font-size: .95rem;
        color: #1E293B;
    }

.cl-primary-btn {
    background: #70AFFB;
    color: white;
    border: none;
    border-radius: 12px;
    padding: .7rem 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s ease;
}

    .cl-primary-btn:hover {
        background: #589AE8;
    }

    .cl-primary-btn:disabled {
        opacity: .5;
        cursor: not-allowed;
    }


/* =============================================== */
/* ABSOLUTE FIX — bottom action bar ABOVE nav bar  */
/* =============================================== */

/* global bottom bar override */
.bottom-bar,
.new-chat-footer,
.chat-input {
    position: fixed !important;
    bottom: 72px !important; /* exact height above your middle mobile button */
    left: 0;
    width: 100%;
    z-index: 999999; /* above dialog overlays */
    background: #FFFFFF;
    border-top: 1px solid #E0E6EB;
    padding: 0.75rem 1rem;
    box-shadow: 0 -2px 6px rgba(0,0,0,0.08);
    padding-bottom: 40px;
}

/* Pad pages so list doesn't hide behind bottom bar */
.messages-page,
.chat-dialog,
.new-chat-container,
.rz-dialog-content {
    padding-bottom: 160px !important;
    background: #ECEBF0 !important;
}

/* New Conversation Button */
.new-convo-btn {
    width: 100%;
    border-radius: 12px;
    background: #70AFFB;
    color: white;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

    .new-convo-btn:hover {
        background: #589AE8;
    }

/* For Radzen fullscreen dialogs */
.rz-dialog {
    position: fixed !important;
    top: 0;
    left: 0;
    height: 100vh !important;
    width: 100vw !important;
    overflow: hidden !important;
}

/* Lock / inactive states */
.thread-locked-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #F97316; /* orange */
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.thread-locked {
    opacity: 0.9;
    position: relative;
}

.participant-inactive {
    position: absolute;
    right: -6px;
    top: -6px;
    background: #EF4444; /* red */
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 999px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.broadcast-bubble {
    background: linear-gradient(90deg, #FFD54F, #FFD27A);
    color: #1E293B;
    font-weight: 600;
}

.chat-input--disabled textarea.chat-textarea,
.chat-input--disabled .rz-button {
    opacity: 0.6;
    pointer-events: none;
}

.lock-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #FFF4E5;
    color: #92400E;
    padding: 8px 12px;
    border: 1px solid #FCD34D;
    border-radius: 8px;
    margin: 0 0 8px 0;
    font-size: 0.9rem;
}

.participant-badge-small {
    background: #E5E7EB;
    color: #334155;
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 0.75rem;
    margin-left: 6px;
}

/* Section header */
.section-header {
    margin-bottom: 1rem;
}

.section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1E293B;
}

/* Menu list wrapper */
.cl-menu-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

/* Each item → matches Dashboard/Clients/Menu list items */
.cl-menu-item {
    display: flex;
    align-items: center;
    gap: .9rem;
    background: #FFFFFF;
    padding: 1rem;
    border-radius: 14px;
    border: 1px solid #E0E6EB;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all .15s ease;
}

    .cl-menu-item:hover {
        transform: translateY(-2px);
        box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    }

/* Icon wrapper */
.cl-menu-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #F0F7FF;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .cl-menu-icon i {
        font-size: 22px;
        color: #70AFFB;
    }

/* Text area */
.cl-menu-text {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.cl-menu-title {
    font-size: .95rem;
    font-weight: 600;
    color: #1E293B;
}

.cl-menu-sub {
    font-size: .8rem;
    color: #6C757D;
    margin-top: 2px;
}
.cl-menu-icon-inner {
    font-size: 22px;
    color: #70AFFB;
}



/* Org selection list */
.org-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Each org item (menu-item style) */
.org-item {
    display: flex;
    align-items: center;
    background: #FFFFFF;
    border: 1px solid #E0E6EB;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    cursor: pointer;
    transition: background .2s ease, box-shadow .2s ease, transform .2s ease;
}

    .org-item:hover {
        background: #F3F7FF;
        box-shadow: 0 2px 6px rgba(0,0,0,0.06);
        transform: translateY(-2px);
    }

    /* Selected */
    .org-item.selected {
        border: 2px solid #70AFFB;
        background: #EFF6FF;
    }

/* Icon */
.org-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #E7F0FF;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
}

    .org-icon i {
        font-size: 20px;
        color: #70AFFB;
    }

/* Main text */
.org-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.org-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1E293B;
}

.org-type {
    font-size: 0.8rem;
    color: #6C757D;
}

/* Checkmark */
.org-check i {
    font-size: 22px;
    color: #70AFFB;
}
/* Participant selection list */
.participant-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

/* Participant item card */
.participant-item {
    display: flex;
    align-items: center;
    background: #FFFFFF;
    border: 1px solid #E0E6EB;
    border-radius: 14px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background .2s ease, border .2s ease, box-shadow .2s ease;
}

    .participant-item:hover {
        background: #F3F7FF;
        box-shadow: 0 3px 6px rgba(0,0,0,0.07);
    }

    /* Selected state */
    .participant-item.selected {
        border: 2px solid #70AFFB;
        background: #EFF6FF;
    }

/* Avatar */
.participant-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: #E5E7EB;
    margin-right: 1rem;
}

    .participant-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

/* Info */
.participant-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.participant-name {
    font-weight: 600;
    font-size: 1rem;
    color: #1E293B;
}

.participant-role {
    font-size: 0.8rem;
    color: #6C757D;
}

/* Checkmark */
.participant-check i {
    font-size: 22px;
    color: #70AFFB;
}

/* Broadcast banner */
.broadcast-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #EEF2FF; /* subtle blue */
    color: #3730A3; /* indigo */
    padding: 8px 12px;
    border: 1px solid #C7D2FE;
    border-radius: 8px;
    margin: 0 0 8px 0;
    font-size: 0.95rem;
}

/* Slight tweak to broadcast bubble to improve contrast */
.broadcast-bubble {
    background: linear-gradient(90deg, #FFF7ED, #FFF3E0);
    color: #0F172A;
    font-weight: 600;
    border: 1px solid rgba(0,0,0,0.04);
}
/* Selected thread */
.conversation-card.active-thread {
    background: #F1F6FF !important;
    border-left: 4px solid #70AFFB;
}

/* Row layout */
.conversation-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Card spacing */
.conversation-card-container {
    margin-bottom: 0.75rem;
}

/* Avatar polish */
.conversation-avatar img,
.avatar-single,
.avatar-grid,
.avatar-split {
    border: 2px solid #70AFFB22;
    border-radius: 50%;
}

/* Text hierarchy */
.conversation-title {
    font-weight: 600;
    font-size: .95rem;
    color: #1E293B;
}

.conversation-preview {
    font-size: .82rem;
    color: #64748B;
    margin-top: 2px;
}

/* Unread badge positioning */
.thread-unread-badge {
    transform: translateY(-2px);
}

/* Bottom bar premium look */
.bottom-bar {
    backdrop-filter: blur(6px);
}

/* List polish */
.conversation-list {
    padding-top: 1rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Card padding */
.conversation-card {
    padding: 0.75rem 1rem;
    border-radius: 12px;
}


/* Header container */
.chat-header {
    background: #70AFFB;
    color: #fff;
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 99;
}

/* Row wrapper */
.chat-participants-row {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Avatar block sizes */
.chat-avatar-block {
    flex-shrink: 0;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Title area */
.chat-title-block {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.chat-title-text {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

.chat-status-text {
    font-size: 0.75rem;
    color: #E8F1FF;
    margin-top: 2px;
}

/* Close button */
.chat-close-btn {
    margin-left: auto;
    color: #fff;
    background: none;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    padding: 0.25rem;
    cursor: pointer;
    opacity: 0.9;
}

    .chat-close-btn:hover {
        opacity: 0.7;
    }



/* Polished empty chat state */
.chat-empty-state {
    margin-top: 4rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 2rem;
    color: #6C757D;
    animation: fadeIn 0.4s ease;
    background: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

.empty-illustration {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: #E8F1FF;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

    .empty-illustration i {
        font-size: 38px;
        color: #70AFFB;
        opacity: 0.9;
    }

.empty-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1E293B;
    margin-bottom: 0.4rem;
}

.empty-subtitle {
    font-size: 0.9rem;
    color: #6C757D;
    margin-bottom: 1.5rem;
}

.empty-cta {
    background: #70AFFB;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    box-shadow: 0 3px 8px rgba(0,0,0,0.08);
    transition: background 0.2s ease, transform 0.15s ease;
}

    .empty-cta:hover {
        background: #5C9AE5;
        transform: translateY(-2px);
    }

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ============================
   CHat Input Bar (CoachLink)
   ============================ */

.cl-chat-input {
    position: fixed;
    bottom: 72px; /* clears your floating nav middle button */
    left: 0;
    width: 100%;
    background: #FFFFFF;
    padding: 12px 16px;
    border-top: 1px solid #E0E6EB;
    box-shadow: 0 -2px 6px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 9999;
    padding-bottom:40px;
}

    .cl-chat-input.disabled {
        opacity: 0.6;
        pointer-events: none;
    }

.cl-chat-textarea {
    flex: 1;
    resize: none;
    border-radius: 14px;
    border: 1px solid #D9DFE7;
    background: #F9FAFC;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.4;
    color: #1E293B;
    font-family: inherit;
    min-height: 38px;
    max-height: 110px;
    overflow-y: auto;
}

    .cl-chat-textarea:focus {
        outline: 2px solid #70AFFB;
        border-color: #70AFFB;
    }

.cl-chat-send-btn {
    background: #70AFFB;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(112,175,251,0.35);
    cursor: pointer;
    transition: background .2s, transform .15s;
}

    .cl-chat-send-btn:hover {
        background: #589AE8;
        transform: translateY(-2px);
    }

    .cl-chat-send-btn.disabled {
        background: #E5E7EB !important;
        color: #A0AEC0 !important;
        box-shadow: none !important;
        cursor: not-allowed;
        transform: none;
    }

.cl-send-icon {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    transform: translateX(1px);
}
.chat-row {
    display: flex;
    margin-bottom: 1rem;
    align-items: flex-start;
}

    .chat-row.right {
        justify-content: flex-end;
    }

.chat-avatar {
    margin-right: .6rem;
}

    .chat-avatar.me {
        order: 2;
        margin-left: .6rem;
        margin-right: 0;
    }

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--cl-primary, #70AFFB);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: .8rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}



.chat-meta {
    font-size: 0.7rem;
    color: var(--cl-text-secondary, #6C757D);
    margin-bottom: 2px;
}

    .chat-meta.me {
        text-align: right;
    }



    .chat-bubble.me {
        background: var(--cl-primary, #70AFFB);
        color: #fff;
        border: none;
    }

.chat-row.right .chat-bubble-container {
    align-items: flex-end;
}
/* Base bubble */


    /* Right side (current user) */
    .chat-bubble.me {
        background: var(--cl-primary, #70AFFB);
        color: #fff;
        border: none;
    }

/* Avatar hidden state */
.chat-avatar.hidden {
    visibility: hidden;
}

/* Stacked bubble (same sender, above one) */
.chat-bubble.stacked {
    margin-top: 2px;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

/* Keep bottom corners rounded unless there's a next message by same sender */
.chat-bubble.linked {
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* Meta alignment */
.chat-meta.me {
    text-align: right;
}

.chat-row {
    display: flex;
    margin-bottom: 6px;
}

    .chat-row.right {
        justify-content: flex-end;
    }

/* Avatar layout */
.chat-avatar {
    margin-right: .5rem;
}

    .chat-avatar.me {
        order: 2;
        margin-left: .5rem;
        margin-right: 0;
    }

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--cl-primary);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
}
/* Base avatar container */
.conversation-avatar {
    width: 48px;
    height: 48px;
    position: relative;
    flex-shrink: 0;
}

/* ---------------------------------------------
   SINGLE PERSON (normal avatar)
--------------------------------------------- */
.avatar-single {
    width: 100%;
    height: 100%;
}

.avatar-single img,
.avatar-single .avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;      /* only FULL avatar should be circular */
    object-fit: cover;
}


/* ---------------------------------------------
   TWO PEOPLE (split left/right)
--------------------------------------------- */
.avatar-split {
    width: 100%;
    height: 100%;
    display: flex;
    overflow: hidden;        /* needed for clean split */
    border-radius: 50%;      /* outer container is round */
    position: relative;
}

.avatar-split .half {
    width: 50%;
    height: 100%;
    overflow: hidden;        /* clean clipping */
}

.avatar-split .half img,
.avatar-split .half .avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;        /* IMPORTANT: no inner rounding */
}

/* Left and right spacing fix */
.avatar-split .left { border-right: 1px solid rgba(255,255,255,0.6); }
.avatar-split .right { border-left: 1px solid rgba(255,255,255,0.6); }



/* ---------------------------------------------
   3–4 PERSON GRID
--------------------------------------------- */
.avatar-grid {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 0px;
    padding: 0px;
    border-radius: 50%;      /* outer container is circle */
    overflow: hidden;        /* clip the inner squares */
    background: #E0E6EB;
}

.avatar-grid-item {
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 0px;       /* slightly rounded squares */
    background: #fff;
}

.avatar-grid-item img,
.avatar-grid-item .avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;        /* IMPORTANT */
}

/* Participant loading spinner */
.participant-loading {
    display:flex;
    align-items:center;
    padding:0.75rem 1rem;
    background:#fff;
    border:1px solid #E0E6EB;
    border-radius:12px;
}

.spinner {
    width:20px;
    height:20px;
    border-radius:50%;
    border:3px solid rgba(112,175,251,0.25);
    border-top-color:#70AFFB;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
