/* ==========================================================================
   HB Private Chat — minimal, theme-adoptable styles
   Colours, fonts, borders, and radii intentionally left to the theme where
   possible. Only layout and component-specific structure is defined here.
   ========================================================================== */

/* ---- Room list ---------------------------------------------------------- */

.hb-chat-rooms {
    max-width: 480px;
}

.hb-chat-rooms__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.hb-chat-rooms__link {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: .5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
}

.hb-chat-rooms__link:hover {
    text-decoration: underline;
}

.hb-chat-rooms__dropdown-wrap {
    display: flex;
    gap: .5rem;
    align-items: center;
}

.hb-chat-rooms__select {
    flex: 1;
    min-height: 44px;
    padding: .25rem .5rem;
}

.hb-chat-rooms__go-btn {
    min-height: 44px;
    padding: .25rem 1rem;
    cursor: pointer;
}

/* ---- Chat container ----------------------------------------------------- */

.hb-chat {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    max-width: 720px;
}

/* ---- Header ------------------------------------------------------------- */

.hb-chat__header {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.hb-chat__title {
    flex: 1;
    margin: 0;
    font-size: 1.1em;
}

.hb-chat__back {
    text-decoration: none;
    white-space: nowrap;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* ---- Message list ------------------------------------------------------- */

.hb-chat__messages {
    min-height: 260px;
    max-height: 60vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: .625rem;
    padding: .25rem 0;
}

.hb-chat__loading {
    opacity: .6;
    font-style: italic;
    text-align: center;
    padding: 1rem 0;
}

/* ---- Individual message ------------------------------------------------- */

.hb-chat__message {
    max-width: 80%;
    padding: .5rem .75rem;
    border-radius: 6px;
    align-self: flex-start;
    /* background comes from theme or default below */
    background-color: #f0f0f0;
}

.hb-chat__message--own {
    align-self: flex-end;
    background-color: #dceeff;
}

.hb-chat__meta {
    display: flex;
    gap: .5rem;
    align-items: baseline;
    margin-bottom: .25rem;
    font-size: .75em;
    opacity: .65;
}

.hb-chat__time {
    cursor: pointer;
    text-decoration-line: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}

.hb-chat__tooltip {
    position: fixed;
    z-index: 9999;
    padding: .25rem .5rem;
    background: rgba(0, 0, 0, .78);
    color: #fff;
    font-size: .75em;
    border-radius: 3px;
    white-space: nowrap;
    pointer-events: none;
    transform: translateY(-100%);
}

.hb-chat__text {
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

.hb-chat__toggle {
    display: inline-block;
    margin-top: .25rem;
    background: none;
    border: none;
    padding: 0;
    font-size: .75em;
    cursor: pointer;
    text-decoration: underline;
    opacity: .6;
    color: inherit;
}

.hb-chat__toggle:hover {
    opacity: 1;
}

/* ---- Error banner -------------------------------------------------------- */

.hb-chat__error {
    padding: .5rem .75rem;
    border-radius: 4px;
    font-size: .875em;
    color: #c0392b;
    border: 1px solid currentColor;
}

/* ---- Input area --------------------------------------------------------- */

.hb-chat__input-area {
    display: flex;
    gap: .5rem;
    align-items: center;
}

.hb-chat__input-wrap {
    flex: 1;
    position: relative;
}

.hb-chat__input {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    padding: .5rem;
    padding-bottom: 1.4rem; /* room for char counter */
    font-family: inherit;
    font-size: inherit;
    min-height: 44px;
}

.hb-chat__char-count {
    position: absolute;
    bottom: .8rem;
    right: .5rem;
    font-size: .7em;
    opacity: .5;
    pointer-events: none;
    line-height: 1;
}

/* ---- Participants panel (admin only) ------------------------------------ */

.hb-chat__members {
    padding-top: .75rem;
}

.hb-chat__members-title {
    margin: 0 0 .5rem;
    font-size: 1em;
}

.hb-chat__member-list {
    list-style: none;
    margin: 0 0 .625rem;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: .375rem;
}

.hb-chat__member-item {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .2rem .5rem;
    border-radius: 3px;
    background: #f0f0f0;
    font-size: .875em;
}

.hb-chat__remove-member {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 1em;
    line-height: 1;
    opacity: .55;
    min-width: 18px;
    min-height: 18px;
}

.hb-chat__remove-member:hover {
    opacity: 1;
}

.hb-chat__add-member {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap;
}

.hb-chat__user-select {
    flex: 1;
    min-width: 160px;
    min-height: 44px;
    padding: .25rem .5rem;
}

/* ---- Misc --------------------------------------------------------------- */

.hb-chat-notice {
    font-style: italic;
    opacity: .7;
}

.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

/* ---- Language gate (first-visit language selection) -------------------- */

.hb-chat__lang-gate {
    padding: 2rem 1rem;
    text-align: center;
}

.hb-chat__lang-gate-prompt {
    margin: 0 0 1rem;
}

.hb-chat__lang-gate-options {
    display: flex;
    gap: .75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.hb-chat__lang-option {
    min-height: 44px;
    min-width: 44px;
    padding: .5rem 1.5rem;
    cursor: pointer;
    font-size: 1em;
}

/* ---- Responsive --------------------------------------------------------- */

@media (max-width: 600px) {
    .hb-chat__message {
        max-width: 95%;
    }
    .hb-chat__input-area {
        flex-direction: column;
        align-items: stretch;
    }
    .hb-chat__send-btn {
        width: 100%;
    }
}
