/* ── Sutalis Comms — Signal Hub — design system aligned with Sutalis app.css ── */

/* ── Signal Hub outer shell ──────────────────────────────────────────── */
.sh-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.sh-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 52px;
    background: var(--bg-elevated);
    border-bottom: 1px solid rgba(255,255,255,0.02);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    flex-shrink: 0;
    z-index: 10;
}

.sh-brand {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent-light);
}

.sh-top-right {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.sh-status-badge {
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
    background: rgba(144,112,216,0.12);
    color: var(--accent-light);
    border: 1px solid rgba(144,112,216,0.25);
}

/* ── Shell layout ────────────────────────────────────────────────────── */
.comms-shell {
    display: grid;
    grid-template-columns: 210px 1fr 180px;
    flex: 1;
    overflow: hidden;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
}

@media (max-width: 860px) {
    .comms-shell { grid-template-columns: 180px 1fr; }
    .comms-sidebar-right { display: none; }
}
@media (max-width: 560px) {
    .comms-shell { grid-template-columns: 1fr; }
    .comms-sidebar-left { display: none; }
}

/* ── Sidebars ───────────────────────────────────────────────────────── */
.comms-sidebar {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    border-right: 1px solid rgba(255,255,255,0.02);
    overflow: hidden;
}
.comms-sidebar-right {
    border-right: none;
    border-left: 1px solid rgba(255,255,255,0.02);
}

.comms-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255,255,255,0.04);
    flex-shrink: 0;
}

.comms-sidebar-header button {
    padding: 0 6px;
    font-size: 18px;
    line-height: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: color .12s;
}
.comms-sidebar-header button:hover { color: var(--accent-light); }

.comms-sidebar-section {
    padding: 12px 14px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-top: 1px solid rgba(255,255,255,0.04);
    margin-top: 2px;
    flex-shrink: 0;
}

.comms-nav-list {
    overflow-y: auto;
    flex: 1;
    padding: 3px 0;
}

.comms-nav-item {
    display: flex;
    flex-direction: column;
    width: 100%;
    text-align: left;
    padding: 7px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-left: 2px solid transparent;
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}
.comms-nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-left-color: rgba(144,112,216,0.35);
}
.comms-relay-name {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.comms-relay-preview {
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 1px;
    font-weight: 400;
}
.comms-nav-item.active {
    background: linear-gradient(to right, var(--accent-dim), transparent);
    color: var(--accent-light);
    border-left-color: var(--accent);
    font-weight: 600;
}
.comms-nav-item.active .comms-relay-preview {
    color: var(--text-secondary);
}

.comms-sidebar-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.comms-identity {
    font-size: 11px;
    color: var(--text-muted);
    padding: 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.comms-identity strong { color: var(--text-secondary); }

.comms-create-channel {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

/* ── Main feed ────────────────────────────────────────────────────────── */
.comms-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

.comms-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-muted);
}
.comms-empty-icon { font-size: 36px; opacity: .35; }
.comms-empty-text { font-size: 13px; color: var(--text-muted); }

.comms-feed-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px;
    height: 48px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.comms-feed-header-desc {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
}

.comms-feed {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px 8px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── Messages ─────────────────────────────────────────────────────────── */
.comms-msg {
    display: flex;
    flex-direction: column;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background .1s;
    margin: 1px 0;
}
.comms-msg:hover {
    background: var(--bg-elevated);
}

.comms-msg-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 1px;
}

.comms-msg-author {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-light);
}

.comms-msg-time {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity .15s;
}
.comms-msg:hover .comms-msg-time { opacity: 1; }

.comms-msg-body {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-primary);
    word-break: break-word;
    white-space: pre-wrap;
    max-width: 72ch;
}

.comms-msg-body a {
    color: var(--accent-light);
    text-decoration: none;
}
.comms-msg-body a:hover { text-decoration: underline; }

/* Load older button */
.comms-load-more {
    align-self: center;
    margin-bottom: 10px;
}

/* ── File attachments ──────────────────────────────────────────────────── */
.comms-file-img img {
    display: block;
    max-width: min(420px, 100%);
    max-height: 320px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-top: 6px;
    object-fit: contain;
}
.comms-file-video video {
    display: block;
    max-width: min(420px, 100%);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-top: 6px;
}

.comms-file-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    padding: 7px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-top: 6px;
    transition: border-color .12s;
}
.comms-file-link:hover { border-color: var(--accent); }
.comms-file-link a {
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.comms-file-size { color: var(--text-muted); font-size: 11px; }
.comms-file-expired { font-size: 12px; color: var(--text-muted); font-style: italic; padding: 4px 0; }

/* ── Compose bar ─────────────────────────────────────────────────────────── */
.comms-compose {
    padding: 10px 16px 14px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-surface);
}

.comms-compose-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.comms-input {
    flex: 1;
    resize: none;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13.5px;
    padding: 8px 12px;
    line-height: 1.5;
    max-height: 130px;
    overflow-y: auto;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.comms-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.comms-attach-label {
    cursor: pointer;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    width: 36px;
    font-size: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: border-color .12s, color .12s;
}
.comms-attach-label:hover { border-color: var(--accent); color: var(--accent-light); }

.comms-attachment-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    margin-bottom: 8px;
}

.comms-expiry-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Invite / recovery code pill ────────────────────────────────────────── */
.comms-code-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: monospace;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--accent-light);
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    margin-top: 10px;
    word-break: break-all;
}
.comms-code-hint {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    font-family: inherit;
    letter-spacing: normal;
}

/* ── User/member badges ─────────────────────────────────────────────────── */
.comms-badge {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-left: 6px;
    vertical-align: middle;
}
.comms-badge-owner {
    background: var(--accent-dim);
    color: var(--accent-light);
}
.comms-badge-inactive {
    background: rgba(158,74,74,.18);
    color: var(--danger);
}

/* ── Confirm delete row ──────────────────────────────────────────────────── */
.comms-delete-confirm {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(158,74,74,.10);
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
    flex-wrap: wrap;
}

/* ── Own-message differentiation ─────────────────────────────────────── */
.comms-msg-own {
    background: rgba(var(--accent-rgb), 0.04);
    border-left: 2px solid var(--accent-dim);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding-left: 10px;
}
.comms-msg-own:hover {
    background: rgba(var(--accent-rgb), 0.08);
}
.comms-msg-own .comms-msg-author {
    color: var(--accent);
}

/* ── Message states & actions ────────────────────────────────────────── */
.comms-msg-deleted {
    font-style: italic;
    color: var(--text-muted);
    font-size: 12px;
    padding: 2px 0;
}

.comms-msg-edited {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: 6px;
    font-style: italic;
}

.comms-msg-actions {
    display: inline-flex;
    gap: 2px;
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.15s;
    align-items: center;
}

.comms-msg:hover .comms-msg-actions {
    opacity: 1;
}

.comms-action-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    line-height: 1.4;
    transition: color 0.15s, background 0.15s;
}

.comms-action-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    border-color: var(--border);
}

.comms-action-delete:hover {
    color: var(--danger);
}

.comms-edit-row {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    margin-top: 4px;
}

/* ── Unread dot on relay nav-items ───────────────────────────────────── */
.comms-unread-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-light);
    margin-left: 5px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ── Sidebar section headers ─────────────────────────────────────────── */
.comms-sidebar-section {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 10px 10px 4px;
    text-transform: uppercase;
    pointer-events: none;
}

/* ── Member chips in group creation panel ────────────────────────────── */
.comms-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    color: var(--accent-light);
    font-size: 11px;
    cursor: pointer;
    transition: background .15s;
}
.comms-chip:hover { background: var(--accent); color: #fff; }

/* ── Burn vote banner below feed header ──────────────────────────────── */
.comms-burn-banner {
    padding: 6px 16px;
    background: rgba(158, 74, 74, .12);
    border-bottom: 1px solid var(--danger);
    font-size: 12px;
    color: var(--danger);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Burn dot on nav items ───────────────────────────────────────────── */
.comms-burn-dot {
    font-size: 10px;
    margin-left: 4px;
    vertical-align: middle;
}
