/* Round 386: Unified Dynamic Member Panel Shell (RTL + LTR + Dark Mode) */

.mshell-layout {
    display: grid;
    grid-template-columns: 256px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.mshell-sidebar {
    position: sticky;
    top: 84px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg, 16px);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.mshell-user-card {
    display: flex;
    align-items: center;
    gap: 11px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.mshell-avatar {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--green-soft, #e6f2ea);
    color: var(--green, #1b5e20);
    font-weight: 800;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--green-border, #bfe0c6);
}

.mshell-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mshell-user-meta {
    min-width: 0;
}

.mshell-user-name {
    display: block;
    font-size: 14.5px;
    font-weight: 800;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mshell-user-sub {
    display: block;
    font-size: 12px;
    color: var(--subtle);
    margin-top: 1px;
}

.mshell-post-cta {
    width: 100%;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-bottom: 16px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 800;
    text-decoration: none;
    box-sizing: border-box;
}

.mshell-mobile-strip,
.mshell-nav-collapse-btn {
    display: none;
}

.mshell-nav-group {
    margin-bottom: 14px;
}

.mshell-nav-group:last-child {
    margin-bottom: 0;
}

.mshell-nav-group-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--subtle);
    padding: 0 10px 6px;
}

html[lang="fa"] .mshell-nav-group-label {
    text-transform: none;
    letter-spacing: 0;
    font-size: 11.5px;
}

.mshell-nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border-radius: 11px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    transition: background-color 0.14s ease, color 0.14s ease;
    margin-bottom: 2px;
}

.mshell-nav-link:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.mshell-nav-link.is-active {
    background: var(--green-soft, #e6f2ea);
    color: var(--green, #1b5e20);
    font-weight: 800;
}

.mshell-nav-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mshell-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--green, #1b5e20);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
}

.mshell-content {
    min-width: 0;
}

/* Dark Mode */
html[data-theme="dark"] .mshell-nav-link.is-active {
    background: rgba(16, 185, 129, 0.16);
    color: #6ee7b7;
}

html[data-theme="dark"] .mshell-avatar {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(74, 222, 128, 0.3);
    color: #6ee7b7;
}

/* Mobile & Tablet Responsive (< 1024px) */
@media (max-width: 1023px) {
    .mshell-layout {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .mshell-sidebar {
        position: static;
        padding: 12px;
    }

    .mshell-user-card,
    .mshell-post-cta {
        display: none;
    }

    .mshell-mobile-strip {
        display: flex;
        align-items: center;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .mshell-mobile-strip::-webkit-scrollbar {
        display: none;
    }

    .mshell-mobile-pill {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        min-height: 38px;
        padding: 6px 12px;
        border-radius: 999px;
        border: 1px solid var(--line);
        background: var(--surface-2);
        color: var(--ink);
        font-size: 13px;
        font-weight: 700;
        text-decoration: none;
        white-space: nowrap;
    }

    .mshell-mobile-pill.is-active {
        background: var(--green, #1b5e20);
        border-color: var(--green, #1b5e20);
        color: #fff;
    }

    .mshell-nav-collapse {
        margin-top: 8px;
        border-top: 1px solid var(--line);
        padding-top: 8px;
    }

    .mshell-nav-collapse:not([open]) .mshell-nav {
        display: none;
    }

    .mshell-nav-collapse-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-size: 12.5px;
        font-weight: 700;
        color: var(--muted);
        cursor: pointer;
        list-style: none;
        padding: 4px 2px;
    }

    .mshell-nav-collapse-btn::-webkit-details-marker {
        display: none;
    }
}
