/* =============================================================
   EWI Community — community.css
   Relies on theme CSS variables: --bg, --bg-alt, --bg-card,
   --text, --text-muted, --border, --accent
   ============================================================= */

/* ── Layout ─────────────────────────────────────────────────── */

/*
 * Fixed full-viewport layout — community sits below the theme nav (--ewi-nav-h)
 * and optionally the WP admin bar. The page body never scrolls.
 */
:root { --ewi-nav-h: 70px; }

.ewi-community {
    position: fixed;
    top: var(--ewi-nav-h, 70px);
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1200px;
    bottom: 0;
    height: auto;
    z-index: 200;
    overflow: hidden;
    display: flex;
    background: var(--bg, #0d0d0d);
    color: var(--text, #e0e0e0);
    font-family: inherit;
}

/* WP admin bar: desktop 32px, tablet/mobile ≤782px 46px */
.admin-bar .ewi-community {
    top: calc(var(--ewi-nav-h, 70px) + var(--wp-admin--admin-bar--height, 32px));
}
@media screen and (max-width: 782px) {
    .admin-bar .ewi-community {
        top: calc(var(--ewi-nav-h, 70px) + 46px);
    }
}

/* ── Login gate ──────────────────────────────────────────────── */
.ewi-c-gate {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 40px 20px;
}

.ewi-c-gate--error .ewi-c-gate__inner {
    background: rgba(255, 90, 90, 0.06);
    border-color: rgba(255, 90, 90, 0.25);
}

.ewi-c-gate__inner {
    text-align: center;
    max-width: 420px;
    background: var(--bg-card, var(--bg-alt, #131313));
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 14px;
    padding: 40px 32px;
}

.ewi-c-gate__icon {
    font-size: 2.2rem;
    margin-bottom: 14px;
}

.ewi-c-gate__title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 10px;
    color: var(--text, #e0e0e0);
}

.ewi-c-gate__desc {
    font-size: 0.9rem;
    color: var(--text-muted, #888);
    margin: 0 0 24px;
    line-height: 1.6;
}

.ewi-c-gate__btn {
    display: inline-block;
    background: var(--accent, #4DA3FF);
    color: #000;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 10px 24px;
    border-radius: 6px;
    text-decoration: none;
    transition: opacity 0.15s;
}

.ewi-c-gate__btn:hover { opacity: 0.88; }

/*
 * Theme content wrappers (.entry-content etc.) can break the flex layout.
 * Collapse them so they don't add block context inside .ewi-community.
 */
.ewi-community .entry-content,
.ewi-community .page-content,
.ewi-community .site-content,
.ewi-community .wp-block-group {
    display: contents !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
}

/* ── App shell ───────────────────────────────────────────────── */
.ewi-c-app {
    display: flex;
    flex-direction: row !important;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.ewi-c-sidebar {
    display: flex;
    flex-direction: column;
    width: 240px !important;
    height: 100%;
    flex-shrink: 0 !important;
    background: var(--bg-alt, #111);
    border-right: 1px solid var(--border, #2a2a2a);
    overflow: hidden;
}

.ewi-c-sidebar__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border, #2a2a2a);
    flex-shrink: 0;
}

.ewi-c-sidebar__logo {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    background: var(--accent, #4DA3FF);
    color: #000;
    padding: 3px 7px;
    border-radius: 4px;
}

.ewi-c-sidebar__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text, #e0e0e0);
}

.ewi-c-channels {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0 8px;
}

/* ── Top-level category ──────────────────────────────────────── */
.ewi-cat { margin-bottom: 2px; }

.ewi-cat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: transparent;
    border: none;
    padding: 7px 14px 5px;
    cursor: pointer;
    color: var(--text-muted, #666);
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-align: left;
}

.ewi-cat__header:hover { color: var(--text, #bbb); }

.ewi-cat__label { flex: 1; }

.ewi-cat__arrow {
    display: inline-block;
    font-size: 0.75rem;
    transform: rotate(-90deg);
    transition: transform 0.2s ease;
    opacity: 0.6;
}

.ewi-cat__arrow.is-open { transform: rotate(0deg); }

/* Unread indicator on the category header itself — visible whether the
   section is collapsed or expanded, so collapsing it never hides the
   fact that something inside is unread. Presence dot, not a count: this
   is a "something's here" signal for a whole group, not a precise
   number the way the per-channel badge is. */
.ewi-cat__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent, #4DA3FF);
    margin-right: 6px;
    flex-shrink: 0;
}

.ewi-cat__body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.28s ease;
}

.ewi-cat__body.is-open { max-height: 1400px; }

/* ── Market sub-category ─────────────────────────────────────── */
.ewi-subcat { margin-bottom: 1px; }

.ewi-subcat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: transparent;
    border: none;
    padding: 5px 14px 4px 22px;
    cursor: pointer;
    color: var(--text-muted, #555);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-align: left;
}

.ewi-subcat__header:hover { color: var(--text-muted, #888); }

.ewi-subcat__label { flex: 1; }

.ewi-subcat__arrow {
    display: inline-block;
    font-size: 0.65rem;
    transform: rotate(-90deg);
    transition: transform 0.18s ease;
    opacity: 0.5;
}

.ewi-subcat__arrow.is-open { transform: rotate(0deg); }

/* Same presence-dot pattern as .ewi-cat__dot, one size down to match this
   header's smaller scale. */
.ewi-subcat__dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent, #4DA3FF);
    margin-right: 5px;
    flex-shrink: 0;
}

.ewi-subcat__body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.22s ease;
}

.ewi-subcat__body.is-open { max-height: 600px; }

/* ── Individual channel item ─────────────────────────────────── */
.ewi-channel-item {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    background: transparent;
    border: none;
    padding: 5px 14px 5px 30px;
    cursor: pointer;
    color: var(--text-muted, #777);
    font-size: 0.82rem;
    text-align: left;
    transition: background 0.1s, color 0.1s;
    border-radius: 0;
    line-height: 1.3;
}

.ewi-channel-item:hover:not(.is-locked) {
    background: rgba(255,255,255,0.05);
    color: var(--text, #ddd);
}

.ewi-channel-item.is-active {
    background: rgba(77,163,255,0.12);
    color: var(--accent, #4DA3FF);
    font-weight: 600;
}

.ewi-channel-item.is-locked {
    opacity: 0.38;
    cursor: not-allowed;
}

/* Non-market channels sit at the category level — slightly more indent */
.ewi-cat__body > .ewi-channel-item { padding-left: 20px; }

.ewi-channel-item__hash {
    color: var(--text-muted, #555);
    font-size: 0.85em;
    flex-shrink: 0;
}

.ewi-channel-item.is-active .ewi-channel-item__hash { color: var(--accent, #4DA3FF); opacity: 0.7; }

.ewi-channel-item__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ewi-channel-item__lock {
    font-size: 0.7em;
    margin-left: auto;
    flex-shrink: 0;
}

/* Unread badge */
.ewi-channel-unread {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--accent, #4DA3FF);
    color: #000;
    font-size: 0.6rem;
    font-weight: 800;
    border-radius: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

/* Sidebar user strip */
.ewi-c-sidebar__user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid var(--border, #2a2a2a);
    flex-shrink: 0;
}

.ewi-c-sidebar__user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-card, #1a1a1a);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.ewi-c-sidebar__user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.ewi-c-sidebar__user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text, #e0e0e0);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ewi-c-sidebar__username {
    font-weight: 400;
    color: var(--text-muted, #888);
}

.ewi-c-sidebar__user-role {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent, #4DA3FF);
    background: rgba(77,163,255,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

/* ── Main area ───────────────────────────────────────────────── */
.ewi-c-main {
    flex: 1 !important;
    min-width: 0 !important;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--bg, #0d0d0d);
}

.ewi-c-main__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border, #2a2a2a);
    flex-shrink: 0;
}

.ewi-c-main__hash {
    color: var(--text-muted, #555);
    font-size: 1.1rem;
}

.ewi-c-main__name {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: var(--text, #e0e0e0);
}

.ewi-c-main__status {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--text-muted, #666);
}

.ewi-c-pinned-toggle {
    background: none;
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.75rem;
    color: var(--text-muted, #888);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.1s, color 0.1s;
}

.ewi-c-pinned-toggle:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text, #ddd);
}

/* Pinned-messages list — same content area as normal messages, so it
   inherits .ewi-c-msg's own styling for each entry; this just adds the
   "back" affordance and the empty state. */
.ewi-c-pinned-back {
    display: block;
    margin: 12px 20px;
    padding: 7px 12px;
    background: none;
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-muted, #888);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.1s, color 0.1s;
}

.ewi-c-pinned-back:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text, #ddd);
}

.ewi-c-main__status.is-live { color: #4caf72; }

/* ── Messages ────────────────────────────────────────────────── */
.ewi-c-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 16px 80px; /* bottom pad clears fixed composer */
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 900px;
    width: 100%;
    align-self: center;
}

.ewi-c-no-channel,
.ewi-c-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted, #666);
    font-size: 0.875rem;
    flex: 1;
}

.ewi-c-loading-small {
    padding: 12px 16px;
    font-size: 0.8rem;
    color: var(--text-muted, #666);
}

/* ── Individual message ──────────────────────────────────────── */
.ewi-c-msg {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 8px 20px;
    transition: background 0.1s;
}

.ewi-c-msg:hover { background: rgba(255,255,255,0.02); }

/* Hover-reveal quick-react trigger — the discoverable path onto the
   same toggleReaction()/emoji set the right-click menu's React row
   already uses. Hidden until hover on devices that have one; on touch
   (hover:none) there's no hover state to reveal it, so it stays
   visible at reduced opacity instead, always reachable with a direct
   tap rather than needing a hover that can't happen. */
.ewi-c-msg__quick-react {
    position: absolute;
    top: 4px;
    right: 16px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card, #1e1e1e);
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 6px;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity 0.12s, transform 0.12s, background 0.1s;
}

.ewi-c-msg:hover .ewi-c-msg__quick-react,
.ewi-c-msg__quick-react:focus-visible {
    opacity: 1;
    transform: translateY(0);
}

.ewi-c-msg__quick-react:hover { background: rgba(255,255,255,0.12); }

@media (hover: none) {
    .ewi-c-msg__quick-react {
        opacity: 0.55;
        transform: none;
    }
}

/* Deep link (a notification's ?channel=&message= URL) briefly highlights
   the target message once scrolled into view, then fades — same
   transition the element already has for its hover state. */
.ewi-c-msg--deep-linked { background: rgba(77,163,255,0.12); }

.ewi-c-msg--reply {
    padding-left: 28px;
    border-left: 2px solid var(--border, #2a2a2a);
    margin-left: 52px;
}

.ewi-c-msg__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-card, #1a1a1a);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted, #888);
}

.ewi-c-msg--reply .ewi-c-msg__avatar {
    width: 24px;
    height: 24px;
    font-size: 0.65rem;
}

.ewi-c-msg__avatar img { width: 100%; height: 100%; object-fit: cover; }

.ewi-c-msg__body { flex: 1; min-width: 0; }

.ewi-c-msg__header {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.ewi-c-msg__name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text, #e0e0e0);
}

.ewi-c-msg__username {
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--text-muted, #888);
}

.ewi-c-msg__time {
    font-size: 0.72rem;
    color: var(--text-muted, #666);
}

.ewi-c-msg__edited {
    font-size: 0.68rem;
    color: var(--text-muted, #666);
    font-style: italic;
}

/* Pinned-message badge — deliberately just an icon, no background tint,
   so a channel with several pinned messages doesn't visually dominate
   the list. */
.ewi-c-msg__pin {
    font-size: 0.72rem;
    line-height: 1;
}

/* Role badges */
.ewi-c-badge {
    font-size: 0.63rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
}

.ewi-c-badge--admin   { background: rgba(255,200,50,0.15);  color: #e8b830; }
.ewi-c-badge--analyst { background: rgba(77,163,255,0.15);  color: #4DA3FF; }
.ewi-c-badge--premium { background: rgba(76,175,114,0.15);  color: #4caf72; }

.ewi-c-msg__text {
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--text, #d0d0d0);
    word-break: break-word;
    white-space: pre-wrap;
}

.ewi-c-msg__image { margin-top: 8px; }

.ewi-c-msg__img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    border: 1px solid var(--border, #2a2a2a);
    display: block;
}

/* Reactions */
.ewi-c-msg__reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
    align-items: center;
    position: relative;
}

.ewi-c-reaction {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 12px;
    padding: 3px 9px;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--text-muted, #888);
    transition: background 0.1s, border-color 0.1s;
}

.ewi-c-reaction:hover { background: rgba(255,255,255,0.09); }

.ewi-c-reaction.is-reacted {
    background: rgba(77,163,255,0.12);
    border-color: rgba(77,163,255,0.35);
    color: var(--accent, #4DA3FF);
}

.ewi-c-reaction-add {
    background: transparent;
    border: 1px dashed var(--border, #333);
    border-radius: 12px;
    padding: 3px 9px;
    font-size: 0.75rem;
    color: var(--text-muted, #666);
    cursor: pointer;
}

.ewi-c-reaction-add:hover { border-color: var(--accent, #4DA3FF); color: var(--accent, #4DA3FF); }

.ewi-c-reaction-picker {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    display: flex;
    gap: 4px;
    background: var(--bg-card, #1a1a1a);
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 8px;
    padding: 6px 8px;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.ewi-c-reaction-pick {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 3px 5px;
    border-radius: 5px;
    transition: background 0.1s;
}

.ewi-c-reaction-pick:hover { background: rgba(255,255,255,0.08); }

/* Message actions */
.ewi-c-msg__actions {
    display: none;
    gap: 8px;
    margin-top: 4px;
}

.ewi-c-msg:hover .ewi-c-msg__actions { display: flex; }

.ewi-c-msg__actions button {
    background: none;
    border: none;
    font-size: 0.75rem;
    color: var(--text-muted, #777);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}

.ewi-c-msg__actions button:hover { background: rgba(255,255,255,0.06); color: var(--text, #e0e0e0); }

.ewi-c-msg-delete:hover { color: #ff5a5a !important; }

/* Right-click context menu */
.ewi-c-ctx {
    background: var(--bg-card, #1e1e1e);
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    min-width: 130px;
}

.ewi-c-ctx__item {
    display: block;
    width: 100%;
    background: none;
    border: none;
    padding: 7px 12px;
    text-align: left;
    font-size: 0.8rem;
    color: var(--text, #e0e0e0);
    cursor: pointer;
    border-radius: 5px;
    font-family: inherit;
    transition: background 0.1s;
}

.ewi-c-ctx__item:hover { background: rgba(255,255,255,0.07); }

.ewi-c-ctx__item--danger { color: #ff5a5a; }
.ewi-c-ctx__item--danger:hover { background: rgba(255,90,90,0.08); }

/* Emoji row inside context menu */
.ewi-c-ctx__emoji-row {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 4px;
    max-width: 216px;
}

.ewi-c-ctx__emoji {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 5px;
    border-radius: 5px;
    line-height: 1;
    transition: background 0.1s;
}

.ewi-c-ctx__emoji:hover { background: rgba(255,255,255,0.1); }

/* @mention autocomplete dropdown */
.ewi-c-mention-dropdown {
    background: var(--bg-card, #1e1e1e);
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    max-height: 220px;
    overflow-y: auto;
    z-index: 9990;
}

.ewi-c-mention-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
    width: 100%;
    background: none;
    border: none;
    padding: 7px 10px;
    text-align: left;
    cursor: pointer;
    border-radius: 5px;
    font-family: inherit;
}

.ewi-c-mention-item:hover,
.ewi-c-mention-item.is-active { background: rgba(255,255,255,0.08); }

.ewi-c-mention-item__name {
    font-size: 0.82rem;
    color: var(--text, #e0e0e0);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ewi-c-mention-item__login {
    font-size: 0.72rem;
    color: var(--text-muted, #888);
    flex-shrink: 0;
    margin-left: auto;
}

/* Synthetic "@everyone" entry — staff-only, injected client-side (see
   withEveryoneOption() in community.js), not a real CommunityUser row. */
.ewi-c-mention-item--everyone .ewi-c-mention-item__name { color: var(--accent, #4da3ff); font-weight: 600; }

/* Replies container */
.ewi-c-msg__replies {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ── Compose ─────────────────────────────────────────────────── */
.ewi-c-compose {
    position: fixed;
    bottom: 0;
    left: 240px; /* flush with sidebar right edge */
    right: 0;
    z-index: 100;
    background: var(--bg-alt, #111);
    border-top: 1px solid var(--border, #2a2a2a);
    padding: 12px 16px;
}

@media (max-width: 480px) {
    .ewi-c-compose { left: 180px; }
}

.ewi-c-reply-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted, #888);
    padding: 4px 0 8px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.ewi-c-reply-cancel {
    background: none;
    border: none;
    color: var(--text-muted, #888);
    cursor: pointer;
    font-size: 1rem;
    padding: 0 4px;
    margin-left: auto;
}

.ewi-c-reply-cancel:hover { color: #ff5a5a; }

.ewi-c-compose__inner {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--bg-card, #1a1a1a);
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 8px;
    padding: 8px 10px;
    transition: border-color 0.15s;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.ewi-c-compose__inner:focus-within { border-color: rgba(77,163,255,0.4); }

.ewi-c-compose__avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg, #0d0d0d);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted, #888);
}

.ewi-c-compose__avatar img { width: 100%; height: 100%; object-fit: cover; }

.ewi-c-textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    color: var(--text, #e0e0e0);
    font-size: 0.875rem;
    line-height: 1.5;
    min-height: 20px;
    max-height: 140px;
    overflow-y: auto;
    font-family: inherit;
}

.ewi-c-textarea::placeholder { color: var(--text-muted, #555); }

.ewi-c-textarea:disabled { cursor: not-allowed; }

.ewi-c-compose__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ewi-c-attach-btn {
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.1s;
    line-height: 1;
    padding: 2px;
}

.ewi-c-attach-btn:hover { opacity: 1; }

.ewi-c-send-btn {
    background: var(--accent, #4DA3FF);
    color: #000;
    border: none;
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
}

.ewi-c-send-btn:hover:not(:disabled) { opacity: 0.88; }
.ewi-c-send-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.ewi-c-image-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 6px 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 6px;
}

.ewi-c-image-preview img {
    height: 48px;
    border-radius: 4px;
    object-fit: cover;
}

.ewi-c-image-remove {
    background: none;
    border: none;
    color: var(--text-muted, #888);
    cursor: pointer;
    font-size: 0.78rem;
}

.ewi-c-image-remove:hover { color: #ff5a5a; }

/* ── Lightbox ─────────────────────────────────────────────────── */
.ewi-c-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ewi-c-lightbox__img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.ewi-c-lightbox__close {
    position: absolute;
    top: 20px;
    right: 24px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    line-height: 1;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 700px) {
    .ewi-community { top: var(--ewi-nav-h, 70px); }
}
@media (max-width: 480px) {
    .ewi-c-sidebar { width: 180px !important; }
}

/* ── Welcome channel item (sidebar) ──────────────────────────── */
.ewi-c-channel-item {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 7px 14px;
    cursor: pointer;
    color: var(--text-muted, #888);
    font-size: 0.82rem;
    text-decoration: none;
    transition: background 0.1s, color 0.1s;
    line-height: 1.3;
}

.ewi-c-channel-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text, #ddd);
    text-decoration: none;
}

.ewi-c-channel-item.is-active {
    background: rgba(77,163,255,0.12);
    color: var(--accent, #4DA3FF);
    font-weight: 600;
}

.ewi-c-channel-item--welcome {
    color: var(--text, #e0e0e0);
    border-bottom: 1px solid var(--border, #2a2a2a);
    margin-bottom: 4px;
    padding-bottom: 10px;
}

/* ── Feature 2: Message Staff / Staff Inbox (sidebar) ───────────
   Same divider treatment as the welcome item above — each is the
   last of the "special" top-of-sidebar entries for its audience
   (Message Staff for members, Staff Inbox additionally for staff). */
.ewi-c-channel-item--message-staff,
.ewi-c-channel-item--staff-inbox {
    color: var(--text, #e0e0e0);
    border-bottom: 1px solid var(--border, #2a2a2a);
    margin-bottom: 4px;
    padding-bottom: 10px;
}

/* ── Staff Inbox list (main feed) ────────────────────────────────
   Mirrors .ewi-channel-unread's pill styling for the unread count,
   so it reads as the same "unread" signal already used elsewhere. */
.ewi-c-inbox-list {
    max-width: 640px;
    width: 100%;
    margin: 16px auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ewi-c-inbox-empty {
    text-align: center;
    color: var(--text-muted, #888);
    padding: 32px 0;
}

.ewi-c-inbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-card, #121212);
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    color: var(--text, #ddd);
    transition: background 0.1s, border-color 0.1s;
}

.ewi-c-inbox-row:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--accent, #4DA3FF);
}

.ewi-c-inbox-row.has-unread .ewi-c-inbox-row__name {
    font-weight: 700;
}

.ewi-c-inbox-row__name {
    flex-shrink: 0;
    font-size: 0.9rem;
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ewi-c-inbox-row__preview {
    flex: 1;
    min-width: 0;
    font-size: 0.82rem;
    color: var(--text-muted, #888);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ewi-c-inbox-row__unread {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--accent, #4DA3FF);
    color: #000;
    font-size: 0.6rem;
    font-weight: 800;
    border-radius: 8px;
    flex-shrink: 0;
}

/* ── Welcome card (main feed) ─────────────────────────────────── */
.ewi-c-welcome {
    max-width: 600px;
    width: 100%;
    margin: 24px auto;
    background: var(--bg-card, #121212);
    border: 1px solid var(--border, #2a2a2a);
    border-left: 3px solid var(--accent, #4DA3FF);
    border-radius: 10px;
    padding: 28px 32px;
}

.ewi-c-welcome__logo {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    background: var(--accent, #4DA3FF);
    color: #000;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 14px;
}

.ewi-c-welcome__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent, #4DA3FF);
    margin: 0 0 20px;
    line-height: 1.3;
}

.ewi-c-welcome__section {
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text, #d0d0d0);
}

.ewi-c-welcome__section:last-of-type { border-bottom: none; }

.ewi-c-welcome__section p { margin: 0 0 8px; }
.ewi-c-welcome__section p:last-child { margin-bottom: 0; }

.ewi-c-welcome__list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
}

.ewi-c-welcome__list li { padding: 4px 0; }

.ewi-c-welcome__upgrade {
    background: rgba(77,163,255,0.05);
    border: 1px solid rgba(77,163,255,0.15);
    border-radius: 6px;
    padding: 12px 16px;
    margin: 4px 0;
}

.ewi-c-welcome__rules-title {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text, #e0e0e0);
    margin-bottom: 10px;
}

.ewi-c-welcome__rules {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ewi-c-welcome__rules li {
    padding: 4px 0 4px 14px;
    font-size: 0.85rem;
    color: var(--text-muted, #aaa);
    position: relative;
}

.ewi-c-welcome__rules li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent, #4DA3FF);
    opacity: 0.6;
}

.ewi-c-welcome__footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.05);
    font-size: 0.82rem;
    color: var(--text-muted, #888);
    font-style: italic;
}

/* ── Sidebar collapsed state ───────────────────────────────── */
.ewi-c-sidebar.is-collapsed { display: none; }

/* ── Sidebar close button (inside sidebar header) ──────────── */
.ewi-c-sidebar-close {
    background: none;
    border: none;
    color: var(--text-muted, #888);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 4px;
    line-height: 1;
    margin-left: auto;
    flex-shrink: 0;
    font-family: inherit;
}
.ewi-c-sidebar-close:hover { color: var(--text, #e0e0e0); background: rgba(255,255,255,0.06); }

/* ── Sidebar reopen button (inside main header) ─────────────── */
.ewi-c-sidebar-reopen {
    background: none;
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text-muted, #888);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
    flex-shrink: 0;
    margin-right: 8px;
    font-family: inherit;
}
.ewi-c-sidebar-reopen:hover { color: var(--text, #e0e0e0); border-color: rgba(255,255,255,0.25); }

/* ── Sidebar toggle button ─────────────────────────────────── */
.ewi-c-sidebar-toggle {
    display: none;
    align-items: center;
    gap: 6px;
    background: rgba(77,163,255,0.12);
    border: 1px solid rgba(77,163,255,0.3);
    color: var(--accent, #4DA3FF);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    flex-shrink: 0;
    line-height: 1;
    margin-right: 8px;
    font-family: inherit;
}
.ewi-c-sidebar-toggle:hover { background: rgba(77,163,255,0.2); border-color: rgba(77,163,255,0.5); }

/* ── Sidebar backdrop ──────────────────────────────────────── */
.ewi-c-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 290;
}
.ewi-c-sidebar-backdrop.is-open { display: block; }
