/* ============================================================
   Messaging System — Admin + Portal Styles
   ============================================================ */

/* ── Admin inbox table ── */
.aee-row-unread td { background: rgba(200, 168, 76, 0.06); }

.aee-unread-pill {
    display: inline-block;
    background: var(--color-accent, #c8a84c);
    color: #07091a;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ── Conversation bubbles (shared admin + portal) ── */
.aee-conversation {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem 0;
    max-height: 480px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.aee-bubble {
    max-width: 72%;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    line-height: 1.55;
}

.aee-bubble--mine {
    align-self: flex-end;
    background: #c8a84c;
    color: #07091a;
    border-bottom-right-radius: 3px;
}

.aee-bubble--theirs {
    align-self: flex-start;
    background: #1a1d30;
    color: #e0dbd2;
    border: 1px solid rgba(255,255,255,0.08);
    border-bottom-left-radius: 3px;
}

.aee-bubble__meta {
    font-size: 0.75rem;
    opacity: 0.65;
    margin-bottom: 0.35rem;
}

.aee-bubble--mine  .aee-bubble__meta { color: #07091a; }
.aee-bubble--theirs .aee-bubble__meta { color: #e0dbd2; }

.aee-bubble__body { font-size: 0.9375rem; }

/* ── Admin thread header ── */
.aee-thread-header {
    border-left: 3px solid #c8a84c;
    padding-left: 1rem;
    margin-bottom: 1.25rem;
}
.aee-thread-header h2 { margin: 0 0 0.25rem; }

/* ── Admin reply form ── */
.aee-reply-wrap {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    max-width: 700px;
}
.aee-reply-wrap h3 { margin-top: 0; }

/* ── Portal inbox layout ── */
.aee-portal-inbox {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    overflow: hidden;
    min-height: 520px;
    margin-top: 1.5rem;
}

.aee-inbox-sidebar {
    background: rgba(255,255,255,0.03);
    border-right: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
}

.aee-inbox-heading {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #e0dbd2;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.aee-inbox-empty {
    padding: 1.25rem;
    color: rgba(224,219,210,0.5);
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
}

.aee-thread-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

.aee-thread-item a {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0 0.5rem;
    padding: 0.875rem 1.25rem;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
}
.aee-thread-item a:hover { background: rgba(255,255,255,0.04); }
.aee-thread-item.is-active a { background: rgba(200,168,76,0.1); }

.aee-thread-subject {
    grid-column: 1;
    grid-row: 1;
    font-size: 0.875rem;
    color: #e0dbd2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aee-thread-time {
    grid-column: 2;
    grid-row: 1;
    font-size: 0.75rem;
    color: rgba(224,219,210,0.4);
    white-space: nowrap;
}

.aee-thread-item .aee-unread-pill {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
    justify-self: end;
}

.aee-thread-item.is-unread .aee-thread-subject { color: #fff; }

/* ── Portal main pane ── */
.aee-inbox-main {
    display: flex;
    flex-direction: column;
    background: rgba(255,255,255,0.01);
}

.aee-inbox-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: rgba(224,219,210,0.3);
}
.aee-inbox-placeholder .dashicons { font-size: 2.5rem; width: 2.5rem; height: 2.5rem; }
.aee-inbox-placeholder p { margin: 0; font-size: 0.9375rem; }

.aee-thread-header {
    padding: 1rem 1.5rem 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.aee-thread-header h3 { margin: 0 0 0.2rem; color: #e0dbd2; font-size: 1rem; }
.aee-thread-with { font-size: 0.8125rem; color: rgba(224,219,210,0.5); }

.aee-conversation {
    flex: 1;
    padding: 1.25rem 1.5rem;
}

/* ── Portal reply form ── */
.aee-reply-form {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.aee-reply-form textarea {
    width: 100%;
    min-height: 72px;
    resize: vertical;
}

.aee-reply-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.aee-reply-status {
    font-size: 0.8125rem;
    color: #10b981;
}
.aee-reply-status.is-error { color: #ef4444; }

/* ── Portal tab for Messages ── */
.portal-nav {
    display: flex;
    gap: 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 1.5rem;
}

.portal-nav__tab {
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: rgba(224,219,210,0.6);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.portal-nav__tab:hover { color: #e0dbd2; }

.portal-nav__tab.is-active {
    color: #c8a84c;
    border-bottom-color: #c8a84c;
}

/* ── Mobile ── */
@media (max-width: 640px) {
    .aee-portal-inbox {
        grid-template-columns: 1fr;
    }
    .aee-inbox-sidebar {
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.08);
        max-height: 220px;
    }
}
