/* ============================================================
   Style for the PeerChat Chat/Comment Log Widget
   ============================================================ */

.chat-inbox {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 910;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Trigger button */
.chat-inbox__trigger {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary, #2563EB);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    position: relative;
}

.chat-inbox__trigger:hover {
    background: var(--primary-dark, #1D4ED8);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

.chat-inbox__trigger:active {
    transform: scale(0.97);
}

/* Badge */
.chat-inbox__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: var(--danger, #EF4444);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    line-height: 1;
    border: 2px solid #fff;
}

/* Panel */
.chat-inbox__panel {
    position: absolute;
    bottom: 68px;
    right: 0;
    width: 380px;
    min-height: 800px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border-color, #E2E8F0);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.chat-inbox__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color, #E2E8F0);
    flex-shrink: 0;
}

.chat-inbox__title {
    font-size: 16px;
    font-weight: 600;
    color: #1E293B;
    margin: 0;
}

/* Detail header */
.chat-inbox__detail-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color, #E2E8F0);
    flex-shrink: 0;
}

.chat-inbox__back-btn {
    background: none;
    border: none;
    color: var(--primary, #2563EB);
    cursor: pointer;
    font-size: 13px;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-inbox__back-btn:hover {
    text-decoration: underline;
}

/* Conversation list */
.chat-inbox__list {
    overflow-y: auto;
    flex: 1;
    max-height: 420px;
}

.chat-inbox__conversation-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #F1F5F9;
    transition: background 0.15s;
    cursor: pointer;
}

.chat-inbox__conversation-item:hover {
    background: #F8FAFC;
}

.chat-inbox__conversation-item--unread {
    background: #EFF6FF;
}

.chat-inbox__conversation-item--unread:hover {
    background: #DBEAFE;
}

.chat-inbox__conversation-item--relevant {
    border-left: 3px solid var(--primary, #2563EB);
}

.chat-inbox__conversation-info {
    flex: 1;
    min-width: 0;
}

.chat-inbox__conversation-title {
    font-size: 13px;
    font-weight: 600;
    color: #1E293B;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-inbox__conversation-preview {
    font-size: 12px;
    color: var(--muted, #64748B);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-inbox__conversation-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.chat-inbox__conversation-time {
    font-size: 11px;
    color: var(--muted, #64748B);
    white-space: nowrap;
}

/* Unread indicators */
.chat-inbox__unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary, #2563EB);
    flex-shrink: 0;
}

.chat-inbox__unread-count {
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--primary, #2563EB);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Empty state */
.chat-inbox__empty {
    padding: 40px 16px;
    text-align: center;
    color: var(--muted, #64748B);
}

.chat-inbox__empty p {
    margin: 0 0 4px;
    font-size: 14px;
}

.chat-inbox__empty-hint {
    font-size: 12px;
    color: #94A3B8;
}

/* Composer (new chat) */
.chat-inbox__composer {
    padding: 16px;
}

.chat-inbox__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted, #64748B);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: block;
}

.chat-inbox__finder-wrapper {
    position: relative;
    width: 100%;
}

.chat-inbox__search-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color, #E2E8F0);
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.chat-inbox__search-input:focus {
    border-color: var(--primary, #2563EB);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.chat-inbox__search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 911;
    max-height: 180px;
    overflow-y: auto;
}

.chat-inbox__selected-recipients {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.chat-inbox__recipient-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eef2ff;
    color: #1e3a8a;
    border: 1px solid #c7d2fe;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
}

.chat-inbox__recipient-chip-remove {
    border: none;
    background: transparent;
    color: #1e3a8a;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    padding: 0;
}

.chat-inbox__composer-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

/* Chat conversation in panel - compact overrides */
.chat-inbox__panel .peer-chat {
    border: none;
    border-radius: 0;
    box-shadow: none;
    max-height: 420px;
    display: flex;
    flex-direction: column;
}

.chat-inbox__panel .peer-chat__messages {
    flex: 1;
    overflow-y: auto;
    max-height: 320px;
}

.chat-inbox__panel .peer-chat__header {
    padding: 8px 12px;
    font-size: 13px;
}

.chat-inbox__panel .peer-chat-message__avatar {
    width: 28px;
    height: 28px;
    font-size: 10px;
}

.chat-inbox__panel .peer-chat-message__content {
    font-size: 13px;
}

.chat-inbox__panel .peer-chat-message__timestamp {
    font-size: 10px;
}

/* Responsive: full screen on mobile */
@media (max-width: 480px) {
    .chat-inbox__panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .chat-inbox__list {
        max-height: none;
    }
}